Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- From: "T.M. Sommers" <tms@xxxxxx>
- Date: Mon, 04 Apr 2005 06:17:45 GMT
Frank Kotler wrote:
>
> Apparently, we need to tell ld the "Interpreter" ("-I") or
> "--dynamic-linker" to use - "-I" is shorter :)
>
> ld -s -o example2 example2.o -I /lib/ld-linux.so.2 -lX11
> -L/usr/X11R6/lib
>
> Works cherry for me!That is odd. GNU ld on FreeBSD knows all about the dynamic linker without being told. I am very surprised that GNU ld on Linux is not that smart. Are you sure that is the real problem? Try linking the program without specifying the dynamic linker, and use objdump or whatever to look at the .interp section. If that is correct, then specifying the dynamic linker is just masking the real problem.
You might want to try seeing if the problem occurs when you use libc only, not the X libraries.
It is also possible that there is some problem with the installation of ld. Dynamic linking requires some configuration; hints files, default library paths, and the like. It is conceivable that something along those lines is wrong that has not been discovered because so few people call ld directly.
I would also urge you to use the C startup and cleanup code if
you are linking to C libraries. That code exists for a reason; some library functions depend on it.
-- Thomas M. Sommers -- tms@xxxxxx -- AB2SB
.
- Follow-Ups:
- Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- From: Frank Kotler
- Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- Prev by Date: Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- Next by Date: Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- Previous by thread: Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- Next by thread: Re: Linux, X, ld, gcc, linking, shared libraries and stuff
- Index(es):
Relevant Pages
|