2

I have one secret library built for CentOS 6.5 as a package. I can't build package for CentOS 7.4, make install fails on this line:

$ gcc -static -O3 -Wno-long-long -funroll-loops -Wall -g -DLINUX testlib.c -o test-lib -L. -llsh -lstdc++

/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lc

I tried to investigate this, for example:

$ ld -lstdc++ --verbose
...
attempt to open /usr/x86_64-redhat-linux/lib64/libstdc++.so failed
attempt to open /usr/x86_64-redhat-linux/lib64/libstdc++.a failed
attempt to open /usr/lib64/libstdc++.so failed
attempt to open /usr/lib64/libstdc++.a failed
attempt to open /usr/local/lib64/libstdc++.so failed
attempt to open /usr/local/lib64/libstdc++.a failed
attempt to open /lib64/libstdc++.so failed
attempt to open /lib64/libstdc++.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libstdc++.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libstdc++.a failed
attempt to open /usr/local/lib/libstdc++.so failed
attempt to open /usr/local/lib/libstdc++.a failed
attempt to open /lib/libstdc++.so failed
attempt to open /lib/libstdc++.a failed
attempt to open /usr/lib/libstdc++.so failed
attempt to open /usr/lib/libstdc++.a failed
ld: cannot find -lstdc++

I take a look at some paths and found this: /usr/lib/libstdc++.so.6 I created symlink (tried to cheat this) but go another error:

$ sudo ln -s /usr/lib/libstdc++.so.6.0.19 /usr/lib/libstdc++.so

$ ld -lstdc++ --verbose
...
attempt to open /usr/x86_64-redhat-linux/lib64/libstdc++.so failed                                                                                                                                                 
attempt to open /usr/x86_64-redhat-linux/lib64/libstdc++.a failed                                                                                                                                                  
attempt to open /usr/lib64/libstdc++.so failed                                                                                                                                                                     
attempt to open /usr/lib64/libstdc++.a failed            
attempt to open /usr/local/lib64/libstdc++.so failed                                                     
attempt to open /usr/local/lib64/libstdc++.a failed                            
attempt to open /lib64/libstdc++.so failed                                    
attempt to open /lib64/libstdc++.a failed           
attempt to open /usr/x86_64-redhat-linux/lib/libstdc++.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libstdc++.a failed                                          
attempt to open /usr/local/lib/libstdc++.so failed                                                       
attempt to open /usr/local/lib/libstdc++.a failed   
attempt to open /lib/libstdc++.so succeeded         
ld: skipping incompatible /lib/libstdc++.so when searching for -lstdc++                                                           
attempt to open /lib/libstdc++.a failed             
attempt to open /usr/lib/libstdc++.so succeeded                          
ld: skipping incompatible /usr/lib/libstdc++.so when searching for -lstdc++
attempt to open /usr/lib/libstdc++.a failed                                                              
ld: cannot find -lstdc++

CentOS 6.5:

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

CentOS 7.4:

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)

Please, help to fix this. Also, looking forward to get some advice how to investigate such issues.

3

Try to install:

  • libstdc++-static
  • glibc-static

Starting from Redhat 7/CentOS 7, static libraries was moved to an optional package. In CentOS 6 it was a part of:

  • libstdc++-devel
  • glibc-devel
1
  • It works, could you explain why, please? – Sergius Feb 27 '18 at 9:39
0

You probably need the devel version of the libraries, so install:

  • libstdc++-devel-4.8.5-16.el7
  • glibc-devel-2.17-196.el7
1
  • no, both packages installed and exactly the same versions – Sergius Feb 26 '18 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.