cpp-io2d/P0267_RefImpl

Fails to build tests on Debian Buster

khernyo opened this issue · 1 comments

Running cmake . && make VERBOSE=1 results in the following error:

...
/usr/lib/ccache/c++     CMakeFiles/tests.dir/main.cpp.o CMakeFiles/tests.dir/background_paint.cpp.o CMakeFiles/tests.dir/rectangle_stroke.cpp.o CMakeFiles/tests.dir/stroke_width.cpp.o CMakeFiles/tests.dir/stroke_dashes.cpp.o CMakeFiles/tests.dir/linear_gradient.cpp.o CMakeFiles/tests.dir/radial_gradient.cpp.o CMakeFiles/tests.dir/surface_brush.cpp.o CMakeFiles/tests.dir/mask.cpp.o CMakeFiles/tests.dir/color.cpp.o CMakeFiles/tests.dir/blending.cpp.o CMakeFiles/tests.dir/comparison.cpp.o CMakeFiles/tests.dir/image_io.cpp.o CMakeFiles/tests.dir/image_format.cpp.o CMakeFiles/tests.dir/frontend_semantics.cpp.o  -o tests /usr/lib/x86_64-linux-gnu/libpng.so ../P0267_RefImpl/cairo/xlib/libio2d_cairo_xlib.a ../P0267_RefImpl/cairo/libio2d_cairo.a ../P0267_RefImpl/libio2d_core.a /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/libGraphicsMagick.so /usr/lib/x86_64-linux-gnu/libpixman-1.so /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libbz2.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/liblzma.so /usr/lib/x86_64-linux-gnu/libX11.so 
/usr/bin/ld: CMakeFiles/tests.dir/main.cpp.o: in function `main':
main.cpp:(.text+0x2241a): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'
/usr/bin/ld: main.cpp:(.text+0x22429): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: CMakeFiles/tests.dir/main.cpp.o: in function `std::filesystem::__cxx11::path::path<char*, std::filesystem::__cxx11::path>(char* const&, std::filesystem::__cxx11::path::format)':
main.cpp:(.text._ZNSt10filesystem7__cxx114pathC2IPcS1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC5IPcS1_EERKT_NS1_6formatE]+0x64): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
collect2: error: ld returned 1 exit status
make[2]: *** [P0267_RefImpl/Tests/CMakeFiles/tests.dir/build.make:311: P0267_RefImpl/Tests/tests] Error 1
...

Appending -lstdc++fs to the compile command solves the issue for me:

/usr/lib/ccache/c++     CMakeFiles/tests.dir/main.cpp.o CMakeFiles/tests.dir/background_paint.cpp.o CMakeFiles/tests.dir/rectangle_stroke.cpp.o CMakeFiles/tests.dir/stroke_width.cpp.o CMakeFiles/tests.dir/stroke_dashes.cpp.o CMakeFiles/tests.dir/linear_gradient.cpp.o CMakeFiles/tests.dir/radial_gradient.cpp.o CMakeFiles/tests.dir/surface_brush.cpp.o CMakeFiles/tests.dir/mask.cpp.o CMakeFiles/tests.dir/color.cpp.o CMakeFiles/tests.dir/blending.cpp.o CMakeFiles/tests.dir/comparison.cpp.o CMakeFiles/tests.dir/image_io.cpp.o CMakeFiles/tests.dir/image_format.cpp.o CMakeFiles/tests.dir/frontend_semantics.cpp.o  -o tests /usr/lib/x86_64-linux-gnu/libpng.so ../P0267_RefImpl/cairo/xlib/libio2d_cairo_xlib.a ../P0267_RefImpl/cairo/libio2d_cairo.a ../P0267_RefImpl/libio2d_core.a /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/libGraphicsMagick.so /usr/lib/x86_64-linux-gnu/libpixman-1.so /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libbz2.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/liblzma.so /usr/lib/x86_64-linux-gnu/libX11.so -lstdc++fs

CMake version: 3.13.4
GCC version: 8.3.0

had this same issue when I tried to build io2d in my Ubuntu 18.04 machine and this solution works.