Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu bazel编译报错 #438

Closed
cs1317 opened this issue Dec 9, 2024 · 5 comments
Closed

Ubuntu bazel编译报错 #438

cs1317 opened this issue Dec 9, 2024 · 5 comments

Comments

@cs1317
Copy link

cs1317 commented Dec 9, 2024

[ 95%] Built target leveldb
[ 97%] Building CXX object CMakeFiles/leveldbutil.dir/db/leveldbutil.cc.o
[100%] Linking CXX executable leveldbutil
/usr/bin/ld: CMakeFiles/leveldbutil.dir/db/leveldbutil.cc.o: undefined reference to symbol '_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc@@GLIBCXX_3.4.21'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/leveldbutil.dir/build.make:98: leveldbutil] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/leveldbutil.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-opt/bin/external/leveldb~/libleveldb_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-opt/bin/external/leveldb~/libleveldb_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-opt/bin/external/leveldb~/libleveldb_foreign_cc/CMake.log

Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 90.395s, Critical Path: 50.86s
INFO: 2938 processes: 1624 internal, 1314 linux-sandbox.
ERROR: Build did NOT complete successfully

@cs1317
Copy link
Author

cs1317 commented Dec 9, 2024

buntu22.04,gcc 11.4.0,g++ 11.4.0,bazel 7.4.1,bazelisk 1.20.0

@zimu-yuxi
Copy link

编译执行命令是什么?

@cs1317
Copy link
Author

cs1317 commented Dec 9, 2024

bazel build //yacl/...

@Jamie-Cui
Copy link
Collaborator

GLIBCXX_3.4.21 = GCC 5.1.0

see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html

请检查一下你系统里面的 gcc 版本以及对应的 libstdc++.so.6 版本,建议至少 GCC 11.1.0: libstdc++.so.6.0.29 这个版本的

@cs1317
Copy link
Author

cs1317 commented Dec 10, 2024

更新gcc之后,编译成功
sudo apt-get upgrade gcc

@cs1317 cs1317 closed this as completed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants