symqemu
symqemu copied to clipboard
Cannot compile with gcc-10/9
Hi!
I am trying to compile with gcc-10 and get the following error:
/home/vishnya/fwork/symcc/build/SymRuntime-prefix/src/SymRuntime-build/libSymRuntime.so: undefined reference to `std::experimental::filesystem::v1::status(std::experimental::filesystem::v1::__cxx11::path const&)'
/home/vishnya/fwork/symcc/build/SymRuntime-prefix/src/SymRuntime-build/libSymRuntime.so: undefined reference to `std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
What toolchain do you use?
Hi @SweetVishnya! Sorry, support for std::filesystem across different compilers and versions is a pain. Your issue is most likely related to this part of the build system. Could you try using target_link_libraries(SymRuntime c++experimental)? It seems that for some reason we can't find the <filesystem> include on your system and therefore fall back to the old experimental version.
And to answer your question regarding my toolchain, I developed SymCC and SymQEMU on Arch with their default GCC and stdlibc++, and I've also compiled it on Debian 10, Fedora 33, Ubuntu 16.04 and Ubuntu 18.04, using the default toolchain everywhere except on Ubuntu 16.04 (I believe I installed a more recent compiler there).
I was trying to build with different sorts of compilers on ubuntu 18.04 (including the default toolchain). I will try to modify the build system as you suggested. As soon as we get a working Dockerfile, we can experiment with different distros.
Hi @SweetVishnya! Sorry, support for
std::filesystemacross different compilers and versions is a pain. Your issue is most likely related to this part of the build system. Could you try usingtarget_link_libraries(SymRuntime c++experimental)? It seems that for some reason we can't find the<filesystem>include on your system and therefore fall back to the old experimental version.
This worked fine for me. Can it be automatically supported in CMake? Something like find_library(STD_CPP_FS stdc++fs)
Awesome, glad that it worked for you. I'm not sure how easy it is to come up with a generic solution - there is a long discussion of this very issue in the CMake issue tracker, and as far as I can tell they haven't come up with a universally working setup yet.