RE: g++ symbol problem in Red Hat Linux 8.0

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

 



You have to compile with options -fpic or -fPIC.

----
Lev Assinovsky
Aelita Software Corporation
O&S InTrust Framework Division, Team Leader
ICQ# 165072909


> -----Original Message-----
> From: zakaria kojo [mailto:zakaria_kojo@xxxxxxxxx]
> Sent: Monday, October 27, 2003 6:09 PM
> To: gcc-help@xxxxxxxxxxx
> Subject: g++ symbol problem in Red Hat Linux 8.0
> 
> 
> 
> I am having problems in Red Hat Linux 8.0 in building
> shared files. Could someone help.
> 
> I never face the same problem with Red Hat Linux 7.3
> Below are the details of the problem.
> 
> Zakaria Aygula
> 
> 
> [shell]$ g++ -v
> Reading specs from
> /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
> Configured with: ../configure --prefix=/usr
> --mandir=/usr/share/man --infodir=/u
> sr/share/info --enable-shared
> --enable-threads=posix --disable-checking
> --host=i386-redhat-linux --with-system
> -zlib --enable-__cxa_atexit
> Thread model: posix
> gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
> 
> [shell]$g++  sum_array.cc -c
> 
> Where sum_array.cc is the code below.
> 
> sum_array.cc
> //#######################################
> float sum_array(int argc, void  *argv[])
> {
>   float *fp, s=0.0; int n;
>   for( n= *(int *)argv[1], fp=(float *)argv[0]; n--;)
>     s += *fp++;
>   return (s);
> }
> //##########################################
> 
> now the shared file is
> 
> [shell]$g++ -shared -o  example.so sum_array.o
> 
> [shell]$ nm example.so
> ................................
> ................................
> 00000514 T _init
> 000017bc d __JCR_END__
> 000017bc d __JCR_LIST__
>          w _Jv_RegisterClasses
> 000016cc d p.0
> 00000628 T _Z9sum_arrayiPPv <=======  Here is the
> diference with Red Hat 7.3 g++ compiler, and the
> shared file does not execute in Red Hat 8.0.
> 
> The last symbol is different from Red Hat Linux 7.3 as
> shown below.
>  [shell]$g++ -v
> Reading specs from
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
> 
> 
> Which gives
> 
> 00000680 t gcc2_compiled.
> 00000670 t init_dummy
> 00000710 t init_dummy
> 00001858 b object.2
> 00001744 d p.0
> 00000680 T sum_array__FiPPv <=======  Here is the
> difference with Red Hat Linux 8.0 g++ compiler
> 
> And it is the correct one. Can someone out there help
> how to compile corectly on Red Hat Linux 8.0
> 
> 
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears
> http://launch.yahoo.com/promos/britneyspears/
> 


[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