Closed GoogleCodeExporter closed 9 years ago
The scenario described in the blog post does not apply to wmii.
wmii doesn't compile and link any binaries in a single step.
Object files are always compiled separately and then linked. In
the linking step, the libraries are always included after the
objects in question (which has always been necessary in any
compiler I've ever come across). If there are issues with GCC
4.6, they're not the ones described in the linked post.
Original comment by maglion...@gmail.com
on 20 Oct 2011 at 8:13
Sorry for the poor wording of the ticket. My point was that when wmii tries to
link under gcc 4.6 it fails because of the change in ordering. ie:
MAKE all cmd/x11/
CC cmd/x11/wikeyname.o
LD cmd/x11/wikeyname.out
cc -o wikeyname.out wikeyname.o -lXinerama -lXrender -lX11 -lXrandr
-Wl,-Bsymbolic-functions -g -ldl -g -ldl -g -ldl -L../../lib -L/usr/lib
../../lib/libstuff.a ../../lib/libregexp9.a ../../lib/libbio.a
../../lib/libfmt.a ../../lib/libutf.a /usr/lib/libixp.a
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:55: undefined reference to
`XRRQueryExtension'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:57: undefined reference to
`XRRQueryVersion'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:60: undefined reference to
`XRRSelectInput'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:72: undefined reference to
`XRRUpdateConfiguration'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:93: undefined reference to
`XRenderQueryExtension'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:121: undefined reference to
`XRenderFindVisualFormat'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:131: undefined reference to
`XineramaQueryExtension'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:136: undefined reference to
`XineramaIsActive'
/home/kraay/wmii-hg-new/wmii/lib/libstuff/xext.c:151: undefined reference to
`XineramaQueryScreens'
collect2: ld returned 1 exit status
make[5]: *** [wikeyname.out] Error 1
make[4]: *** [dall] Error 2
make[3]: *** [dall] Error 2
make[2]: *** [override_dh_auto_build] Error 2
make[1]: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
make: *** [deb] Error 2
Now, if we jiggle around the external libraries -lXinerama -lXrender -lXrandr
and place them before libstuff.a. It will link.
I don't know if this change in behaviour is due to a bug in gcc 4.6 or an extra
feature - I'll leave that decision up to you. Regardless, if you're not
interested in fixing it, I wanted to create an ticket here so anyone using
ubuntu 11.10 will be able to find it and make the necessary changes.
Original comment by d8ot0...@gmail.com
on 20 Oct 2011 at 8:41
This issue was closed by revision 7acfb1d933b3.
Original comment by maglion...@gmail.com
on 20 Oct 2011 at 8:56
Not quite -ldl also needs to be appended (sorry, I forgot to report that -- I'd
forgotten):
So: -lXinerama -lXrender -lX11 -lXrandr -ldl will work
cc -o wmii9menu.out wmii9menu.o -Wl,-Bsymbolic-functions -g -ldl -g -ldl -g
-ldl -L../../lib -L/usr/lib ../../lib/libstuff.a ../../lib/libregexp9.a
../../lib/libbio.a ../../lib/libfmt.a ../../lib/libutf.a /usr/lib/libixp.a
-lXinerama -lXrender -lX11 -lXrandr
/usr/bin/ld: ../../lib/libstuff.a(xft.o): undefined reference to symbol
'dlopen@@GLIBC_2.1'
/usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libdl.so so try
adding it to the linker command line
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libdl.so: could not
read symbols: Invalid operation
collect2: ld returned 1 exit status
make[5]: *** [wmii9menu.out] Error 1
make[4]: *** [dall] Error 2
make[3]: *** [dall] Error 2
make[2]: *** [override_dh_auto_build] Error 2
make[1]: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
make: *** [deb] Error 2
Original comment by d8ot0...@gmail.com
on 20 Oct 2011 at 9:42
I had same issues and fixed all of them in util/link with an extra $LDFLAGS :
[ -n "$PACKAGES" ] && LDFLAGS="$LDFLAGS $(pkg-config --libs $PACKAGES) $LDFLAGS"
happy compiling :)
Original comment by xpix...@gmail.com
on 26 Dec 2011 at 1:10
Original issue reported on code.google.com by
d8ot0...@gmail.com
on 20 Oct 2011 at 8:06