How to debug linker errors?

Jeroen Ruigrok/asmodai asmodai at wxs.nl
Wed Aug 4 23:01:34 PDT 2004


-On [20040805 00:42], walt (wa1ter at xxxxxxxxxxxxx) wrote:
>I can easily see which header files define the 'missing'
>symbols, and those headers were properly included in the
>source files -- which is why there were no compile-time
>errors, obviously.

But are these prototype definitions or the actual function definitions?
Because most of the time a header just defines the prototype and the
subsequent library needs to get linked in (or appropriate object file) in
order to make sure the linker can find the pure function code.

>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.

>I get the impression from reading the ld manpage that
>libraries may be treated differently from executable
>files when trying to find symbols -- is this correct?

Libraries are just object files which some twists to makes them shared (when
we're talking about .so here), like relocation sections and so on.

>Any suggestins for further reading on this topic for
>someone who will never be a kernel hacker or compiler
>writer?  ;o)

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.

-- 
Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
Free Tibet! http://www.savetibet.org/ | http://www.tibet.nu/
http://www.tendra.org/   | http://www.in-nomine.org/
To regard the fundamental as the essence, to regard things as coarse, to
regard accumulation as deficiency, and to dwell quietly alone with the
spiritual and the intelligent -- herein lie the techniques of Tao of
the ancients.





More information about the Bugs mailing list