LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   gcc 3.2-7 on FC4 ? (https://www.linuxquestions.org/questions/linux-software-2/gcc-3-2-7-on-fc4-356239/)

senthilpr_in 08-23-2005 03:13 PM

gcc 3.2-7 on FC4 ?
 
Hi all,

I'm using Open Inventor (3D Graphics API for C++ and Java) of Fedora Core 4. The version of gcc on my machine is gcc 4.0.0-8. When I try to call their demo program I get the following error.

----------------------------------------------------------------------------------------------------------------------
g++ -O -Wno-deprecated -D_GCC_ -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -DQT_SHARED -o verifs verifs.o -L/home/oiv50/lib
-lInventorXt -lInventor -limage -L/lib -lGLU -L/lib -lGL
-L/home/oiv50/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -lXm -lXt -lXi
-lXext -L/usr/X11R6/lib -lX11 -lstdc++ -lm -ldl -lpthread
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::allocate(unsigned int)'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_S_free_list'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_Lock::~_Lock()'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_S_force_new'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_Lock::_Lock()'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_S_refill(unsigned int)'
/home/oiv50/lib/libInventor.so: undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::_S_empty_rep_storage'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::_S_node_allocator_lock'
/home/oiv50/lib/libInventorXt.so: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned
int)'
collect2: ld returned 1 exit status
make: *** [verifs] Error 1
----------------------------------------------------------------------------------------------------------------------

I was told that this error is most probably because Open Inventor (the 3D graphics API) was built with gcc 3.2-7 and I'm using 4.0.0-8. I was asked to recompile with demo code with gcc 3.2.7

When I tried to install gcc 3.2.7 rpm, I was not able to do so, because of dependency issues.
----------------------------------------------------------------------------------------------------------------------
[root@linux1 Desktop]# rpm -ivf gcc-3.2-7.i386.rpm
warning: gcc-3.2-7.i386.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
cpp = 3.2-7 is needed by gcc-3.2-7.i386
[root@linux1 Desktop]# gcc cpp-3.2-7.i386.rpm
cpp-3.2-7.i386.rpm: file not recognized: File format not recognized
collect2: ld returned 1 exit status
[root@linux1 Desktop]# rpm -ivf cpp-3.2-7.i386.rpm
warning: cpp-3.2-7.i386.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e
Preparing packages for installation...
package cpp-4.0.1-4.fc4 (which is newer than cpp-3.2-7) is already installed
file /usr/bin/cpp from install of cpp-3.2-7 conflicts with file from package cpp-4.0.1-4.fc4
file /usr/share/info/cpp.info.gz from install of cpp-3.2-7 conflicts with file from package cpp-4.0.1-4.fc4
file /usr/share/info/cppinternals.info.gz from install of cpp-3.2-7 conflicts with file from package cpp-4.0.1-4.fc4
file /usr/share/man/man1/cpp.1.gz from install of cpp-3.2-7 conflicts with file from package cpp-4.0.1-4.fc4
----------------------------------------------------------------------------------------------------------------------

I would like to know if the first error "undefined reference to `std::__default_alloc_template" is due to the difference in compiler versions and if yes, how can I get gcc 3.2.7 installed.

Also here is the system requirement for provided for open inventor

1.3 PC Linux Red Hat
---------------------------
- Red Hat release: 8.0/9.0
NOTE: Open Inventor was built on Red Hat 8.0 but is fully compatible with Red Hat 9.0.

- OS kernel: 2.4.18-14
- X-server: XFree 4.2.0-72
- Motif: OpenMotif 2.2.2-12
- Compiler: gcc 3.2-7
- C library: glibc 2.2.93-5
- OpenGL library: NVidia driver 53.28 (OpenGL 1.4)
NOTE: This is not the Red Hat 8.0 default: the default is provided by the
X-server.

I have been told that the the API works on RedHat Workstation 3, Fedora Core 3,
and Suse 9.3.

Please advice
Thanks
Senthil

dub.wav 08-24-2005 08:18 AM

Use yum:
yum install compat-gcc-32

senthilpr_in 08-24-2005 10:37 AM

Hi,

thanks for the advice. I made a terrible mistake by trying to uninstall gcc4.0.0-8. I removed gcc by using rpm -e and and also 4 more packages which gcc was dependent on. When I tried to install gcc 3.2.7 there were more confilicts. I tried to fix this by running yum update. But now, yum, rpm and gcc, firefox etc are not working.

When I try using gcc I get the following message.

gcc: installation problem, cannot exec cc1plus: No file or directory

when I try yum I get the following

the yum libraries do not seem to be available on your system for this version of python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512] (RedHat 4.0.0-5]
Please make sure the package you used to installyum was built for your install of python.

rpm: error while loading shared libraries: libstdc++.so.6: cannot open shared object file. No such file or directory.

I guess this is all because I screwed up my gcc installation. I neither have gcc-4.0.0-8 nor gcc 3.2.7. I dont want to reinstall FC4. Please help

Thanks
Senthil

dub.wav 08-24-2005 11:15 AM

Someone may know a better way, but this should work.

1) Get an alternative rpm2cpio, as the one installed is linked to libdc++.

