I have try to compile usermode linux kernel but the compilation failed with arch/um/sys-i386/user-offsets.c:4:22: error: asm/user.h: No such file or directory kernel: gentoo-sources-2.6.20-r2 With linux-headers-2.6.20 everything works fine.
Portage 2.1.2.2 (default-linux/x86/2006.1, gcc-4.1.2, glibc-2.5-r0, 2.6.20-gentoo-r2-skas3-v9-pre9 i686) ================================================================= System uname: 2.6.20-gentoo-r2-skas3-v9-pre9 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz Gentoo Base System release 1.12.9 Timestamp of tree: Mon, 12 Mar 2007 02:50:01 +0000 dev-java/java-config: 1.3.7, 2.0.31-r4 dev-lang/python: 2.4.4 dev-python/pycrypto: 2.0.1-r5 sys-apps/sandbox: 1.2.18.1 sys-devel/autoconf: 2.13, 2.61 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10 sys-devel/binutils: 2.17 sys-devel/gcc-config: 1.3.15 sys-devel/libtool: 1.5.23b virtual/os-headers: 2.6.20-r1 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O3 -march=nocona -mmmx -msse -msse2 -mfpmath=sse -funroll-loops -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/X11/xkb" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O3 -march=nocona -mmmx -msse -msse2 -mfpmath=sse -funroll-loops -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="ftp://ftp.sh.cvut.cz/MIRRORS/gentoo/gentoo http://gentoo.supp.name/ ftp://mirrors.blueyonder.co.uk/mirrors/gentoo ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp.rhnet.is/pub/gentoo/ " MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://10.4.1.42/gentoo-portage" USE="X a52 aac aalib acl acpi alsa berkdb bitmap-fonts bluetooth bzip2 cairo cdr cli cracklib crypt cups curl dga dri dv dvd dvdr dvdread encode ethereal ffmpeg firefox flac foomaticdb fortran freetype gdbm geos gif gmp gpm gtk gtk2 iconv icq idn imagemagick imap imlib iproute2 ipv6 irc isdnlog ithreads jabber javascript jbig jikes jpeg jpeg2k kerberos lcms ldap lm-sensors log4j mad maildir midi mmx mmx2 mmxext mng motif mozdevelop mozsvg mp3 mpeg ncurses netboot network nfs nis nls nntp nptl nptlonly nvidia ogg openexr opengl pam pcre pdf perl png postgres ppds pppd proj python qt3 qt4 quicktime readline reflection rss rtc samba sasl scanner sdl servletapi session snmp spell spl sse sse2 ssl svg sysfs tcltk tcpd tetex theora threads tiff tk truetype truetype-fonts type1-fonts udev unicode usb vim-syntax vorbis win32codecs x86 xml xorg xosd xpm xscreensaver xv xvid zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nv vesa" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
http://archives.gentoo.org/gentoo-dev/msg_143254.xml : > the very latest linux-headers package no longer installs asm/page.h ... this > will (and is) causing trouble for many packages The dropping of page.h and user.h from linux-headers is intentional. cc'ing kernel for comment (usermode-sources bug?).
(whoops - didn't mean to reassign as well, just to cc: kernel!)
not a bug in linux-headers
(In reply to comment #4) > not a bug in linux-headers > Ok I will try to resolve it or report problem to usermode linux developers.
*** Bug 172256 has been marked as a duplicate of this bug. ***
I face the same problem with 2.6.18 usermode-sources. But another my gentoo machine compiles fine, it seems I update the kernel headers on that machine. It doesn't make sense it depends on other sources directory if you compile kernel.
You're not compiling a kernel. You're compling a user-space program. Some parts of it need to be compiled against the installed userspace headers. I'm working with upstream on a fix. Be patient.
make O=/usr/src/mylinux/uml/linux-2.6.18-usermode-r1/um_binary/ V=1 ARCH=um make -C /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/um_binary \ KBUILD_SRC=/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1 \ KBUILD_EXTMOD="" -f /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/Makefile _all SYMLINK arch/um/include/kern_constants.h ln -sf ../../../include/asm-um/asm-offsets.h arch/um/include/kern_constants.h SYMLINK arch/um/include/sysdep ln -fsn /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include/sysdep-i386 arch/um/include/sysdep make -f /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/scripts/Makefile.build obj=arch/um/sys-i386 arch/um/sys-i386/user-offsets.s gcc -Wp,-MD,arch/um/sys-i386/.user-offsets.s.d -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -D__arch_um__ -DSUBARCH=\"i386\" -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Iarch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include/skas -D_FILE_OFFSET_BITS=64 -march=i686 -mtune=pentium4 -mpreferred-stack-boundary=2 -ffreestanding -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -fverbose-asm -S -o arch/um/sys-i386/user-offsets.s /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:4:22: error: asm/user.h: No such file or directory /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c: In function 'foo': /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:52: error: invalid application of 'sizeof' to incomplete type 'struct user_i387_struct' /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:53: error: invalid application of 'sizeof' to incomplete type 'struct user_fxsr_struct' /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:71: error: invalid application of 'sizeof' to incomplete type 'struct user_regs_struct' make[2]: *** [arch/um/sys-i386/user-offsets.s] Error 1 make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 2 gcc -Wp,-MD,arch/um/sys-i386/.user-offsets.s.d -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -D__arch_um__ -DSUBARCH=\"i386\" -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Iarch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include/skas -D_FILE_OFFSET_BITS=64 -march=i686 -mtune=pentium4 -mpreferred-stack-boundary=2 -ffreestanding -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -fverbose-asm -S -o arch/um/sys-i386/user-offsets.s /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /home/yzhao/vr/var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --disable-multilib --disable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 4.1.2 (Gentoo 4.1.2) /usr/libexec/gcc/i686-pc-linux-gnu/4.1.2/cc1 -quiet -v -Iarch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include -I/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include/skas -iprefix /home/yzhao/vr/usr/i686-pc-linux-gnu/gcc-bin/4.1.2/../../../lib/gcc/i686-pc-linux-gnu/4.1.2/ -D__arch_um__ -DSUBARCH="i386" -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -MD arch/um/sys-i386/.user-offsets.s.d /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c -quiet -dumpbase user-offsets.c -march=i686 -mtune=pentium4 -mpreferred-stack-boundary=2 -auxbase-strip arch/um/sys-i386/user-offsets.s -g -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -Wdeclaration-after-statement -Wno-pointer-sign -version -fno-strict-aliasing -fno-common -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-protector -ffreestanding -fverbose-asm -o arch/um/sys-i386/user-offsets.s ignoring nonexistent directory "/home/yzhao/vr/usr/i686-pc-linux-gnu/gcc-bin/4.1.2/../../../lib/gcc/i686-pc-linux-gnu/4.1.2/include" ignoring nonexistent directory "/home/yzhao/vr/usr/i686-pc-linux-gnu/gcc-bin/4.1.2/../../../lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/include" ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/include" ignoring duplicate directory "/home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include" #include "..." search starts here: #include <...> search starts here: arch/um/include /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/include/skas /usr/local/include /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include /usr/include End of search list. GNU C version 4.1.2 (Gentoo 4.1.2) (i686-pc-linux-gnu) compiled by GNU C version 4.1.2 (Gentoo 4.1.2). GGC heuristics: --param ggc-min-expand=96 --param ggc-min-heapsize=125355 Compiler executable checksum: a75ea5f8a8e9b0002490b87fd70f1154 /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:4:22: error: asm/user.h: No such file or directory /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c: In function 'foo': /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:52: error: invalid application of 'sizeof' to incomplete type 'struct user_i387_struct' /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:53: error: invalid application of 'sizeof' to incomplete type 'struct user_fxsr_struct' /home/yzhao/src/mylinux/uml/linux-2.6.18-usermode-r1/arch/um/sys-i386/user-offsets.c:71: error: invalid application of 'sizeof' to incomplete type 'struct user_regs_struct'
yes, I agree it is a userspace process. But normal kernel can be compiled to a ELF executable binary, so could you give me some examples, what else user space headers we need? Thanks I remembered Makefile will link asm-arch to asm directory under include, so I just add -I $(KBUILD_SRC)/include to arch/um/Makefile and link asm-subarch to asm. I will wait official patch for it.
Look for USER_OBJS in the makefiles under arch/um. All of those objects are built against userspace headers, not kernel headers.
We are two months further now and I still cannot compile usermode: # make linux ARCH=um scripts/kconfig/conf -s arch/um/Kconfig SYMLINK arch/um/include/kern_constants.h CHK arch/um/include/uml-config.h UPD arch/um/include/uml-config.h CC arch/um/sys-i386/user-offsets.s arch/um/sys-i386/user-offsets.c:4:22: error: asm/user.h: No such file or directory arch/um/sys-i386/user-offsets.c: In function ‘foo’: arch/um/sys-i386/user-offsets.c:19: warning: implicit declaration of function ‘offsetof’ arch/um/sys-i386/user-offsets.c:19: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:20: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:21: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:22: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:23: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:24: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:25: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:26: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:27: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:28: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:29: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:30: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:31: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:32: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:33: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:34: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:35: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:36: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:37: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:38: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:39: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:40: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:41: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:42: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:43: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:44: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:45: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:46: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:47: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:48: error: expected expression before ‘struct’ arch/um/sys-i386/user-offsets.c:51: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_i387_struct’ arch/um/sys-i386/user-offsets.c:52: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_fxsr_struct’ arch/um/sys-i386/user-offsets.c:70: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_regs_struct’ make[1]: *** [arch/um/sys-i386/user-offsets.s] Error 1 make: *** [arch/um/sys-i386/user-offsets.s] Error 2
I'm sorry, this slipped off my radar. I've committed 2.6.18-r2 with a preliminary patch that works in my testing. However, I don't have complex configurations, and don't (currently) have any x86 hosts to test on, so I've masked it. Please unmaske it and test, and report success or failure. I'm specifically interested in whether it still works with 2.6.20 headers. I'll test this tomorrow when I have access to my work machines.
seems to be fixed in -r2. Thank you.
Unmasked.
*** Bug 182089 has been marked as a duplicate of this bug. ***
*** Bug 189616 has been marked as a duplicate of this bug. ***
Hhm, with current gentoo sources 2.6.22 there's a similar problem, but I can't re-open this bug ...
*** Bug 205560 has been marked as a duplicate of this bug. ***