vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi All, I wrote a main application under AIX 5.1 (power_604) in 'c' which in run-time calls to a second party shared library i wrote in c++. I made the following compilations: ----------------------------------- The main application was compiled as follows: cc -o test.out $(OBJS) $(SHRLIB) -L$(SHRLIBPATH) This compilation succeeded. The second party shared library which contains 'c++' objects (along with extern 'c' for mangling names) which were compiled using g++, was compiled using: ld -o Lib.o $(OBJS) -G -bE:Lib.exp -bM:SRE -bnoentry -lc This compilation succeeded, but when doing: dump -HTv Lib.o, the following is printed: [13] 0x00000000 undef IMP DS EXTref .. __builtin_vec_new [14] 0x00000000 undef IMP DS EXTref .. __builtin_vec_delete [15] 0x00000000 undef IMP DS EXTref .. __builtin_delete [16] 0x00000000 undef IMP DS EXTref .. __rtti_user [17] 0x00000000 undef IMP DS EXTref .. __rtti_si [18] 0x00000000 undef IMP DS EXTref .. __pure_virtual [19] 0x00000000 undef IMP DS EXTref .. __rethrow [20] 0x00000000 undef IMP DS EXTref .. terminate__Fv [21] 0x00000000 undef IMP DS EXTref .. __builtin_new These lacks causes the main application to fail at run-time as follows: 'Illegal instruction (core dumped)' This problem still occurs when compiling the main application with the '-brtl' flag or with '-bexpall'. I've tried compiling the shared library using '-lstdc++' which doesn't help either. The version of my g++ is as follows: ------------------------------------ csaix:~/Lib [290]: g++ -v Reading specs from /usr/bin/../lib/gcc-lib/powerpc-ibm-aix5.1.0.0/2.9-aix51-020209/specs gcc version 2.9-aix51-020209 Is my compilation right? What are the missing libraries of c++ i need to attach to my shared library, and from what directory? If i understand right, the problem is a lack of a c++ library i have to attach to the compilation of my shared library as i did with '-lc', is that right? I'm stack with it... Thanks from advance Boaz |
| |||
| "Boaz" <boazter@hotmail.com> writes: > ld -o Lib.o $(OBJS) -G -bE:Lib.exp -bM:SRE -bnoentry -lc Make that 'g++ -o Lib.o $(OBJS) -shared -Wl,-G -Wl,-bE:Lib.exp -Wl,-bnoentry' User code should (almost) *never* link anything directly with 'ld'. Always use appropriate compiler driver to do your linking. > What are the missing libraries of c++ i need to attach to my shared > library, At least libstdc++ and libgcc. > and from what directory? Varies depending on which version of g++ is installed and how it was configured. Better have g++ add the necessary libraries for you. > I'm stack with it... Vivid visions of a developer "stacked" between the 'g++' and the linker :-) The work you should have used is "stuck". Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. |
| |||
| Paul Pluzhnikov wrote: > "Boaz" <boazter@hotmail.com> writes: > > > Make that 'g++ -o Lib.o $(OBJS) -shared -Wl,-G -Wl,-bE:Lib.exp -Wl,-bnoentry' > > User code should (almost) *never* link anything directly with 'ld'. > Always use appropriate compiler driver to do your linking. In other words, always link against appropriate libraries. In this case, libg++, IIRC or whatever the driver includes for you. This will resolve the unsatisfied symbol references. Also, the -G option, on AIX, is for building shared modules that are intended to be used in a runtime linking application. Read my article "Linking 102" for more info: http://www-106.ibm.com/developerwork..._link_102.html >>I'm stack with it... > > Vivid visions of a developer "stacked" between the 'g++' and the linker :-) > The work you should have used is "stuck". ---- "word" :-) -- Gary R. Hook __________________________________________________ ______________________ Vocatus atque non vocatus deus aderit |
| ||||
| Gary R. Hook wrote: <snip> >> Vivid visions of a developer "stacked" between the 'g++' and the >> linker :-) >> The work you should have used is "stuck". > > ---- > "word" :-) ____ OOo. Oops, wrong thread. 8-) |
| Thread Tools | |
| Display Modes | |
|
|