CentOS 6.5용으로 패키지로 구축된 비밀 저장소가 있습니다. CentOS 7.4용 패키지를 빌드할 수 없습니다. 다음 줄에서 make install이 실패합니다.
$ 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
나는 이것을 조사해 보았습니다. 예를 들면 다음과 같습니다.
$ 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++
일부 경로를 살펴본 후 다음을 발견했습니다: /usr/lib/libstdc++.so.6 심볼릭 링크를 만들었지만(이것을 속이려고 했습니다) 또 다른 오류가 발생했습니다.
$ 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)
이 문제를 해결하는 데 도움을 주세요. 또한, 그러한 문제를 조사하는 방법에 대한 조언을 기대하고 있습니다.
답변1
설치해 보세요:
- libstdc++-정적
- glibc 정적
Redhat 7/CentOS 7부터 정적 라이브러리가 선택적 패키지로 이동되었습니다. CentOS 6에서는 다음의 일부입니다.
- libstdc++-개발
- glibc 개발
답변2
devel
라이브러리 버전이 필요할 수 있으므로 다음 을 설치하십시오.
libstdc++-devel-4.8.5-16.el7
glibc-devel-2.17-196.el7