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

[Build failed] ld cannot find stdc++fs: ld: undefined reference to std::filesystem #578

Open
arthurkiller opened this issue Jun 5, 2024 · 4 comments

Comments

@arthurkiller
Copy link

build command:

cmake -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF -DENABLE_MULTILIB=ON -Wno-dev -DCMAKE_INSTALL_LIBDIR=/usr/lib/gcc/x86_64-linux-gnu/ ..

failed output log

[ 94%] Linking CXX executable wrapper
/usr/bin/ld: CMakeFiles/wrapper_a.dir/source/report/wrapper/RpcClients.cc.o: in function `wr::SupervisorClient::resolve(domain::Execution const&)':
[RpcClients.cc](http://rpcclients.cc/):(.text+0x6ad): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [RpcClients.cc](http://rpcclients.cc/):(.text+0x6cc): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [RpcClients.cc](http://rpcclients.cc/):(.text+0x7d5): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [RpcClients.cc](http://rpcclients.cc/):(.text+0x7f5): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [RpcClients.cc](http://rpcclients.cc/):(.text+0x92b): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/wrapper_a.dir/source/report/wrapper/RpcClients.cc.o:[RpcClients.cc](http://rpcclients.cc/):(.text+0x94a): more undefined references to `std::filesystem::__cxx11::path::_M_split_cmpts()' follow
/usr/bin/ld: CMakeFiles/wrapper_a.dir/source/report/wrapper/Application.cc.o: in function `wr::Application::command(int, char const**, char const**) const':
[Application.cc](http://application.cc/):(.text+0x9ccf): undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
/usr/bin/ld: [Application.cc](http://application.cc/):(.text+0xa140): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Application.cc](http://application.cc/):(.text+0xa15f): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Application.cc](http://application.cc/):(.text+0xa255): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Application.cc](http://application.cc/):(.text+0xa275): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/wrapper_a.dir/source/report/wrapper/Application.cc.o: in function `rust::Result<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, domain::Execution>, std::runtime_error> rust::Result<domain::Execution, std::runtime_error>::map<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, domain::Execution> >(std::function<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, domain::Execution> (domain::Execution const&)> const&) const':
[Application.cc](http://application.cc/):(.text._ZNK4rust6ResultIN6domain9ExecutionESt13runtime_errorE3mapISt5tupleIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES2_EEEENS0_IT_S3_EERKSt8functionIFSE_RKS2_EE[_ZNK4rust6ResultIN6domain9ExecutionESt13runtime_errorE3mapISt5tupleIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES2_EEEENS0_IT_S3_EERKSt8functionIFSE_RKS2_EE]+0xc4): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: CMakeFiles/wrapper_a.dir/source/report/wrapper/Application.cc.o:[Application.cc](http://application.cc/):(.text._ZNK4rust6ResultIN6domain9ExecutionESt13runtime_errorE3mapISt5tupleIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES2_EEEENS0_IT_S3_EERKSt8functionIFSE_RKS2_EE[_ZNK4rust6ResultIN6domain9ExecutionESt13runtime_errorE3mapISt5tupleIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES2_EEEENS0_IT_S3_EERKSt8functionIFSE_RKS2_EE]+0xdd): more undefined references to `std::filesystem::__cxx11::path::_M_split_cmpts()' follow
/usr/bin/ld: CMakeFiles/domain_a.dir/source/Domain.cc.o: in function `domain::operator==(domain::Execution const&, domain::Execution const&)':
[Domain.cc](http://domain.cc/):(.text+0x15): undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
/usr/bin/ld: [Domain.cc](http://domain.cc/):(.text+0x9b): undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
/usr/bin/ld: CMakeFiles/domain_a.dir/source/Convert.cc.o: in function `domain::from(rpc::Execution const&)':
[Convert.cc](http://convert.cc/):(.text+0x142): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Convert.cc](http://convert.cc/):(.text+0x242): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: ../libsys/CMakeFiles/sys_a.dir/source/Process.cc.o: in function `sys::Process::Builder::Builder(std::filesystem::__cxx11::path, bool)':
[Process.cc](http://process.cc/):(.text+0x436): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Process.cc](http://process.cc/):(.text+0x44d): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: ../libsys/CMakeFiles/sys_a.dir/source/Process.cc.o: in function `(anonymous namespace)::spawn_process_with_retry(int (*)(int*, char const*, posix_spawn_file_actions_t const*, posix_spawnattr_t const*, char* const*, char* const*), std::filesystem::__cxx11::path const&, std::__cxx11::list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, bool)':
[Process.cc](http://process.cc/):(.text+0x1e77): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: ../libsys/CMakeFiles/sys_a.dir/source/Process.cc.o:[Process.cc](http://process.cc/):(.text+0x2634): more undefined references to `std::filesystem::__cxx11::path::_M_split_cmpts()' follow
/usr/bin/ld: ../libsys/CMakeFiles/sys_a.dir/source/Path.cc.o: in function `sys::path::get_cwd[abi:cxx11]()':
[Path.cc](http://path.cc/):(.text+0x4d4): undefined reference to `std::filesystem::current_path[abi:cxx11](std::error_code&)'
/usr/bin/ld: [Path.cc](http://path.cc/):(.text+0x66f): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Path.cc](http://path.cc/):(.text+0x688): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Path.cc](http://path.cc/):(.text+0x727): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Path.cc](http://path.cc/):(.text+0x746): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: [Path.cc](http://path.cc/):(.text+0x7c3): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: ../libsys/CMakeFiles/sys_a.dir/source/Path.cc.o:[Path.cc](http://path.cc/):(.text+0x7e2): more undefined references to `std::filesystem::__cxx11::path::_M_split_cmpts()' follow
collect2: error: ld returned 1 exit status
make[5]: *** [intercept/CMakeFiles/wrapper.dir/build.make:196: intercept/wrapper] Error 1
make[4]: *** [CMakeFiles/Makefile2:481: intercept/CMakeFiles/wrapper.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
[ 94%] Built target citnames_a
make[3]: *** [Makefile:136: all] Error 2
make[2]: *** [CMakeFiles/BearSource.dir/build.make:87: subprojects/Stamp/BearSource/BearSource-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:174: CMakeFiles/BearSource.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

question: how can I fix this issue?

@rizsotto
Copy link
Owner

rizsotto commented Jun 8, 2024

Well, this is not enough info to help you out. Have you checked the INSTALL.md what tools you require?

My guess is that you don't have a recent compiler.

@arthurkiller
Copy link
Author

arthurkiller commented Jun 9, 2024 via email

@arthurkiller
Copy link
Author

arthurkiller commented Jun 9, 2024 via email

@liyakai
Copy link

liyakai commented Jun 25, 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