Operating System - HP-UX
1751712 Members
5373 Online
108781 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.