gcc 4.1.1 problem creating C++ shared library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a stock 32 bit RH FC5 system. I am trying to build a C++ shared
library and something seems very broken (I have no problem building a
'C' shared library).

Here is an example:

file XYZ.C

-------
#include <iostream>
class XYZ
{
public:
  XYZ(void);
  ~XYZ(void);
};
XYZ::XYZ(void)
{ std::cout << "XYZ" << std::endl; }
XYZ::~XYZ(void)
{ std::cout << "~XYZ" << std::endl; }
-----------

build,create and check:

$gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20060525 (Red Hat 4.1.1-1 )

$ g++ -g -fPIC -o XYZ.o -c XYZ.C
$ g++ -shared -g -fPIC -o libXYZ.so.1 XYZ.o
$ /usr/bin/readelf -l ./libXYZ.so.1

Elf file type is DYN (Shared object file)
Entry point 0x730
There are 5 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg
Align
  NULL           0x000000 0x00000000 0x00000000 0x00000 0x00000     0
  NULL           0x000000 0x00000000 0x00000000 0x00000 0x00000     0
  NULL           0x000000 0x00000000 0x00000000 0x00000 0x00000     0
  NULL           0x000000 0x00000000 0x00000000 0x00000 0x00000     0
  NULL           0x000000 0x00000000 0x00000000 0x00000 0x00000     0

 Section to Segment mapping:
  Segment Sections...
   00
   01
   02
   03
   04

You should notice that all of the loadable segments are undefined. Does
anyone have a clue why this is happening. I believe I am doing
everything correctly.
/JMB

--
/JMB

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux