Menu

#57 Fails to build with gcc 4.5

open
nobody
None
5
2013-10-15
2010-12-03
Martin Pitt
No

gcc 4.5 has a stricter linking behaviour where all required libraries need to be specified explicitly. Please see http://wiki.debian.org/ToolChain/DSOLinking for details.

This causes w3m to fail to build with gcc 4.5:

gcc -I. -I. -g -O2 -I./libwc -I/usr/include/gc -I/usr/include/gc -DHAVE_CONFIG_H -DAUXBIN_DIR=\"/usr/lib/w3m\" -DCGIBIN_DIR=\"/usr/lib/w3m/cgi-bin\" -DHELP_DIR=\"/usr/share/w3m\" -DETC_DIR=\"/etc\" -DCONF_DIR=\"/etc/w3m\" -DRC_DIR=\"~/.w3m\" -DLOCALEDIR=\"/usr/share/locale\" -o w3mimgdisplay w3mimgdisplay.o w3mimg/w3mimg.a -Wl,-Bsymbolic-functions -lm -lbsd -lnsl -ldl -pthread -lgdk_pixbuf_xlib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpng12 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lm -lcairo -lpng12 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
/usr/bin/ld.bfd.real: w3mimg/w3mimg.a(x11_w3mimg.o): undefined reference to symbol 'XGetWindowAttributes'
/usr/bin/ld.bfd.real: note: 'XGetWindowAttributes' is defined in DSO /usr/lib64/libX11.so.6 so try adding it to the linker command line
/usr/lib64/libX11.so.6: could not read symbols: Invalid operation

I'll attach a patch in a second.

Discussion

  • Martin Pitt

    Martin Pitt - 2010-12-03

    fix linking with gcc 4.5

     

Log in to post a comment.