• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Compiling schedule outside kernel source

FlatTargetInk

New Member


Messages: 2

#1
For a school project I am analyzing and modifying the process scheduler in FreeBSD. We chose FreeBSD because modifying the kernel is the easiest out of any operating system I have ever used. Currently, I am trying to compile the scheduler (sched_ule.c) outside the kernel source so I can make a test bench of the current and modified scheduler. When I compile now, I get a long list of errors, the first few are here:

Code:
In file included from sched_ule.c:45:
/usr/include/sys/systm.h:304:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
void    hardclock(int usermode, uintfptr_t pc);
                                ^
/usr/include/sys/_stdint.h:78:22: note: 'uintptr_t' declared here
typedef __uintptr_t             uintptr_t;
                                ^
In file included from sched_ule.c:45:
/usr/include/sys/systm.h:311:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
void    profclock(int usermode, uintfptr_t pc);
                                ^
I attached the entire output as make_output.txt.
I'm using Clang and I've tried including /usr/src/include as a system header directory, and as a standard header and I still get the same errors. I'm using a simple makefile to build this as it should be a simple project.

Code:
CC      = clang
SYSINC  = /usr/src/include
INC1    = /usr/src/sys/amd64/include
INCDIRS = -isystem${SYSINC} -I${INC1}
CFLAGS  = ${INCDIRS}

sched_ece: sched_ule.c opt_sched.h opt_hwpmc_hooks.h
        ${CC} ${CFLAGS} sched_ule.c -o sched_ece
I plan to add driver code later to actually test it but first I needed to get this to at least compile. I used svnlite to get the source into /usr/src and I copied sched_ule.c into my testing directory. I also copied opt_sched.h and opt_hwpmc_hooks.h from /usr/obj after performing a make buildkernel . I've been trying to follow the makefiles in the source tree but they are dense and I haven't seen much that has been helpful.
I would like to get this to compile for my own testbench but if there is an existing one floating around, I'll gladly borrow from that. Any help is appreciated.
 

Attachments

ShelLuser

Daemon

Thanks: 1,105
Best answers: 2
Messages: 2,429

#2
Now, I'm by far an expert on this subject but... Have you tried to include /usr/src/sys yet?

Just using logical deduction here. The process obviously has an issue with /usr/include/sys/systm.h. Well, systm.h does not exist in /usr/src/include so I don't understand why you even bothered to try that.

However, the kernel source is obviously located in /usr/src/sys and if you look at the original path you'll see that sys/systm.h is being used, together with sys/_stdint.h, all of which are available in /usr/src/sys/sys. Logical conclusion: you probably used the wrong path.

As far as I know the kernel is a pretty stand-alone setup, which is also the reason why it gets build separately from the base system.
 

FlatTargetInk

New Member


Messages: 2

#3
Now I have /usr/src/sys as the only include, and I included it with -I and with -isystem . The first gives me these warnings and error:
Code:
clang -I/usr/src/sys sched_ule.c -o sched_ece
In file included from sched_ule.c:45:
/usr/src/sys/sys/systm.h:190:5: warning: declaration of built-in function 'setjmp' requires
inclusion of the header <setjmp.h> [-Wbuiltin-requires-header]
int     setjmp(struct _jmp_buf *) __returns_twice;
        ^
/usr/src/sys/sys/systm.h:191:6: warning: declaration of built-in function 'longjmp'
requires inclusion of the header <setjmp.h> [-Wbuiltin-requires-header]
void    longjmp(struct _jmp_buf *, int) __dead2;
        ^
/usr/src/sys/sys/systm.h:226:6: warning: incompatible redeclaration of library function 'log'
[-Wincompatible-library-redeclaration]
void    log(int, const char *, ...) __printflike(2, 3);
        ^
/usr/src/sys/sys/systm.h:226:6: note: 'log' is a builtin with type 'double (double)'
/usr/src/sys/sys/systm.h:304:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
void    hardclock(int usermode, uintfptr_t pc);
                                ^~~~~~~~~~
                                uintptr_t
/usr/src/sys/sys/_stdint.h:78:22: note: 'uintptr_t' declared here
typedef __uintptr_t             uintptr_t;
                                ^
In file included from sched_ule.c:45:
/usr/src/sys/sys/systm.h:311:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
and many more, but when I include as the system include directory, I get
Code:
clang -isystem/usr/src/sys sched_ule.c -o sched_ece
In file included from sched_ule.c:45:
/usr/src/sys/sys/systm.h:304:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
void    hardclock(int usermode, uintfptr_t pc);
                                ^
/usr/src/sys/sys/_stdint.h:78:22: note: 'uintptr_t' declared here
typedef __uintptr_t             uintptr_t;
                                ^
In file included from sched_ule.c:45:
/usr/src/sys/sys/systm.h:311:30: error: unknown type name 'uintfptr_t'; did you mean 'uintptr_t'?
void    profclock(int usermode, uintfptr_t pc);
                                ^
/usr/src/sys/sys/_stdint.h:78:22: note: 'uintptr_t' declared here
typedef __uintptr_t             uintptr_t;
which looks closer to my original error but with /usr/src/sys/... complaining instead. I'm currently looking for the file that declares uintfptr_t . I'll come back when I have more progress.
 
Top