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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 > > |
| |||
| "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 |
| ||||
| 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'). |