One can be found here: http://linuxmafia.com/pub/linux/util...neral/rpm2cpio
Download it, and make it executable (chmod +x ..., or use the file manager).

2) Find all rpms you deleted. They should be on the installation media.
3) Open a shell, become root, and type: cd /
4) For each RPM, type: /path/to/rpm2cpio /path/to/foo.rpm | cpio -iumd

Make sure you use the rpm2cpio you downloaded, the one on the system won't work.

senthilpr_in 08-24-2005 12:12 PM

Hi , thanks for your advice. i was able to get my browser, rpm and yum utilities running. The only package I'm not able to run is gcc.

when I try to compile a hello world program in gcc I get the following error .

cannot exec ''cc1plus' No such file or directory.

Please advice
Thanks
Senthil

dub.wav 08-24-2005 12:30 PM

You're missing the gcc-c++ package.

senthilpr_in 08-24-2005 12:52 PM

I'm not sure if I'm missing that. I tried

[root@linux1 senthil]# rpm -qa | grep gcc
gcc-c++-4.0.1-4.fc4
gcc-4.0.1-4.fc4
libgcc-4.0.1-4.fc4
gcc-gfortran-4.0.0-8

please advice.

Thanks
Senthil

dub.wav 08-24-2005 01:37 PM

That's odd.
yum provides /usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus says:
Code:

gcc-c++.i386                            4.0.1-4.fc4            installed
Matched from:
/usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus

Does that file exist? If not, you may want to try to reinstall the gcc-c++ package.

senthilpr_in 08-24-2005 01:59 PM

Yes, that file exists.

[senthil@linux1 4.0.1]$ ls -l cc1plus
-rwxr-xr-x 1 root root 5070864 Jul 27 07:50 cc1plus

and here is my $PATH variable
[senthil@linux1 4.0.1]$ echo $PATH
/usr/kerberos/bin:/bin:/usr/sbin:/usr/bin:/etc:/usr/local/bin:/usr/local/netscape:/home/senthil/cvs/bin/linux:/home/senthil/cvs/devbin/linux:.
Please advice
Senthil

dub.wav 08-24-2005 04:33 PM

I suggest you try to re-install the gcc rpm's.
Like this: rpm --replacepkgs -ivh <package>

senthilpr_in 08-24-2005 06:33 PM

thanks. I did that. i also reinstalled gcc=g++. Now I'm not getting that error any more. But I'm getting a different one.

/tmp/ccIjFQ2F.o(.text+0x25): In function `main':
helloworld.cxx: undefined reference to `std::cout'
/tmp/ccIjFQ2F.o(.text+0x2a):helloworld.cxx: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccIjFQ2F.o(.text+0x47): In function `__tcf_0':
helloworld.cxx: undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccIjFQ2F.o(.text+0x74): In function `__static_initialization_and_destruction_0(int, int)':
helloworld.cxx: undefined reference to `std::ios_base::Init::Init()'
/tmp/ccIjFQ2F.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

and here is the source of my helloworld.cxx

#include<iostream>
using namespace std;
int main(){
cout<<"Hello World !";
return 0;
}

Please advice.
Thx
Senthil

dub.wav 08-25-2005 03:52 AM

Install/re-install libstdc++-devel.

senthilpr_in 08-25-2005 10:15 AM

Thanks. I did that. In fact I reinstalled the following packages, not necessarily in this order using

rpm --replacepkgs -ivh <rpmname>

compat-gcc-32-3.2.3-47.fc4.i386.rpm
libgcc-4.0.1-4.fc4.i386.rpm
cpp-4.0.1-4.fc4.i386.rpm
libstdc++-4.0.1-4.fc4.i386.rpm
libstdc++-devel-4.0.1-4.fc4.i386.rpm
gcc-c++-4.0.1-4.fc4.i386.rpm
gcc-4.0.1-4.fc4.i386.rpm

Still I'm getting the follwing error.
-------------------------------------------------------------------------------------------------
/tmp/ccQWM9kd.o(.text+0x25): In function `main':
helloworld.cxx: undefined reference to `std::cout'
/tmp/ccQWM9kd.o(.text+0x2a):helloworld.cxx: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccQWM9kd.o(.text+0x47): In function `__tcf_0':
helloworld.cxx: undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccQWM9kd.o(.text+0x74): In function `__static_initialization_and_destruction_0(int, int)':
helloworld.cxx: undefined reference to `std::ios_base::Init::Init()'
/tmp/ccQWM9kd.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
-------------------------------------------------------------------------------------------------

I'm able to compile and run a helloworld.c code succesfully but I'm not able to use any functions available in the math libarary.

Please adivce
Thx
Senthil

dub.wav 08-25-2005 10:51 AM

I get the very same error if I use gcc instead of g++. Which are you using?
As for your problem with math library functions, you have to link in the math library explicitly, using -lm.

senthilpr_in 08-25-2005 11:05 AM

Thanks for help with including hte math library. It works. !!

Also, amazingly I'm able to compile with g++ sucessfully and not gcc (exactly opposite to yours).

Senthil


All times are GMT -5. The time now is 05:38 PM.