Operating System - HP-UX
1833752 Members
2802 Online
110063 Solutions
New Discussion

Bad magic number for shared library: libclntsh.sl.10.1

 
Biradar
Advisor

Bad magic number for shared library: libclntsh.sl.10.1

Hi Experts,

I have oracle 10g installed on HP Integrity rx 2620 server. OS is HP-UX 11i v2 FOE September 2006 (version B.11.23).

I have an application compiled on PA-RISC OS B.11.11 using aCC: HP ANSI C++ B3910B A.03.70 compiler.

Compiler options: +DA1.0 -AA -mt

My application makes use of oracle shared library: libclntsh.sl.10.1. It runs correctly on both PA-RISC v1 and v2. But on Itanium server i am getting Bad magic number for shared library: libclntsh.sl.10.1 error.

Also note that i have Aries installed on the Itanium server.

--
Thanks
Biradar
14 REPLIES 14
Dennis Handly
Acclaimed Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

>Compiler options: +DA1.0 -AA -mt

It is illegal to use +DA1.0, the last OS that supported those machines was 10.10.

>I am getting Bad magic number for shared library libclntsh.sl.10.1 error.

Are you sure that SHLIB_PATH only contains PA32 shlibs? What does file(1) show for each?
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Dennis,

Thanks.

1. What compiler option i should using?

I want a single code base to run on both PA-RISC(v1 & v2)and Itanium.

2. SHLIB PATH is pointing to correct libs i guess.

$ echo $SHLIB_PATH
/opt/osmf/lib:/opt/oracle/app/oracle/product/10.2.0/lib

# pwd
/opt/oracle/app/oracle/product/10.2.0/lib32
# file libclntsh.so.10.1
libclntsh.so.10.1: ELF-32 shared object file - IA64
Dennis Handly
Acclaimed Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

>1. What compiler option I should using?
>I want a single code base to run on both PA-RISC(v1 & v2) and Integrity.

You can use +DSportable.

>2. SHLIB_PATH is pointing to correct libs I guess.
libclntsh.so.10.1: ELF-32 shared object file - IA64

These are the correct shlibs for an Integrity application. You need to find the PA shlibs, possibly copy them from your PA box, to a different location?
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Dennis,

Thanks once again.
> You can use +DSportable.
I have already tried with +DSportable option but without any success. I am still getting the same error.

> These are the correct shlibs for an Integrity application. You need to find the PA shlibs, possibly copy them from your PA box, to a different location?

You are right. My application needs to run on Integrity server itself. So i have Oracle 10g for Itanium installed on the box. The same application runs correctly on PA-RISC where Oracle 10g for PA-RISC is installed.

As i mentioned earlier i have Aries installed on the Itanium box. My application runs as a daemon. This is the error i am getting in nohup.out

/usr/lib/dld.sl: Bad magic number for shared library: /opt/osmf/lib/libclntsh.sl
.10.1
/usr/lib/dld.sl: Exec format error
[HP ARIES32]: Core file for 32 bit PA-RISC application
[HP ARIES32]: /opt/osmf/bin/osmfsemd saved to /var/opt/osmf/share/log/core.osm
fsemd.
Dennis Handly
Acclaimed Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

>I am still getting the same error.

Naturally but faster. :-)

>I have Aries installed on the Integrity box.

No, you didn't do it. Aries comes with HP-UX on all Integrity servers.

>dld.sl: Bad magic number for shared library: /opt/osmf/lib/libclntsh.sl.10.1

You need to put a PA lib in that location. Or you need to use SHLIB_PATH to move your PA shlibs elsewhere.
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Dennis,

Thanks for the reply.

libclntsh.sl.10.1 is an Oracle library.
I have created a soft link to this library.

libclntsh.sl.10.1 -> /
opt/oracle/app/oracle/product/10.2.0/lib32/libclntsh.so.10.1

I have oracle 10g Itanium version installed on the box. Oracle 10g Itanium version unfortunately has no PA-RISC library. It has only IA libraries installed (both 32 / 64 bit)

