Unix Technical Forum

Problem with 32 bits executable on HP11 and SHLIB_PATH

This is a discussion on Problem with 32 bits executable on HP11 and SHLIB_PATH within the HP-UX Operating System forums, part of the Unix Operating Systems category; --> Hello, I have a small example consisting of two files, in attachement. With the first file, I make a ...


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-16-2008, 06:34 PM
Andrey Babayan
 
Posts: n/a
Default Problem with 32 bits executable on HP11 and SHLIB_PATH

Hello,

I have a small example consisting of two files, in attachement.

With the first file, I make a shared library, while with the second one
(that contains
the main) I compile an executable that links with the shared library.

I use the following commands:

aCC +z -c mylib.C
aCC -b -o libmylib.sl
aCC main.C -L ./ -lmylib

This create a linmylib.sl file and a a.out executable which I can run
without problem.
However, when I move the shared library to another place, I cannot run
a.out anymore. Exemple:

mkdir tmp
mv libmylib.sl tmp
setenv SHLIB_PATH /raid/michel/tmp/_create_shared_library/tmp
a.out

I get the following error message:

/usr/lib/dld.sl: Can't open shared library: .//libmylib.sl
/usr/lib/dld.sl: No such file or directory
Abort (core dumped)

I can find no way to indicate a.out to use the library in the tmp
directory.

HOWEVER, when I compile everthing with +DD64, it works without any
problem (SHLIB_PATH works)

Can you advice me about this problem (only related to 32 bits
executable)


--
Andrey Babayan,
System Administrator
NUMECA International
Av. Franklin Roosevelt 5
B-1050 Brussels Belgium
Tel: +32 2 643.35.73 (direct)
+32 2 647.83.11 (main) ext 833
Fax: +32 2 647.93.98
http://www.numeca.com


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 06:34 PM
Andrey Babayan
 
Posts: n/a
Default Re: Problem with 32 bits executable on HP11 and SHLIB_PATH

This is source files for previous message:

main.C

#include <iostream.h>

extern void foo();

int main()
{
foo();
}


mylib.C:

#include <iostream.h>

void foo()
{
cout << " Hello world from shared " << endl;
}


"Andrey Babayan" <andrey@numeca.be> wrote in message
news:btu52u$g8b$1@reader08.wxs.nl...
> Hello,
>
> I have a small example consisting of two files, in attachement.
>
> With the first file, I make a shared library, while with the second one
> (that contains
> the main) I compile an executable that links with the shared library.
>
> I use the following commands:
>
> aCC +z -c mylib.C
> aCC -b -o libmylib.sl
> aCC main.C -L ./ -lmylib
>
> This create a linmylib.sl file and a a.out executable which I can run
> without problem.
> However, when I move the shared library to another place, I cannot run
> a.out anymore. Exemple:
>
> mkdir tmp
> mv libmylib.sl tmp
> setenv SHLIB_PATH /raid/michel/tmp/_create_shared_library/tmp
> a.out
>
> I get the following error message:
>
> /usr/lib/dld.sl: Can't open shared library: .//libmylib.sl
> /usr/lib/dld.sl: No such file or directory
> Abort (core dumped)
>
> I can find no way to indicate a.out to use the library in the tmp
> directory.
>
> HOWEVER, when I compile everthing with +DD64, it works without any
> problem (SHLIB_PATH works)
>
> Can you advice me about this problem (only related to 32 bits
> executable)
>
>
> --
> Andrey Babayan,
> System Administrator
> NUMECA International
> Av. Franklin Roosevelt 5
> B-1050 Brussels Belgium
> Tel: +32 2 643.35.73 (direct)
> +32 2 647.83.11 (main) ext 833
> Fax: +32 2 647.93.98
> http://www.numeca.com
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 06:34 PM
Rémy
 
Posts: n/a
Default Re: Problem with 32 bits executable on HP11 and SHLIB_PATH


"Andrey Babayan" <andrey@numeca.be> a écrit dans le message de
news:btu52u$g8b$1@reader08.wxs.nl...
> Hello,
>
> I have a small example consisting of two files, in attachement.
>
> With the first file, I make a shared library, while with the second one
> (that contains
> the main) I compile an executable that links with the shared library.
>
> I use the following commands:
>
> aCC +z -c mylib.C
> aCC -b -o libmylib.sl
> aCC main.C -L ./ -lmylib
>
> This create a linmylib.sl file and a a.out executable which I can run
> without problem.
> However, when I move the shared library to another place, I cannot run
> a.out anymore. Exemple:
>
> mkdir tmp
> mv libmylib.sl tmp
> setenv SHLIB_PATH /raid/michel/tmp/_create_shared_library/tmp
> a.out
>
> I get the following error message:
>
> /usr/lib/dld.sl: Can't open shared library: .//libmylib.sl
> /usr/lib/dld.sl: No such file or directory
> Abort (core dumped)
>
> I can find no way to indicate a.out to use the library in the tmp
> directory.
>
> HOWEVER, when I compile everthing with +DD64, it works without any
> problem (SHLIB_PATH works)
>
> Can you advice me about this problem (only related to 32 bits
> executable)
>
>
> --
> Andrey Babayan,
> System Administrator
> NUMECA International
> Av. Franklin Roosevelt 5
> B-1050 Brussels Belgium
> Tel: +32 2 643.35.73 (direct)
> +32 2 647.83.11 (main) ext 833
> Fax: +32 2 647.93.98
> http://www.numeca.com
>
>


look at the document named "linker reference" on the HP site (if i
remember...)

You will discover that default options for the linker are quite different in
32 and 64 bits (for compatibility with pre-64 bit linker).

"man ld" should show you what is the option needed in 32 bits to activate
"SHLIB_PATH".

Regards

Rémy


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-16-2008, 06:34 PM
jignaasu
 
Posts: n/a
Default Re: Problem with 32 bits executable on HP11 and SHLIB_PATH

SHLIB_PATH lookup is on by default in a 64-bit link but not so in a
32-bit link.

use the '+s' linker option to enable the SHLIB_PATH lookup in the
executable that you are building. alternatively you could also use
chatr to enable it in an exuecutable you have already built ('chatr +s
enable a.out').
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com