HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shared libraries, internal names and search paths
Operating System - HP-UX
1832231
Members
2924
Online
110041
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2009 11:33 AM
06-11-2009 11:33 AM
I am using boost-build to manage a project consisting of several libraries,
many of which depend on libraries that are part of the project. Boost-build
builds link lines that specify dependent libraries using a relative path to
the library, rather than using the typical -L -l
options. This causes a problem because the linker embeds the dependent library
name as the entire path passed on the link line. In an attempted work around,
I told boost build to build each lib with an internal name using the +h
linker option. This seems to work OK when I have a single dependency, but
fails when I have more than one. For example, suppose I have three libs, foo,
bar and baz, bar depends on foo and baz depends on bar, each built in their own
directory. The first two libraries get built like so:
$ cd foo; aCC -c foo.c; aCC -b -Wl,+h,libfoo.so -olibfoo.so foo.o ; cd ..
$ cd bar; aCC -c -I../foo bar.c; aCC -b -Wl,+h,libbar.so -olibbar.so bar.o ../foo/libfoo.so ; cd ..
The problem comes when I build the third:
$ cd baz; aCC -c -I../bar baz.c; aCC -b -olibbaz.so baz.o ../bar/libbar.so
ld: Can't find dependent library "libfoo.so"
Fatal error.
Even if I add libfoo to the link line, I get the same error:
$ aCC -b -olibbaz.so baz.o ../bar/libbar.so ../foo/libfoo.so
ld: Can't find dependent library "libfoo.so"
Fatal error.
However, if I add a search path, it links:
$ aCC -b -olibbaz.so baz.o ../bar/libbar.so -L../foo
Shouldn't the linker use the libraries supplied on the command line to satisfy
dependencies?
Thanks,
Jim Gallagher
many of which depend on libraries that are part of the project. Boost-build
builds link lines that specify dependent libraries using a relative path to
the library, rather than using the typical -L
options. This causes a problem because the linker embeds the dependent library
name as the entire path passed on the link line. In an attempted work around,
I told boost build to build each lib with an internal name using the +h
linker option. This seems to work OK when I have a single dependency, but
fails when I have more than one. For example, suppose I have three libs, foo,
bar and baz, bar depends on foo and baz depends on bar, each built in their own
directory. The first two libraries get built like so:
$ cd foo; aCC -c foo.c; aCC -b -Wl,+h,libfoo.so -olibfoo.so foo.o ; cd ..
$ cd bar; aCC -c -I../foo bar.c; aCC -b -Wl,+h,libbar.so -olibbar.so bar.o ../foo/libfoo.so ; cd ..
The problem comes when I build the third:
$ cd baz; aCC -c -I../bar baz.c; aCC -b -olibbaz.so baz.o ../bar/libbar.so
ld: Can't find dependent library "libfoo.so"
Fatal error.
Even if I add libfoo to the link line, I get the same error:
$ aCC -b -olibbaz.so baz.o ../bar/libbar.so ../foo/libfoo.so
ld: Can't find dependent library "libfoo.so"
Fatal error.
However, if I add a search path, it links:
$ aCC -b -olibbaz.so baz.o ../bar/libbar.so -L../foo
Shouldn't the linker use the libraries supplied on the command line to satisfy
dependencies?
Thanks,
Jim Gallagher
Solved! Go to Solution.
- Tags:
- shlib
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2009 10:58 PM
06-11-2009 10:58 PM
Solution
>build each lib with an internal name using the +h
I wouldn't think that's the purpose of +h but it works.
If you leave off -Wl,+h, it also links. But I suppose you want to solve the issue in your other thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1347136
>Shouldn't the linker use the libraries supplied on the command line to satisfy
dependencies?
Why? These can be completely different files:
libfoo.so from the dependent shlib and ../foo/libfoo.so.
>if I add a search path, it links:
Yes, -L also affects searching for dependent shlibs.
I wouldn't think that's the purpose of +h but it works.
If you leave off -Wl,+h, it also links. But I suppose you want to solve the issue in your other thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1347136
>Shouldn't the linker use the libraries supplied on the command line to satisfy
dependencies?
Why? These can be completely different files:
libfoo.so from the dependent shlib and ../foo/libfoo.so.
>if I add a search path, it links:
Yes, -L also affects searching for dependent shlibs.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP