- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problem linking with a shared library that uses st...
Operating System - HP-UX
1756287
Members
2540
Online
108844
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
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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
05-05-2011 12:34 AM
05-05-2011 12:34 AM
Problem linking with a shared library that uses static library
I'm trying to compile an application with the following configuration
1. static library lib1.a that contains a function fun1().
2. static library lib2.a that contains a function fun2() that uses fun1() from lib1.a
3. shared library libshared.so that contains a function funshared() that uses fun2() from lib2.a
4. executable that uses libshared.so
5. I compile the static and shared libraries sources as well as the executable sources with these flags: aCC -c +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt
6. I create the static with these flags: ar cr
7. I create the shared library with these flags: aCC -b libshared.so -llib1.a -llib2.a
8. I create the executable with these flags: aCC +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt libshared.so
The problem is that i get this error ld: (Warning) Unsatisfied symbol "func1()" while creating the executable. The problem is solved when i include both lib1.a and lib2.a in the linking of the executable like this: aCC +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt libshared.so -llib1.a -llib2.a
but i think i don't have to include the static libraries in the linking as i already did when building the shared library. Is there any other way i can resolve this warning.
1. static library lib1.a that contains a function fun1().
2. static library lib2.a that contains a function fun2() that uses fun1() from lib1.a
3. shared library libshared.so that contains a function funshared() that uses fun2() from lib2.a
4. executable that uses libshared.so
5. I compile the static and shared libraries sources as well as the executable sources with these flags: aCC -c +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt
6. I create the static with these flags: ar cr
7. I create the shared library with these flags: aCC -b libshared.so -llib1.a -llib2.a
8. I create the executable with these flags: aCC +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt libshared.so
The problem is that i get this error ld: (Warning) Unsatisfied symbol "func1()" while creating the executable. The problem is solved when i include both lib1.a and lib2.a in the linking of the executable like this: aCC +O3 -w -AA +DD64 -DHP_UX -D_USE_BIG_FDS -mt libshared.so -llib1.a -llib2.a
but i think i don't have to include the static libraries in the linking as i already did when building the shared library. Is there any other way i can resolve this warning.
- Tags:
- shlib
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2011 01:26 AM
05-06-2011 01:26 AM
Re: Problem linking with a shared library that uses static library
>1. static library lib1.a that contains a function fun1().
(A terminology note: These are archive libs, not static.)
>3. shared library libshared.so that contains a function funshared() that uses fun2() from lib2.a
>7. I create the shared library with these flags: aCC -b libshared.so -llib1.a -llib2.a
Are fun2 and fun1 in libshared.so?
>aCC -c +O3 -w -AA +DD64
I would suggest you leave off +O3 until you get things working. Also never use -w, instead add +W#### to suppress individual warnings.
>I think I don't have to include the static libraries in the linking as I already did when building the shared library.
Check to see if you have those functions in your shlib:
elfdump -n .dynsym -s libshared.so |
grep -e fun1 -e fun2
Make sure these symbols are mangled to match the symbol in your warning. And are being exported.
If not in your shlib, you need to force them there.
(A terminology note: These are archive libs, not static.)
>3. shared library libshared.so that contains a function funshared() that uses fun2() from lib2.a
>7. I create the shared library with these flags: aCC -b libshared.so -llib1.a -llib2.a
Are fun2 and fun1 in libshared.so?
>aCC -c +O3 -w -AA +DD64
I would suggest you leave off +O3 until you get things working. Also never use -w, instead add +W#### to suppress individual warnings.
>I think I don't have to include the static libraries in the linking as I already did when building the shared library.
Check to see if you have those functions in your shlib:
elfdump -n .dynsym -s libshared.so |
grep -e fun1 -e fun2
Make sure these symbols are mangled to match the symbol in your warning. And are being exported.
If not in your shlib, you need to force them there.
- Tags:
- suppress warnings
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP