haampie/libtree

Link failure on GCC8 (missing std::filesystem symbols)

Closed this issue ยท 4 comments

Regrettably, my second attempt to install libtree (after #31 was fixed) also failed (gcc 8.3, rhel7):

/projects/spack/lib/spack/env/gcc/g++ -O2 -g -DNDEBUG -rdynamic CMakeFiles/libtree.dir/src/main.cpp.o CMakeFiles/libtree_lib.dir/src/deploy.cpp.o CMakeFiles/libtree_lib.dir/src/deps.cpp.o CMakeFiles/libtree_lib.dir/src/elf.cpp.o CMakeFiles/libtree_lib.dir/src/exec.cpp.o CMakeFiles/libtree_lib.dir/src/glob.cpp.o CMakeFiles/libtree_lib.dir/src/ld.cpp.o -o libtree  -Wl,-rpath,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
CMakeFiles/libtree.dir/src/main.cpp.o: In function `std::filesystem::__cxx11::path::path<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::filesystem::__cxx11::path>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::filesystem::__cxx11::path::format)':
/projects/spack/opt/spack/gcc-4.8.5/gcc/wsnp2ss/include/c++/8.3.0/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'

spack-build-out.txt

It looks like you may need to explicitly link to c++17fs, see discussion on https://gitlab.kitware.com/cmake/cmake/-/issues/17834 which makes it pretty clear that only GCC<=8 needs this special target link ๐Ÿ™„

I think I should just rewrite libtree in C lol

Sounds like too much work! We should be using these modern capabilities, it's just that so many platforms lag behind a bit...

I'm happy to either mark as a conflict or submit a patch that will apply for older GCC versions. I don't need need it but this seems like a cool utility and I wanted to try it out when the need arose :)

There is a static executable too under releases: https://github.com/haampie/libtree/releases/tag/v2.0.0

Closing this since the C rewrite is a thing now