tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ld finding the wrong library



I've just tracked down why I've been failing to build xinit.

The link command used is:

/bsd/current/obj_amd64/tools/tools.NetBSD-amd64/bin/x86_64--netbsd-gcc   
--sysroot=/bsd/current/dest_amd64 -Wl,-rpath,/usr/X11R7/lib -L=/usr/X11R7/lib
    -o xinput  buttonmap.o feedback.o list.o property.o setint.o setmode.o
setptr.o state.o test.o xinput.o -lXi -lm      
-Wl,-rpath-link,/bsd/current/dest_amd64/lib  -L=/lib

and I get an error because XESetWireToEventCookie is undefined.
XESetWireToEventCookie() is referenced in libXi.so and should be
defined by libX11.so

However since there is no -lX11 (or a direct reference to libX11.so)
libX11.so is looked for because of the NEEDED entry in libXi.so.
However libXi.so has an RPATH entry for /usr/X11R7/lib, and the linker
is looking there first.
On my system the installed libX11.so is dated from late 2009 and doesn't
have XESetWireToEventCookie - so the link fails.

Maybe the --sysroot should affect this - but it doesn't.

I've also noticed that ld is adding a NEEDED entry for libX11.so into
the xinput program - surely this is wrong.

I've changed the Makefile for xinput to explicitly specify -lX11
to make the build not reference installed libraries.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index