$ file /opt/oracle/app/oracle/product/10.2.0/lib32/libclntsh.so.10.1
/opt/oracle/app/oracle/product/10.2.0/lib32/libclntsh.so.10.1: ELF-32 shared ob
ject file - IA64

$ file /opt/oracle/app/oracle/product/10.2.0/lib/libclntsh.so.10.1
/opt/oracle/app/oracle/product/10.2.0/lib/libclntsh.so.10.1: ELF-64 shared ob
ject file - IA64

Please let me know what should I be doing?

My program is complied on PA-RISC as i needs to be run on both PA-RISC / IA.

I can recompile my program on IA and make it run but i do not want to have 2 different binaries.

Also installing Oracle 10g PA-RISC on IA is another solution i can think of but i can do that as well.

So i have compatible oracle for each of the architectures but only one binary of mine.

How can i mke it run on both????

Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Few updates...

My program is compiled on PA-RISC and makes use of oracle library libclntsh.sl.10.1.

I have relative Oracle version installed on each of the boxes. viz. PA-RISC / IA


It runs correctly on both the versions of PA-RISC 1.1 and 2.0.

Now i want my same program compiled on PA-RISC to run correctly on IA box.

Unfortunately when i try to run it i get the following error.

/usr/lib/dld.sl: Bad magic number for shared library: /opt/osmf/lib/libclntsh.sl
.10.1
/usr/lib/dld.sl: Exec format error
[HP ARIES32]: Core file for 32 bit PA-RISC application
[HP ARIES32]: /opt/osmf/bin/osmfalert saved to /var/opt/osmf/share/log/core.os
mfalert.
Dennis Handly
Acclaimed Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

>I have created a soft link to this library.
libclntsh.sl.10.1 -> /
opt/oracle/app/oracle/product/10.2.0/lib32/libclntsh.so.10.1

From /opt/osmf/lib?
You need to point to a PA shlib.

>Oracle 10g Itanium version unfortunately has no PA-RISC library. It has only IA libraries installed (both 32/64 bit)

Then your application isn't supported on Integrity.

>Please let me know what should I be doing?
>My program is complied on PA-RISC as I need to be run on both PA-RISC / IA.

You may need to have two versions. What you are doing is probably not supported by Oracle.

>I can recompile my program on IA and make it run but i do not want to have 2 different binaries.

You may not have a choice.

>Also installing Oracle 10g PA-RISC on IA is another solution i can think of but i can do that as well.

You can't do that.

>How can I make it run on both?

You must copy ALL of the load modules your application uses, including the PA oracle shlibs to your IPF box.
Dennis Handly
Acclaimed Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

>ME: You must copy ALL of the load modules

You can use ldd(1) on your application on your PA box to get a list of all shlibs you use.
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Dennis,

Thanks for your timely help.

I think i will have to convince my boss to have 2 versions now.

Thanks a lot and if i need any thing else i shall get back to you :)

For now i will keep this thread still open ...
Srimalik
Valued Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

http://www.hp.com/go/aries may help.

Thanks
Sri
abandon all hope, ye who enter here..
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Sri,

MITR: MIxed mode TRanslator is the one i am looking for.

If you think otherwise please let me know.

But unfortunately MITR will be available only during Q1 of 2009.

So still some time to go....

Thanks.

--
Regards,
Biradar
Srimalik
Valued Contributor

Re: Bad magic number for shared library: libclntsh.sl.10.1

My knowlege abt mitr is also limited but it seem MITR should resolve your issue.

But, as it is not available yet you may try the beta. The page also says that "Currently there are no plans for general release of MITR."

The best option for you is the one suggested by Dennis. copy the required PA libraries to a directory on you IA machine and include the path in SHLIB_PATH.


Thanks
Sri
abandon all hope, ye who enter here..
Biradar
Advisor

Re: Bad magic number for shared library: libclntsh.sl.10.1

Hi Sri,

Thanks once again.

I have also tried that it works fine.
But as both of you suggested, we are also planning for a separate release for each of the architectures.

Bye
Biradar