vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a wrapper C++ API around Oracle's OCCI 9 to give some DB independance. This library is loaded into the running program using dlopen(). The problem I'm seeing is that it works fine on the machine I build on but on another machine the dlopen fails and dlerror() returns "Exec format error" and nothing further. Both machines are running AIX 5.1 but only one has Visual Age C++ 6 installed. The test program below works just fine on the machine with Visual Age C++ 6 installed but fails on the other, which has the C++ runtime for VA C++ 6 installed. Here is the link command I am using: xlC_r -G -qmkshrobj -o libdb_oracle.so db_oracle.o -L/openssl/static \ -L/product/9.2.0/lib32 -L/product/9.2.0/rdbms/lib32 -brtl \ -bnolibpath -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl -lc \ -lpthreads -lodm -lm -lbsd_r -lld The ssl, crypto, occi9 and clntst9 are all static libraries. The dump -Hv output is as follows: $ dump -Hv libfgldb_oracle.so libdb_oracle.so: ***Loader Section*** Loader Header Information VERSION# #SYMtableENT #RELOCent LENidSTR 0x00000001 0x000001b2 0x000066d8 0x000000b8 #IMPfilID OFFidSTR LENstrTBL OFFstrTBL 0x0000000c 0x0004faf0 0x000018a1 0x0004fba8 ***Import File Strings*** INDEX PATH BASE MEMBER 0 /usr/lib:/lib 1 libodm.a shr.o 2 libdl.a shr.o 3 libc.a shr.o 4 libc.a aio.o 5 libpthreads.a shr_xpg5.o 6 libC.a shr.o 7 libC.a shr2.o 8 libC.a shr3.o 9 libC.a ansi_32.o 10 librtl.a shr.o 11 .. I have a very simple program that just calls dlopen() on the library and prints the dlerror() if the dlopen() fails, here it is: #include <iostream> #include <dlfcn.h> int main(int argc, char* argv[]) { std::cout << "Loading " << argv[1] << " ..." << std::endl; void* handle = dlopen(argv[1], RTLD_NOW|RTLD_MEMBER); if (handle == 0) { std::cout << "Unable to load library" << std::endl << dlerror() << std::endl; return 1; } std::cout << "Load successful...." << std::endl; dlclose(handle); } I'd appreciate any insight and suggestions as to how to proceed. Thanks, Jo |
| |||
| Are all the libraries that you are linking with present on the target system? "Exec format error" in dlopen() usually comes if the library that is being opened has some unresolved symbols. To find out which unresolved symbols are there, try linking the library (temporarily) without -G option, only -qmkshrobj option, and that will give you all the unresolved symbols. Hope this helps, Gaurav jvs@stockley.com (Jonathan Stockley) wrote in message news:<87010bd6.0406141745.28d74756@posting.google. com>... > I have a wrapper C++ API around Oracle's OCCI 9 to give some DB > independance. > This library is loaded into the running program using dlopen(). The > problem I'm seeing is that it works fine on the machine I build on but > on another machine the dlopen fails and dlerror() returns "Exec format > error" and nothing further. > > Both machines are running AIX 5.1 but only one has Visual Age C++ 6 > installed. The test program below works just fine on the machine with > Visual Age C++ 6 installed but fails on the other, which has the C++ > runtime for VA C++ 6 installed. > > Here is the link command I am using: > > xlC_r -G -qmkshrobj -o libdb_oracle.so db_oracle.o -L/openssl/static \ > -L/product/9.2.0/lib32 -L/product/9.2.0/rdbms/lib32 -brtl \ > -bnolibpath -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl -lc \ > -lpthreads -lodm -lm -lbsd_r -lld > > The ssl, crypto, occi9 and clntst9 are all static libraries. > > The dump -Hv output is as follows: > > $ dump -Hv libfgldb_oracle.so > > libdb_oracle.so: > > ***Loader Section*** > Loader Header Information > VERSION# #SYMtableENT #RELOCent LENidSTR > 0x00000001 0x000001b2 0x000066d8 0x000000b8 > > #IMPfilID OFFidSTR LENstrTBL OFFstrTBL > 0x0000000c 0x0004faf0 0x000018a1 0x0004fba8 > > > ***Import File Strings*** > INDEX PATH BASE MEMBER > 0 /usr/lib:/lib > 1 libodm.a shr.o > 2 libdl.a shr.o > 3 libc.a shr.o > 4 libc.a aio.o > 5 libpthreads.a shr_xpg5.o > 6 libC.a shr.o > 7 libC.a shr2.o > 8 libC.a shr3.o > 9 libC.a ansi_32.o > 10 librtl.a shr.o > 11 .. > > > I have a very simple program that just calls dlopen() on the library > and prints the dlerror() if the dlopen() fails, here it is: > > #include <iostream> > #include <dlfcn.h> > > int main(int argc, char* argv[]) > { > std::cout << "Loading " << argv[1] << " ..." << std::endl; > void* handle = dlopen(argv[1], RTLD_NOW|RTLD_MEMBER); > if (handle == 0) > { > std::cout << "Unable to load library" << std::endl > << dlerror() << std::endl; > > return 1; > } > > std::cout << "Load successful...." << std::endl; > dlclose(handle); > } > > I'd appreciate any insight and suggestions as to how to proceed. > > Thanks, > Jo |
| |||
| Ok, I switched stuff around and wrote a test that linked directly with the library instead on loading it at runtime using dlopen(). Now, on the build machine the test runs fine, but on the test machine I get the following error: exec(): 0509-036 Cannot load program /home/jvs/aix/bin/AIX5.1/dbping because of the following errors: 0509-130 Symbol resolution failed for /usr/lib/libc.a(aio.o) because: 0509-136 Symbol kaio_rdwr (number 0) is not exported from dependent module /unix. 0509-136 Symbol listio (number 1) is not exported from dependent module /unix. 0509-136 Symbol acancel (number 2) is not exported from dependent module /unix. 0509-136 Symbol iosuspend (number 3) is not exported from dependent module /unix. 0509-136 Symbol aio_nwait (number 4) is not exported from dependent module /unix. 0509-192 Examine .loader section symbols with the 'dump -Tv' command. So, these aio related symbols are not exported from /unix on the test machine. Is there something that needs configured on the test machine to enable this? Thanks, Jo gaurav_anywhere@yahoo.com (Gaurav Jain) wrote in message news:<ab87b301.0406150037.64258ced@posting.google. com>... > Are all the libraries that you are linking with present on the target > system? > "Exec format error" in dlopen() usually comes if the library that is > being opened has some unresolved symbols. > > To find out which unresolved symbols are there, try linking the > library (temporarily) without -G option, only -qmkshrobj option, and > that will give you all the unresolved symbols. > > Hope this helps, > Gaurav > jvs@stockley.com (Jonathan Stockley) wrote in message news:<87010bd6.0406141745.28d74756@posting.google. com>... > > I have a wrapper C++ API around Oracle's OCCI 9 to give some DB > > independance. > > This library is loaded into the running program using dlopen(). The > > problem I'm seeing is that it works fine on the machine I build on but > > on another machine the dlopen fails and dlerror() returns "Exec format > > error" and nothing further. > > > > Both machines are running AIX 5.1 but only one has Visual Age C++ 6 > > installed. The test program below works just fine on the machine with > > Visual Age C++ 6 installed but fails on the other, which has the C++ > > runtime for VA C++ 6 installed. > > > > Here is the link command I am using: > > > > xlC_r -G -qmkshrobj -o libdb_oracle.so db_oracle.o -L/openssl/static \ > > -L/product/9.2.0/lib32 -L/product/9.2.0/rdbms/lib32 -brtl \ > > -bnolibpath -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl -lc \ > > -lpthreads -lodm -lm -lbsd_r -lld > > > > The ssl, crypto, occi9 and clntst9 are all static libraries. > > > > The dump -Hv output is as follows: > > > > $ dump -Hv libfgldb_oracle.so > > > > libdb_oracle.so: > > > > ***Loader Section*** > > Loader Header Information > > VERSION# #SYMtableENT #RELOCent LENidSTR > > 0x00000001 0x000001b2 0x000066d8 0x000000b8 > > > > #IMPfilID OFFidSTR LENstrTBL OFFstrTBL > > 0x0000000c 0x0004faf0 0x000018a1 0x0004fba8 > > > > > > ***Import File Strings*** > > INDEX PATH BASE MEMBER > > 0 /usr/lib:/lib > > 1 libodm.a shr.o > > 2 libdl.a shr.o > > 3 libc.a shr.o > > 4 libc.a aio.o > > 5 libpthreads.a shr_xpg5.o > > 6 libC.a shr.o > > 7 libC.a shr2.o > > 8 libC.a shr3.o > > 9 libC.a ansi_32.o > > 10 librtl.a shr.o > > 11 .. > > > > > > I have a very simple program that just calls dlopen() on the library > > and prints the dlerror() if the dlopen() fails, here it is: > > > > #include <iostream> > > #include <dlfcn.h> > > > > int main(int argc, char* argv[]) > > { > > std::cout << "Loading " << argv[1] << " ..." << std::endl; > > void* handle = dlopen(argv[1], RTLD_NOW|RTLD_MEMBER); > > if (handle == 0) > > { > > std::cout << "Unable to load library" << std::endl > > << dlerror() << std::endl; > > > > return 1; > > } > > > > std::cout << "Load successful...." << std::endl; > > dlclose(handle); > > } > > > > I'd appreciate any insight and suggestions as to how to proceed. > > > > Thanks, > > Jo |
| |||
| smitty aio -->enable then reboot Jonathan Stockley wrote: > Ok, I switched stuff around and wrote a test that linked directly with > the library instead on loading it at runtime using dlopen(). > Now, on the build machine the test runs fine, but on the test machine > I get the following error: > > exec(): 0509-036 Cannot load program /home/jvs/aix/bin/AIX5.1/dbping > because of the following errors: > 0509-130 Symbol resolution failed for /usr/lib/libc.a(aio.o) > because: > 0509-136 Symbol kaio_rdwr (number 0) is not exported from > dependent module /unix. > 0509-136 Symbol listio (number 1) is not exported from > dependent module /unix. > 0509-136 Symbol acancel (number 2) is not exported from > dependent module /unix. > 0509-136 Symbol iosuspend (number 3) is not exported from > dependent module /unix. > 0509-136 Symbol aio_nwait (number 4) is not exported from > dependent module /unix. > 0509-192 Examine .loader section symbols with the > 'dump -Tv' command. > > So, these aio related symbols are not exported from /unix on the test > machine. Is there something that needs configured on the test machine > to enable this? > > Thanks, > Jo > > gaurav_anywhere@yahoo.com (Gaurav Jain) wrote in message news:<ab87b301.0406150037.64258ced@posting.google. com>... > >>Are all the libraries that you are linking with present on the target >>system? >>"Exec format error" in dlopen() usually comes if the library that is >>being opened has some unresolved symbols. >> >>To find out which unresolved symbols are there, try linking the >>library (temporarily) without -G option, only -qmkshrobj option, and >>that will give you all the unresolved symbols. >> >>Hope this helps, >>Gaurav >>jvs@stockley.com (Jonathan Stockley) wrote in message news:<87010bd6.0406141745.28d74756@posting.google. com>... >> >>>I have a wrapper C++ API around Oracle's OCCI 9 to give some DB >>>independance. >>>This library is loaded into the running program using dlopen(). The >>>problem I'm seeing is that it works fine on the machine I build on but >>>on another machine the dlopen fails and dlerror() returns "Exec format >>>error" and nothing further. >>> >>>Both machines are running AIX 5.1 but only one has Visual Age C++ 6 >>>installed. The test program below works just fine on the machine with >>>Visual Age C++ 6 installed but fails on the other, which has the C++ >>>runtime for VA C++ 6 installed. >>> >>>Here is the link command I am using: >>> >>>xlC_r -G -qmkshrobj -o libdb_oracle.so db_oracle.o -L/openssl/static \ >>>-L/product/9.2.0/lib32 -L/product/9.2.0/rdbms/lib32 -brtl \ >>>-bnolibpath -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl -lc \ >>>-lpthreads -lodm -lm -lbsd_r -lld >>> >>>The ssl, crypto, occi9 and clntst9 are all static libraries. >>> >>>The dump -Hv output is as follows: >>> >>>$ dump -Hv libfgldb_oracle.so >>> >>>libdb_oracle.so: >>> >>> ***Loader Section*** >>> Loader Header Information >>>VERSION# #SYMtableENT #RELOCent LENidSTR >>>0x00000001 0x000001b2 0x000066d8 0x000000b8 >>> >>>#IMPfilID OFFidSTR LENstrTBL OFFstrTBL >>>0x0000000c 0x0004faf0 0x000018a1 0x0004fba8 >>> >>> >>> ***Import File Strings*** >>>INDEX PATH BASE MEMBER >>>0 /usr/lib:/lib >>>1 libodm.a shr.o >>>2 libdl.a shr.o >>>3 libc.a shr.o >>>4 libc.a aio.o >>>5 libpthreads.a shr_xpg5.o >>>6 libC.a shr.o >>>7 libC.a shr2.o >>>8 libC.a shr3.o >>>9 libC.a ansi_32.o >>>10 librtl.a shr.o >>>11 .. >>> >>> >>>I have a very simple program that just calls dlopen() on the library >>>and prints the dlerror() if the dlopen() fails, here it is: >>> >>>#include <iostream> >>>#include <dlfcn.h> >>> >>>int main(int argc, char* argv[]) >>>{ >>> std::cout << "Loading " << argv[1] << " ..." << std::endl; >>> void* handle = dlopen(argv[1], RTLD_NOW|RTLD_MEMBER); >>> if (handle == 0) >>> { >>> std::cout << "Unable to load library" << std::endl >>> << dlerror() << std::endl; >>> >>> return 1; >>> } >>> >>> std::cout << "Load successful...." << std::endl; >>> dlclose(handle); >>>} >>> >>>I'd appreciate any insight and suggestions as to how to proceed. >>> >>>Thanks, >>>Jo |
| ||||
| Jonathan Stockley wrote: > Both machines are running AIX 5.1 but only one has Visual Age C++ 6 > installed. The test program below works just fine on the machine with > Visual Age C++ 6 installed but fails on the other, which has the C++ > runtime for VA C++ 6 installed. You don't specify the _precise_ level of the runtime. The output of "lslpp -l xlC.*.rte" would be helpful. > xlC_r -G <...snip...> -brtl \ http://www-106.ibm.com/developerwork..._link_102.html > -bnolibpath Bad. Unnecessary. > -bnoipath -lssl -lcrypto -locci9 -lclntst9 -ldl > -lc \ > -lpthreads Unnecessary. The compiler adds these for you. /etc/vac.cfg > -lld Most likely unnecessary. Rarely used. > $ dump -Hv libfgldb_oracle.so > > libdb_oracle.so: > > ***Loader Section*** > Loader Header Information > VERSION# #SYMtableENT #RELOCent LENidSTR > 0x00000001 0x000001b2 0x000066d8 0x000000b8 > > #IMPfilID OFFidSTR LENstrTBL OFFstrTBL > 0x0000000c 0x0004faf0 0x000018a1 0x0004fba8 > > > ***Import File Strings*** > INDEX PATH BASE MEMBER > 0 /usr/lib:/lib > 1 libodm.a shr.o > 2 libdl.a shr.o > 3 libc.a shr.o > 4 libc.a aio.o This is interesting... Oracle does use AIO, so is it configured on the second machine? > 5 libpthreads.a shr_xpg5.o > 6 libC.a shr.o > 7 libC.a shr2.o > 8 libC.a shr3.o > 9 libC.a ansi_32.o > 10 librtl.a shr.o > 11 .. -- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE __________________________________________________ ______________________ |