DragonFly BSD
DragonFly bugs List (threaded) for 2004-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: How to debug linker errors?

From: walt <wa1ter@xxxxxxxxxxxxx>
Date: Thu, 5 Aug 2004 18:04:44 -0700

On Thu, 5 Aug 2004, Jeroen Ruigrok/asmodai wrote:

-On [20040805 00:42], walt (wa1ter@xxxxxxxxxxxxx) wrote:

So what makes the linker choke when trying to link the
object files?  Just where does the linker go to look
for 'missing' symbols?

Give me a compilation example. It all depends on context.

Okay, thanks :o) While I was trying to compose a reasonable example and explain the problem I suddenly figured out that this case is not a linker error at all:

making all in lib/font/FreeType/module...
rm -f libfreetype.so
LD_LIBRARY_PATH=/opt/dfports/x11-servers/xorg-server/work/xc/exports/lib XLOCALEDIR=/opt/dfports/x11-servers/xorg-server/work/xc/exports/lib/locale cc -o libfreetype.so -Bshareable -R /usr/X11R6/lib xttcap.o ftfuncs.o ftenc.o fttools.o ftmodule.o -L/usr/local/lib -lfreetype

Note the -Bshareable flag to cc.  My link-time error is caused by the
lack of a '-Wl,' in front of the linker flag, not really by missing
symbols at all.

Now, I can't quite figure out yet why the flags are wrong, but I've
been looking for differences in makefiles between DFly and FBSD and
this looks like a possible winner:

# diff /mnt/usr/ports/x11-servers/xorg-server/work/xc/xmakefile /usr/dfports/x11-servers/xorg-server/work/xc/xmakefile

< # operating system:  FreeBSD 5.2-CURRENT i386 [ELF] (5.2.2) (502127)
# operating system: DragonFly 1.1-CURRENT i386 [a.out] (4.8.2) (480101)



I think the difference in the flags in 'xmakefile' probably accounts for this particular error, but I'm not sure how to fix it, or the OS name either. I've included bsd.dfport.mk which should have fixed the 'wrong' OS name, but didn't in this case.

Following the macro substitutions through several levels of makefiles
is really difficult at my stage of, um, gestation ;o)  Can you share
any tricks of the trade for figuring out just what value a macro will
take at a given stage of compilation?  (e.g.. finding the ultimate cause
of these incorrect flags.)


John R. Levine's Linkers and Loaders is *the* authoratative guide.  I think
he still has it online at linker.iecc.com or in the vicinity of that.

Perfect -- just what I needed, thanks.

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