- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Creating a shared object
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
тАО06-10-2008 11:41 PM
тАО06-10-2008 11:41 PM
I have to create a shared object (so) on HP-UX.
I already have a Makefile that does it for all the other unix platforms (aix, linux, solaris)
1. what should to make it work on HP?
2. can one of you give me a working and small example for a Makefile that creates a shared object?
tx,
shlom
Solved! Go to Solution.
- Tags:
- shlib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2008 11:54 PM
тАО06-10-2008 11:54 PM
Re: Creating a shared object
you can refer to this external link to find examples of compile and linking options
http://www.franz.com/support/documentation/current/doc/foreign-functions.htm#ff-on-hp-1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 12:56 AM
тАО06-11-2008 12:56 AM
Re: Creating a shared object
Here is the Linker Online Help:
http://docs.hp.com/en/11782/LinkerOnliinehelp0709/creatingandusinglibraries.htm
Creating shlibs is pretty simple:
libfoo.so: foo.o
$(CC) -b -o $@ foo.o
foo.o: foo.c
$(CC) -c foo.c
If you are on PA, change to ".sl" and add +z to the compile line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 02:44 AM
тАО06-11-2008 02:44 AM
Re: Creating a shared object
tx again for your answers.
Sorry for the beginner questions - I still new to this platforms...
1. how do I know if I'm working on PA? when I run uname -a I get: "HP-UX hpux B.11.23 U 9000/800 3697136004 unlimited-user license"
2. When I add +Z to the compile command I get: "gcc: +Z: No such file or directory"
3. In your example:
- you put "-b" what this option stands for?
- should I used also "-shared"?
As you see, I'm a little confused here - if you make it simple for me I will be grateful.
my gcc is: (gcc -v)
Using built-in specs.
Target: hppa2.0w-hp-hpux11.23
Configured with: ../gcc/configure
Thread model: posix
gcc version 4.2.2
tx!!!
shlom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 03:05 AM
тАО06-11-2008 03:05 AM
Re: Creating a shared object
This is PA. Otherwise it says ia64 for Integrity.
>2. When I add +Z to the compile command I get: "gcc: +Z: No such file or directory"
>my gcc is:
Ah, you are using a foreign devil compiler.
You need -fpic.
>- you put "-b" what this option stands for?
>- should I used also "-shared"?
-b is the linker and HP's compiler option to create shlibs.
Yes, replace by -shared for gcc.
- Tags:
- foreign devil tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 03:21 AM
тАО06-11-2008 03:21 AM
Re: Creating a shared object
after we both know what I'm working on,pls see the reason I got confused
when I use the following:
"$(CC) -shared -fpic -o $@ $(OBJ) ...", I get this weird msg:
/usr/ccs/bin/ld: CODE_ONE_SYM fixup to non-code subspace in file /home/s/import/so/TestSo/TestSo/debug/HPUX-Risc/test.o - shared library must be position independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
so? how can I prevent this?
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 03:29 AM
тАО06-11-2008 03:29 AM
Re: Creating a shared object
>how can I prevent this?
Was test.o compiled with -fpic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 05:16 AM
тАО06-11-2008 05:16 AM
Re: Creating a shared object
yes - the object did compile with the -fpic!!!
1. I succeeded create the sample so (the small one) - but the big one still doesn't work (even with the -fPIC)
2. another question:
after knowing how to generate a shared object, what is the standard for its extension? should I use ".sl" instead of ".so"
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 07:44 PM
тАО06-11-2008 07:44 PM
SolutionThat's not what the linker says. So either you didn't or gcc is broken.
If you want to attach a copy of test.o, I can look at it.
>1. but the big one still doesn't work
The above linker error? Or something else?
>2. what is the standard for its extension? should I use ".sl" instead of ".so"
On PA you use .sl. On IPF you use .sl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2008 11:18 PM
тАО06-11-2008 11:18 PM
Re: Creating a shared object
1. After I added -fpic to both compilation and linkage the test shared object was created!!!
2. The big program that I mentioned before is my real shared object (not the tester)that I have to create - here is the error I get:
/usr/ccs/bin/ld: Invalid loader fixup in text space needed in output file for symbol "CClassName::~CClassName()" in input file "/home/s/lib_somelib.a(Someobject.o)"
collect2: ld returned 1 exit status
this is the first time I get such error - any idea? is it something to do with the extenal lib that is linked with the shared object? any idea?
3. when I run file on the tester shared object I get the following result:
"libtest.so:PA-RISC2.0 shared library -not stripped" - I think it's ok - what do say?
4. according to what you said before, I will have to change the extesion to "sl" - don't I?
tx a lot!
shlom