Hi I have searched the "Net" and I found out that glibc 2.3.2 (the one installed on my gentoo) has this functions (and it even installs a sys/epoll.h) but I fail to link with epoll functions as seen here: $ gcc test.c -o test /tmp/cc8UJK9W.o(.text+0x11): In function `main': : undefined reference to `epoll_create' collect2: ld returned 1 exit status $ cat test.c extern void epoll_create(void); int main(void) { epoll_create(); } Please help, thanks! PS: I run 2.6.0-test11 kernel Reproducible: Always Steps to Reproduce: Portage 2.0.49-r15 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.6.0-test11) ================================================================= System uname: 2.6.0-test11 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz Gentoo Base System version 1.4.3.10p1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=i686 -O2 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/config /var/qmail/control /var/qmail/alias" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-march=i686 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="sandbox ccache autoaddcvs buildpkg" GENTOO_MIRRORS="http://ftp.lug.ro/gentoo ftp://ftp.lug.ro/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="x86 apm avi crypt encode foomaticdb gif gtk2 jpeg libg++ mad mikmod mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib gdbm berkdb slang readline tetex java mysql tcpd pam libwww ssl perl python imlib oggvorbis motif opengl mozilla X gtk -gnome -kde alsa -oss sse mmx gpm -svga sdl -arts -esd dvd -cups -qt tcltk apache2"
works just fine over here: root@mindcircus 0 root # cat test.c #include <sys/epoll.h> int main() { epoll_create(1); } root@mindcircus 0 root # gcc test.c root@mindcircus 0 root # nm a.out | grep epoll U epoll_create@@GLIBC_2.3.2 root@mindcircus 0 root # qpkg -I -v glibc sys-libs/glibc-2.3.2-r7 * perhaps theres a significant difference between 2.3.2-r3 and 2.3.2-r7 ?
I'm having similar troubles. I tried the test script posted below and it failed. What's interesting is the version mismatch. I'm wondering if somehow there are conflicting versions of libc lying around? Which one does GCC pull from? Note - this also causes me problems with libevent - it doesn't recognize my system, also 2.6 test11, as having epoll. Weird. I see a couple different libc instances: nm -D /lib/libc.so.6 | grep epoll 000db608 W epoll_create 000db608 W epoll_ctl 000db608 W epoll_wait strings /usr/lib/libc.a | grep epoll epoll_create __GI_epoll_create epoll_ctl __GI_epoll_ctl epoll_wait __GI_epoll_wait warning: epoll_create is not implemented and will always fail warning: epoll_ctl is not implemented and will always fail warning: epoll_wait is not implemented and will always fail .gnu.warning.epoll_create .gnu.warning.epoll_ctl .gnu.warning.epoll_wait __evoke_link_warning_epoll_create __evoke_link_warning_epoll_ctl __evoke_link_warning_epoll_wait epoll_create __GI_epoll_create epoll_ctl __GI_epoll_ctl epoll_wait __GI_epoll_wait gcc test.c /tmp/cceLzyZi.o(.text+0x18): In function `main': : warning: warning: epoll_create is not implemented and will always fail bok@rm2 libevent-0.7c $ nm a.out | grep epoll U epoll_create@@GLIBC_2.3.2 bok@rm2 libevent-0.7c $ qpkg -I -v glibc sys-libs/glibc-2.3.3_pre20031212 *
I did emerge glibc-2.3.2-r7 ebuild and now seems to compile but: $ gcc test.c -o test /tmp/ccGVjVvZ.o(.text+0x18): In function `main': : warning: warning: epoll_create is not implemented and will always fail $ ./test efd: -1 the test program was: $ cat test.c #include <sys/epoll.h> #include <stdio.h> int main(void) { int efd; efd = epoll_create(100); printf("efd: %d\n", efd); } Also , my libc doesnt have that warning anywhere... $ ldd test linux-gate.so.1 => (0xffffe000) libc.so.6 => /lib/libc.so.6 (0x40023000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) $ strings /lib/libc.so.6 | grep epoll epoll_wait epoll_ctl epoll_create BTW, what is linux-gate.so.1 ?! I dont rememebr seeing this ever before, heh
if you google for linux-gate the first hit has this: The 2.6 kernel has added a new dso interface for P4 x86 vsyscalls called linux-gate.so i dont have any of the epoll warnings you guys do ... it works fine over here ... perhaps it's because i'm using linux-2.6 headers ?
*** Bug 35977 has been marked as a duplicate of this bug. ***
Yep that was it! I linked /usr/include/linux , asm, asm-i386, asm-generic to their proper places in /usr/src/linux (which is verstion 2.6.0-test11) and after (re)merging glibc 2.3.2-r7 it seems I got it working fine: ./test efd: 3 Thanks for the help! :) PS: I wont close the bug as I received infos from another bug report that closing them should be done ideally by gentoo devs
Its prob because they do not use NPTL ... if they did, glibc would anyhow have used /usr/src/linux (please do not symlink /usr/include/{asm,linux}, but rather then use the linux-headers-2.6.0_beta11.ebuild ebuild). Although, yes, epoll is not NPTL specific if I am not mistaken.
epoll is "new" as NPTL is too but I dont think they are in any way related. I have merged linux-headers-2.6.0-beta11 and (re)merged glibc-2.3.2-r7. All seems fine. However if I (re)merge glibc-2.3.2-r3 then when I try to compile the test.c program it gives some error "Incomplete type uint32_t" in sys/epoll.h. Can someone look into this one ? PS: I have tried to solve it myself, I have included sys/types.h before sys/epoll.h in the test program, no luck; I then included linux/types.h as I saw those types defined there but I got conflicts with already defined stuff in sys/types.h. what should I include ?
Interesting is that this last problem is only with the includes. I have a program compiled on glibc 2.3.2-r7 that works ok with 2.3.2-r3 (the program is dinamically linked).
I installed kernel headers 2.6, then reemerged libc 3.3, and all was fine. Would it make sense to somehow create a dependency between the kernel sources and the kernel headers so that this is more obvious to people? Brian
well, if you're using a linux kernel of 2.6.x then you'd want linux-headers of 2.6.x ... you wouldnt want latest glibc to depend on 2.6.x headers because not everyone wants the 2.6.x kernel ... all these 2.6.x features (nptl, epoll, etc...) are completely optional ... if you upgrade your kernel to 2.6.x then it's probably your responsibility to make sure you upgrade linux-headers to 2.6.x and rebuild glibc for 2.6.x ... or perhaps not ? :)
Yes of course. But this doesnt "solve" the fact that the default merged glibc on gentoo does not work even with 2.6 kernel and headers (as I have explained in the previous posts). The only thing left so far seems to me to be the "#include <sys/epoll.h>" problem with glibc-2.3.2-r3.
Ok, I found the solution. #include <stdint.h> before include sys/epoll.h. Now I have default gentoo glibc 2.3.2-r3 working with epoll. Strange that epoll docs say only to inlude sys/epoll.h and that with glibc 2.3.2-r7 this is true. To round things up: gentoo default glibc DOES support epoll Howto: - remerge glibc (2.3.2-r3) having 2.6 linux-headers installed - make sure to include <stdint.h> before <sys/epoll.h> in your programs even that the docs dont ask for it
roger