symqemu icon indicating copy to clipboard operation
symqemu copied to clipboard

Cannot compile with gcc-10/9

Open SweetVishnya opened this issue 4 years ago • 5 comments

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?

SweetVishnya avatar Jan 26 '21 13:01 SweetVishnya

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.

sebastianpoeplau avatar Jan 26 '21 22:01 sebastianpoeplau

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).

sebastianpoeplau avatar Jan 26 '21 22:01 sebastianpoeplau

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.

SweetVishnya avatar Jan 27 '21 08:01 SweetVishnya

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.

This worked fine for me. Can it be automatically supported in CMake? Something like find_library(STD_CPP_FS stdc++fs)

SweetVishnya avatar Jan 27 '21 14:01 SweetVishnya

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.

sebastianpoeplau avatar Jan 29 '21 17:01 sebastianpoeplau