Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in porting

Status
Not open for further replies.

abp

Programmer
Sep 14, 2000
134
FR
I am trying to port an application from NT to HP-UX10. Now I am using aCC
as the compiler and linker (path - /opt/aCC/bin/aCC). This program has 2 parts. An executable and shared library which is loaded at run-time. The shared library is also needed to satisfy some symbols during linking. In the run-time, the shared library is put in a directory which is included in the SHLIB_PATH. My problem is that, during linking, the linker is adding the absoulte path of the shared library to the executable. So when I run the executable elsewhere, it can't find the shared library cuz that path
of course is unique to the development set-up. So the program fails and core dumps.
What i need is some linker options to tell the linker not to add the abs path of the
SL to the executable. Guys, i am new to the forum and I will be very happy if i fix this in a day or two. thanks- Anand Pillai [sig][/sig]
 
Hi,

Is there an option to "statically link" rather than "dynamically link" your executables?

That would create larger executable files, but they *would* work... [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br> [/sig]
 
I can't remember if this is available under HP-UX, but can you set LD_LIBRARY_PATH so that it includes the directory containing your shared library? The syntax is the same as PATH, so if it's already set just add your new path after a &quot;:&quot;.

On other Unix versions, LD_LIBRARY_PATH sets the locations to search for shared libraries. It might be worth trying. [sig]<p> Andy Bold<br><a href=mailto: > </a><br><a href= > </a><br>"I've probably made most of the mistakes already, so hopefully you won't have to..." Me, most days.[/sig]
 
I found the solution after a bit of R&D. In the makefile, you have to give this
option to the linker.

LD_FLAGS = -Wl, +s

This will invoke the subprocess 'l' (the linker) with argument +s which means,
&quot;look for the shared library in the LD_LIBRARY_PATH, instead of taking the absolute
path.&quot; ( man ld(1))

Thanks for the help...

Anand [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top