Summary: | sys-libs/glibc 2.10.1 build fails due to missing __call_fallocate symbol | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Mikael Magnusson <mikachu> |
Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | araujo, eric_chaligny |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 289342 | ||
Attachments: |
build log
0077_all_i386-glibc-no-fallocate.patch 0077_all_i386-glibc-no-fallocate.patch |
Description
Mikael Magnusson
2009-06-15 18:58:27 UTC
Let's see what our toolchain ninjas think about this... ive built 2.10.1 just fine on x86. i dont think the patch you posted is causing any build errors, nor can we safely include it in 2.10.x since it changes the ABI to reference 2.11 symbols. Okay, I was probably a bit confused when I reported this bug. What happened was that I got a linking failure involving __fallocate64 or something of the sort. I then saw this commit in glibc git and thought "ah, it's a linking bug that they've fixed for 2.11", obviously I was wrong though and the linking error was for something else, and the commit is just for exporting the interface. Sorry about the noise. i'm not saying you werent seeing a build error. if you still are with the latest 2.10.1 ebuild, then post the full build.log as an attachment please. Created attachment 195610 [details]
build log
You probably want this too: Portage 2.2_rc33 (default/linux/x86/2008.0/desktop, gcc-4.3.3, glibc-2.7-r1, 2.6.19.2-ck2-2 i686) ================================================================= System uname: Linux-2.6.19.2-ck2-2-i686-AMD_Athlon-TM-_XP_2600+-with-glibc2.0 Timestamp of tree: Mon, 22 Jun 2009 17:15:02 +0000 app-shells/bash: 4.0_p17 dev-java/java-config: 1.3.7-r1, 2.1.7 dev-lang/python: 2.5.4-r2, 2.6.1-r1 dev-python/pycrypto: 2.0.1-r8 dev-util/cmake: 2.6.3-r1 sys-apps/baselayout: 1.12.12 sys-apps/sandbox: 1.9 sys-devel/autoconf: 2.13, 2.63-r1 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.2 sys-devel/binutils: 2.18-r4, 2.19, 2.19.1-r1 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6a virtual/os-headers: 2.6.19.2-r2 ACCEPT_KEYWORDS="x86 ~x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon-xp -O3 -pipe -mfpmath=sse -msse -m3dnow" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /usr/share/gconf" CONFIG_PROTECT_MASK="/etc/asciidoc /etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d /usr/share/texmf /var/lib/rpm" CXXFLAGS="-march=athlon-xp -O3 -pipe -mfpmath=sse -msse -m3dnow -fpermissive -DMIKACHU" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--alphabetical --nospinner" FEATURES="digests distlocks fixpackages metadata-transfer noinfo preserve-libs protect-owned sandbox sfperms strict userfetch" GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1" LINGUAS="sv ja" MAKEOPTS="-j1" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/exclude-from" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/neko/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/overlays/mikachu" SYNC="rsync://rsync1.uk.gentoo.org/gentoo-portage" USE="3dnow X aalib acpi alsa avi branding bzip2 cairo canna cdr cli cracklib crypt cups dri dvd dvdr dvdread emboss encode f77 fam firefox flac fortran gcj gdbm gif gpm gs gtk gtk2 gtkhtml iconv idn isdnlog jpeg jpeg2k kdeenablefinal kpathsea libnotify mad midi mikmod mmx moznocompose moznoirc moznomail mozsvg mp3 mpeg mudflap ncurses nethack no-old-linux nodrm noutempter nptl nptlonly objc ogg opengl openmp oss pam pcre pdf perl pic png ppds pppd python qt3 qt3support qt4 readline reflection sdl session spl sse ssl startup-notification svg sysfs tetex tiff truetype unicode usb vorbis win32codecs wmf x86 xattr xml xorg xprint xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv ja" USERLAND="GNU" VIDEO_CARDS="nv" Unset: CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS /tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate': (.text+0xb2244): undefined reference to `__call_fallocate' /tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `__fallocate64_l64': (.text+0xb2255): undefined reference to `__call_fallocate' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: /tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc.so: hidden symbol `__call_fallocate' isn't defined /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../../i686-pc-linux-gnu/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status make[1]: *** [/tmp/portage/sys-libs/glibc-2.10.1/work/build-default-i686-pc-linux-gnu-nptl/libc.so] Error 1 This appears to be due to my 2.6.19 kernel/kernel headers, fallocate was added in 2.6.23. __call_fallocate is called without ifdefs on __NR_fallocate but defined under one, so it can never work. Unless the whole file is compiled conditionally, but it doesn't appear to be, since it does break. (the glibc makefiles are not easy to follow). glibc-2.11/sysdeps/unix/sysv/linux/i386/call_fallocate.S has the definition glibc-2.11/sysdeps/unix/sysv/linux/i386/fallocate{,64}.c has the calls I added a dummy definition to fallocate.c that just returns -ENOTSUP and the compilation finishes now. ah, good catch. i'll have to look at the expanded assembly to see what the best course of action is ... It also seems the oldest linux-headers package currently in portage is 2.6.23, I just never upgraded to it. Is it generally safe to have newer headers than the running kernel? with glibc, there should be no need whatsoever for the kernel headers to match the running kernel version, or any other version relationship. the only requirement is that both must be 2.6.9 or newer (controllable by $NPTL_KERN_VER). Created attachment 209779 [details, diff]
0077_all_i386-glibc-no-fallocate.patch
try this patch. if you update your tree, you should be able to put this patch into /etc/portage/patches/sys-libs/glibc/ to test it.
Before I try that, and it was what I almost tried first too, I'm not sure if it's a good solution. The fallocate(2) manpage documents it as running the syscall directly, and recommends using the posix_fallocate() function for being portable. If I remember correctly, there are some non-ifdeffed extern declarations of __call_fallocate a few lines above your two hunks too, so I don't know if the patch will compile. The error message I got mentioned the hidden attribute, but maybe it won't be an error if the function isn't used anyway. I'll try compiling it in a while. /tmp/portage/sys-libs/glibc-2.11/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate': (.text+0xb15f7): undefined reference to `internal_fallocate' /tmp/portage/sys-libs/glibc-2.11/work/build-default-i686-pc-linux-gnu-nptl/libc_pic.os: In function `fallocate64': (.text+0xb1645): undefined reference to `internal_fallocate64' sysdeps/unix/sysv/posix_fallocate.c does this weird dance: #define posix_fallocate static internal_fallocate #include <sysdeps/posix/posix_fallocate.c> #undef posix_fallocate Presumably we can just call posix_fallocate() instead then. Now I remember why I didn't do this. The corresponding 64-bit file has __posix_fallocate64_l64 and when I tried to call that I got warnings that it wasn't defined. It does the same dance: #define __posix_fallocate64_l64 static internal_fallocate64 #include <sysdeps/posix/posix_fallocate64.c> #undef __posix_fallocate64_l64 . . . int __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) { #ifdef __NR_fallocate . . . #endif return internal_fallocate64 (fd, offset, len); } I still think the easiest and most consistent thing is to return -enotsup, since that is what will happen if you compile with newer headers. If an app tries to use fallocate() directly, it probably falls back on posix_fallocate() too. Created attachment 209781 [details, diff]
0077_all_i386-glibc-no-fallocate.patch
the recommended user usage has no bearing here. fallocate() is part of the C library ABI and cannot be removed. it also has explicit semantics different from posix_fallocate() which need to be retained. so you're right we cant use the internal_fallocate stuff like the posix_fallocate file (which i misread). this patch just uses the same method as the other fallocate files.
extern decls also dont matter at all. you can declare whatever extern's you want without getting a build error.
This patch compiles and links, so it probably works as intended too. thanks for testing. ive added the patch to 2.10.1 and 2.11. |