libstdc++.so could not read symbols: File in wrong format

1024kb

Verified User
Joined
Jun 25, 2014
Messages
44
OS: CentOS 6.7
CustomBuild: 2.0

When running "./build versions" I'm seeing there is an update for PHP available:
PHP 5.5 (mod_php) 5.5.30 to 5.5.31 update is available.

After performing "./build update" and "./build update_versions", it eventually spits out this error:

Code:
/usr/local/lib/../lib/libstdc++.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
make: *** Waiting for unfinished jobs....
/usr/local/lib/../lib/libstdc++.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
/usr/local/lib/../lib/libstdc++.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

I'm not sure if this is entirely related or not, but I did follow the steps outlined here and I still receive the same error when trying to update.

Any insight or help would be greatly appreciated!
 
More than likely either you don't have the correct version libstdc++.so installed (32 vs 64-bit) or the files were put in the wrong place. Based on the fact that it is in /usr/local/lib I assume you built it instead of installing the system versions which would typically be in /usr/lib for 32-bit and /usr/lib64 for 64-bit. Then when building I am sure your -L has /usr/local/lib/../lib before the system libs so it is finding that one and attempting to use it. My suggestion is to remove the libstdc++ from your /usr/local and install/use the system ones.
 
More than likely either you don't have the correct version libstdc++.so installed (32 vs 64-bit) or the files were put in the wrong place. Based on the fact that it is in /usr/local/lib I assume you built it instead of installing the system versions which would typically be in /usr/lib for 32-bit and /usr/lib64 for 64-bit. Then when building I am sure your -L has /usr/local/lib/../lib before the system libs so it is finding that one and attempting to use it. My suggestion is to remove the libstdc++ from your /usr/local and install/use the system ones.

Thanks for the feedback. In response, it looks like I am using the libstdc++ version from the base repo, and I see the 64-bit.

Code:
Installed Packages
libstdc++.x86_64                          4.4.7-16.el6                     @base
libstdc++-devel.x86_64                    4.4.7-16.el6                     @base
Available Packages
libstdc++.i686                            4.4.7-16.el6                     base 
libstdc++-devel.i686                      4.4.7-16.el6                     base 
libstdc++-docs.x86_64                     4.4.7-16.el6                     base

Regarding the file locations, you say that if I'm using the system's version of libstdc++ that it would be located in /usr/lib, but I didn't see it there. However it is in /usr/lib64.

Code:
[root@server2 ~]# ls -l /usr/lib/libstdc*
ls: cannot access /usr/lib/libstdc*: No such file or directory

[root@server2 ~]# ls -l /usr/lib64/libstdc*
lrwxrwxrwx 1 root root     19 Sep 24 18:03 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.13
-rwxr-xr-x 1 root root 989840 Jul 22  2015 /usr/lib64/libstdc++.so.6.0.13

Here are the versions that look to be installed in /usr/local/lib

Code:
[root@server2 ~]# ls -l /usr/local/lib/libstdc*
-rw-r--r-- 1 root root 9025112 Dec 14 20:09 /usr/local/lib/libstdc++.a
-rwxr-xr-x 1 root root     963 Dec 14 20:09 /usr/local/lib/libstdc++.la
lrwxrwxrwx 1 root root      19 Dec 14 20:09 /usr/local/lib/libstdc++.so -> libstdc++.so.6.0.18
lrwxrwxrwx 1 root root      19 Dec 14 20:09 /usr/local/lib/libstdc++.so.6 -> libstdc++.so.6.0.18
-rwxr-xr-x 1 root root 5149906 Dec 14 20:09 /usr/local/lib/libstdc++.so.6.0.18
-rw-r--r-- 1 root root    2311 Dec 14 20:09 /usr/local/lib/libstdc++.so.6.0.18-gdb.py

So do you have any idea why else it might be failing to build?
 
It is failing for exactly the reason I stated. The version you have installed (verified by your rpm commands) was only the 64-bit versions and are the ones you have in /usr/lib64. If you installed the 32-bit version too, you would see it in /usr/lib and your rpm command would not have the i686 versions under the "Available Packages". The only reason you would have them in /usr/local/lib is if you manually installed them there from source or some zip/tar archive. The version you have in your /usr/local/lib is also NOT the same bit-ness as you are trying to compile and that is why you are getting the errors. Try renaming your /usr/local/lib/liststdc++.a and /usr/local/lib/libstdc++.so to something else and try again.
 
Back
Top