Index: [thread] [date] [subject] [author]
  From: Visnu Pitiyanuvath <visnu.p@duke.edu>
  To  : 
  Date: Thu, 4 Mar 1999 21:25:04 -0500

Re: lucky library linking

another note is that the -R is needed mainly because the os couldn't find
the library that was linked in at runtime.  you'll notice that it probably
compiles with only the -L flag, no?  but when you get around to running the
executable, it says something along the lines of "coudn't find library ...
.so".  with the -R option, solaris can follow the static string in the
object code to the library.  another (and arguably better) solution to this
is adding the path for the library into your LD_LIBRARY_PATH environment
variable.  this way, if the library is moved, you won't have to recompile
the program...

Garrett Mitchener wrote in message ...
>Matthew Todd <mt@perelandra.dorm.duke.edu> writes:
>
>
>> suppose your directory with library files is stored in some
>> variable called MY_LIBS.  be sure that LD_FLAGS includes both
>> -L$(MY_LIBS) *and* -R$(MY_LIBS), as follows:
>>
>> LD_FLAGS = -L. -L$(MY_LIBS) -R$(LIB_DIR) -R$(MY_LIBS)
>>
>>
>
>-R is a Solaris linker option that specifies a path string to stick in
>the executable.  The operating system uses it to find libraries when
>you run it.  The above should be fine.  If you have trouble, try
>making a path string something like this:
>
>RPATH = $(LIB_DIR):$(MY_LIBS)
>
>LD_FLAGS = ... -R$(RPATH)
>
> -- Garrett :-)
>




Index: [thread] [date] [subject] [author]