Forte 6.2 C++ object good, lib from object has problems for STL

Forte 6.2 C++ object good, lib from object has problems for STL

Post by Benjamin Kaufma » Fri, 01 Mar 2002 13:25:34



I'm working with Forte 6.2
xxx.o is an object file that uses some STL (stack which defaults to use deque)
If I link the program with xxx.o it is OK.
I created a library libxxx.a from xxx.o using ar -rc
If I link with  -lxxx I get undefined symbols for some stl stuff (i.e.
std:deque) referenced in that library.  I even did a diff of the symbol tables
and with the exception of the tag identifying the files, they are identical so
I'm inclined to believe this is a care and feeding issue of the 6.2 beast which
I am only using -g -mt options.

Thanks for any suggestions.

(no problem with the GNU port)

Ben

 
 
 

Forte 6.2 C++ object good, lib from object has problems for STL

Post by Chris Morga » Sat, 02 Mar 2002 01:46:06



> I'm working with Forte 6.2
> xxx.o is an object file that uses some STL (stack which defaults to use deque)
> If I link the program with xxx.o it is OK.
> I created a library libxxx.a from xxx.o using ar -rc
> If I link with  -lxxx I get undefined symbols for some stl stuff (i.e.
> std:deque) referenced in that library.  I even did a diff of the symbol tables
> and with the exception of the tag identifying the files, they are identical so
> I'm inclined to believe this is a care and feeding issue of the 6.2 beast which
> I am only using -g -mt options.

> Thanks for any suggestions.

> (no problem with the GNU port)

You should do man CC and look into the -library= qualifier, e.g. try

-library=Cstd,Crun on the link line for .so

good luck

Chris
--
Chris Morgan

 
 
 

Forte 6.2 C++ object good, lib from object has problems for STL

Post by Benjamin Kaufma » Sun, 03 Mar 2002 02:59:07


Chris,

Those libraries are included as default.  The solutions is to not use ar.  Use
CC -xar.

Ben

(Hope my pain is now someone else's gain)



>> I'm working with Forte 6.2
>> xxx.o is an object file that uses some STL (stack which defaults to use deque)
>> If I link the program with xxx.o it is OK.
>> I created a library libxxx.a from xxx.o using ar -rc
>> If I link with  -lxxx I get undefined symbols for some stl stuff (i.e.
>> std:deque) referenced in that library.  I even did a diff of the symbol tables
>> and with the exception of the tag identifying the files, they are identical so
>> I'm inclined to believe this is a care and feeding issue of the 6.2 beast which
>> I am only using -g -mt options.

>> Thanks for any suggestions.

>> (no problem with the GNU port)

>You should do man CC and look into the -library= qualifier, e.g. try

>-library=Cstd,Crun on the link line for .so

>good luck

>Chris

 
 
 

1. How does c function invoke c++ function in shared object on RHL 6.2?

In comp.os.linux.development.apps, MAILt2

 wrote
on Mon, 04 Sep 2000 21:26:02 +0900

You might have a problem here.  Try the command line

c++ -g -shared -o a.so a.o -ldl

This command line will not only set up the link for you, but will
also take care of various initialization issues (static constructors,
mostly).

For completeness, here's the new command sequence with my modifications:

   gcc -g -o b b.c -ldl
   c++ -g -O2 -I. -I.. -I../../zolar35/include -DHAVE_CONFIG_H \
   -DLINUX -fpic -c a.cpp
   c++ -g -shared -o a.so a.o -ldl

This works beautifully on my system (RH6.0), although I'm a tad surprised
that a.cpp isn't compiled with -fpic or -fPIC; this may cause problems later
when a.cpp starts doing things with global variables and such,
as you continue development.

[debug output snipped]

--

2. fast find replacement

3. Problem: shared object loading runs constructor of a static object, but static linkage does not.

4. Makefile question

5. Q: C++ - contructor not called for object in shared lib

6. modem sharing problems

7. Problem with compiling STL using program with Forte C++ 6 update 1 in compat=4 mode

8. Hardware typical config. for hosting ?

9. Free: Make 3D scan from real object to virtual object

10. creating new shared object from existing shared objects ??

11. Free: Make 3D scan from real object to virtual object