This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: g++ symbol problem in Red Hat Linux 8.0
- From: "Lev Assinovsky" <LAssinovsky at algorithm dot aelita dot com>
- To: "zakaria kojo" <zakaria_kojo at yahoo dot com>,<gcc-help at gcc dot gnu dot org>
- Date: Mon, 27 Oct 2003 19:04:13 +0300
- Subject: RE: g++ symbol problem in Red Hat Linux 8.0
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@yahoo.com]
> Sent: Monday, October 27, 2003 6:09 PM
> To: gcc-help@gcc.gnu.org
> 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/
>