- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: static and shared library options for aCC
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
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
тАО11-10-2009 04:54 PM
тАО11-10-2009 04:54 PM
I have
module1 should be built as static library.
module2 should be a shared library and it should like module1 statically.
module3 is an executable which dynamically links to module2 library.
I am looking for aCC command options to achieve this goal.
It should work on 64 and 32 bit OS.
Thanks,
Ram
Solved! Go to Solution.
- Tags:
- shlib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 03:20 AM
тАО11-11-2009 03:20 AM
Re: static and shared library options for aCC
(The correct HP-UX terminology is archive lib.)
What OS and architecture are you using?
>I am looking for aCC command options to achieve this goal.
aCC -c foo1.c foo2.c
ar -rv libmod1.a foo1.o foo2.o
aCC -c +z foo3.c foo4.c
aCC -b o libmod2.so foo3.o foo4.o -L . -lmod1
aCC -c foo5.c foo6.c
aCC -o module3 foo5.o foo6.o -L . -lmod2
For Integrity see:
http://docs.hp.com/en/14487/libs.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 10:41 AM
тАО11-11-2009 10:41 AM
Re: static and shared library options for aCC
I have this box.
-bash-3.2$ uname -a
HP-UX ramregar-hp11i B.11.23 U ia64 1869050062 unlimited-user license
-bash-3.2$
I want to build 32-bit and 64-bit builds on the same box.
Thanks,
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-12-2009 04:38 AM
тАО11-12-2009 04:38 AM
Re: static and shared library options for aCC
The default is 32 bit or you can use +DD32.
And +DD64 for 64 bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2009 08:32 AM
тАО11-14-2009 08:32 AM
Re: static and shared library options for aCC
Thank you so much for your support so far. Please do continue until I finish this.
Module1 a static library.
aCC -O -g0 -O2 +Oopenmp +z +DD64 -b -Wl,-ashared -D_HPUX -D__LP64__ -DPIC -I/build/jdk/include -lunalign -o/build/rel/lib/static/libmodule1.a *.cpp *.c
Module2 a dynamic library which statically links the Module1
aCC -O -g0 -O2 +Oopenmp +z +DD64 -b -n -v -D_HPUX -D__LP64__ -I/build/jdk/include -Wl,-L/build/rel/lib/static/ -lmodule1 -o/build/rel/lib/libmodule.so *.cpp *.c
Module3 a dynamic library which statically links the module1
aCC -O -g -O2 +Oopenmp +z +DD64 -b -v -ashared -D_HPUX -D__LP64__ -L/build/rel/lib/static/ -lmodule1 -o/build/rel/lib/libmodule3.so *.cpp
Module4 an executable which dynamically links module2. Module2 loads Module3 at runtime.
aCC +DD64 +Oopenmp -I/build/clients/include -L/build/rel/lib/ -lmodule2 -lrt -lunalign -o/build/bin/module4 *.cpp
aCC version:
aCC: HP C/aC++ B3910B A.06.23 [May 18, 2009]
Problem:
When I run module4
/usr/lib/hpux64/dld.so: Unsatisfied data symbol '_ZTV14MyListener' in load module '../lib/libmodule2.so'.
Killed
I looked in library with nm command. Here is the output.
build@hp16 /build/rel/lib $ nm -D libmodule2.so | grep MyListener
[4825] | 4611686018430846112| 288|FUNC |GLOB |0| .text|_Z17createNewListenerP14MyListenerPP9_listenerPFvP12_space_eventPvES6_
[4748] | 4611686018431064384| 416|FUNC |GLOB |0| .text|_ZN6CSpace5startEP14MyListenerP11CBrowserDef
[2880] | 0| 0|OBJT |GLOB |0| UNDEF|_ZTV14MyListener
[1065] | 4611686018431074480| 112|FUNC |LOCAL|0| .text|__sinit_MyListener_cpp_
[1064] | 0| 0|FILE |LOCAL|0| ABS|MyListener.cpp
build@hp16 /build/rel/lib $
I would appreciate your help. Please do review compiler options and suggest me the changes.
Regards,
Ram Regar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2009 11:34 PM
тАО11-14-2009 11:34 PM
SolutionAgain, please use the correct terminology. There are only archive and shared libs.
In this case, this is a shared lib since you used -b and not ar(1).
>aCC -O -g0 -O2 +Oopenmp +z +DD64 -b -Wl,-ashared -D__LP64__ -lunalign -o /build/rel/lib/static/libmodule1.a *.cpp *.c
There is no need for both -O and +O2. There is no need to define -D__LP64__ or -Wl,-ashared, they are set by the driver or the default. Also, why bother with +Oopenmp?
Also, you should NOT use -b with libmodule1.a. Rename it to libmodule1.so.
>module2 a dynamic library which statically links the module1
>aCC -O -g0 -O2 +Oopenmp +z +DD64 -b -n -v -Wl,-L/build/rel/lib/static/ -lmodule1 -o /build/rel/lib/libmodule.so *.cpp *.c
The output should be libmodule2.so
Remove useless -n. Also remove "-Wl," before -L.
>module4 an executable which dynamically links module2. module2 loads module3 at runtime.
>aCC +DD64 +Oopenmp -lmodule2 -lrt -lunalign -o/build/bin/module4 *.cpp
And also has module1 as a dependent shlib.
dld.so: Unsatisfied data symbol _ZTV14MyListener load module ../lib/libmodule2.so
>I looked in library with nm command.
Where should it be defined? Where have you defined the class MyListener and the first non-inline virtual function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-23-2009 04:04 PM
тАО11-23-2009 04:04 PM
Re: static and shared library options for aCC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-23-2009 04:05 PM
тАО11-23-2009 04:05 PM