[CALUG] gcc question
jce at zot.com
Sun Feb 5 14:11:57 CST 2006
On Fri, 2006-02-03 at 17:43, James Ewing Cottrell 3rd wrote:
> What you want is an environment variable called something like
> LD_LIBRARY_PATH. RTFM for gcc, ld, and probably ld.so.
> You might try using -v on gcc to see exactly which commands are being
> run. You might also need the startup routines, with names like crt0.o.
i've seen problems with setting LD_LIBRARY_PATH globally
or within the user's default environment, so a wrapper script
for your code as dave dodge suggests is usually a good idea
if compile time -R or LD_RUN_PATH aren't options. this page
breaks it down nicely:
> Jason C. Miller wrote:
> > Here's a question for all you coders out there. I'm one of those people who
> > is used to building a coding environment and then coding around it. I'm not
> > really all that used to having to build an environment around
> > already-written code. So, here's my question....
> > I have some code that dynamically links to various libraries around the
> > system. BTW, this is a Solaris 8 box and static linking isn't an option.
> > What I want to do is to copy all of those various libraries into the
> > directory where the new executable will reside and link to those.
> > Basically, I just want to be able to package up the directory and send it
> > off to anybody who wants to use it without requiring them to do any funky
> > post install.
> > So, in short....
> > # pwd
> > /code/test
> > # make
> > gcc -I<whatever> -L<whatever> -l<whatever> code.c -o code
> > # ldd code
> > libWhatever.so.2 => ./libWhatever.so.2
> > libUseless.so.1 => ./libUseless.so.1
> > libBlah.so.5 => libBlah.so.5
> > I've been told that I can do this. However, I really don't know the right
> > buzzwords to google for without returning a million irrelevant results. Is
> > this a function of gcc or ld? And also, which argument(s) should I look at?
More information about the lug