- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: static linking of libraries using gcc on hpux ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО09-17-2003 10:58 AM
тАО09-17-2003 10:58 AM
cc .... -Wl,-shared,-aarchive -L${SRCROOT}/obj -lexample ...
but I encounter an error as follows:
/usr/ccs/bin/ld: Unsatisfied symbols:
main (first referenced in /usr/lib/libc.a(start_what.o)) (code)
Can somebody tell me what could be the problem and the solution? thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 11:22 AM
тАО09-17-2003 11:22 AM
SolutionBuilding static libraries with ld option -shared (only valid for GNU ld), is a bit silly.
FWIW, shared libraries need shared objects. gcc -fPIC, or cc +Z
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 11:57 AM
тАО09-17-2003 11:57 AM
Re: static linking of libraries using gcc on hpux 11
thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 03:49 PM
тАО09-17-2003 03:49 PM
Re: static linking of libraries using gcc on hpux 11
The error message suggests that there
is no main program.
Secondly, are you sure "-Wl,-shared,-aarchive"
is what you typed? That would pass the
options "-shared -aarchive" to ld. My
version of ld doesn't recognize the "-shared"
flag. It would see this is "-s -h ared".
Perhaps you should try "cc ...
-Wl,-aarchive -L${SRCROOT}/obj
-lexample ...". This forces ld to use
static linking. If the desired library
is not available in archive form ld will
complain that it can't find the library.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 04:13 PM
тАО09-17-2003 04:13 PM
Re: static linking of libraries using gcc on hpux 11
Normally you just let ld determine which
form of a library to use. If you tell it
to link with "-lfoo", ld first tries to find
a shared lib called "libfoo.sl", and if
that can't be found it tries to find
an archive lib called "libfoo.a".
If for some reason you want to force ld to
use one form or the other, you can do that
on a lib by lib basis using:
cc myprog.c -Wl,-aarchive -lfoo -Wl,-ashared -lbar
This forces ld to use libfoo.a and libbar.sl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 04:25 PM
тАО09-17-2003 04:25 PM
Re: static linking of libraries using gcc on hpux 11
(aka Itanium aka IA64) archive libraries
are deprecated or at least discouraged.
For example, libc is not available in
archive form.
I don't know if this is just while HP-UX
is in transition to IPF or if it is a
permanent direction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 10:04 PM
тАО09-17-2003 10:04 PM
Re: static linking of libraries using gcc on hpux 11
"-shared" is not a linker option/flag. the parameter to '-a' can be 'archive' / 'shared' / 'archive_shared' / 'shared_archive' / 'default' (and *has* to appear *after* '-a').
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2003 10:08 PM
тАО09-17-2003 10:08 PM
Re: static linking of libraries using gcc on hpux 11
Enjoy, have FUN! H.Merijn