You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm already aware of the c++17 requirements but there seems to be a gray area where the std::filesystem library is ACTUALLY included in the c++ version. I had cmake print out the actual compiler command for me and I wasn't seeing stdc++17 or stdc++fs anywhere. Anytime I tried to build the examples or a test project using this I couldn't get it to figure out how to link in file system. I'm putting this here for alter in case anyone else has the same problem as me. I spent WAY too long trying to figure out how to do this properly in the cmake flow, and I'm too stupid to figure that out. I ended up just hacking the cmakefiles to get it to build.
From what I can tell there are a bunch of other issues related to the filesystem flow in this repo so maybe this will help answer some stuff. I'm not sure what the FindFilesystem.cmake file is for either, I couldn't tell when it's supposed to run but I don't think it was.
mkdir build
cd build
cmake .. --install-prefix=/home/$USER/matplot_bin -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2"
make
# or any cmake args really, it seems pretty reproducible with my system, no matter what explatives I yell at my machine it won't use the correct CXX version/library
cmake .. -DCMAKE_RULE_MESSAGES:BOOL=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
Output
../../../source/matplot/libmatplot.a(gnuplot.cpp.o): In function `matplot::backend::gnuplot::output(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&)':gnuplot.cpp:(.text+0x1995): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'gnuplot.cpp:(.text+0x19a4): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'gnuplot.cpp:(.text+0x1aa1): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'gnuplot.cpp:(.text+0x1aa9): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'gnuplot.cpp:(.text+0x1ae0): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'gnuplot.cpp:(.text+0x1ae8): undefined reference to `std::filesystem::create_directory(std::filesystem::__cxx11::path const&)'gnuplot.cpp:(.text+0x1afd): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'gnuplot.cpp:(.text+0x1b05): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'gnuplot.cpp:(.text+0x1b41): undefined reference to `std::filesystem::__cxx11::path::parent_path() const'../../../source/matplot/libmatplot.a(gnuplot.cpp.o): In function `matplot::backend::gnuplot::output(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':gnuplot.cpp:(.text+0x3d79): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'../../../source/matplot/libmatplot.a(gnuplot.cpp.o): In function `std::filesystem::__cxx11::path::extension() const':gnuplot.cpp:(.text._ZNKSt10filesystem7__cxx114path9extensionEv[_ZNKSt10filesystem7__cxx114path9extensionEv]+0x11): undefined reference to `std::filesystem::__cxx11::path::_M_find_extension() const'gnuplot.cpp:(.text._ZNKSt10filesystem7__cxx114path9extensionEv[_ZNKSt10filesystem7__cxx114path9extensionEv]+0xae): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'collect2: error: ld returned 1 exit statusmake[2]: *** [examples/line_plot/plot/CMakeFiles/example_plot_1.dir/build.make:105: examples/line_plot/plot/example_plot_1] Error 1make[1]: *** [CMakeFiles/Makefile2:3174: examples/line_plot/plot/CMakeFiles/example_plot_1.dir/all] Error 2make: *** [Makefile:156: all] Error 2
Platform
cross-platform issue - linux
cross-platform issue - windows
cross-platform issue - macos
Environment Details:
OS: Red Hat Enterprise Linux
OS Version: 8.10
Compiler: gcc/g++
Compiler version: g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-21)
Additional context
I'm attempting to build and install
The text was updated successfully, but these errors were encountered:
When this library was written, few compilers had support for <filesystem>, so we needed lots of workarounds. Nowadays, this needs to be refactored, and all the targets need now is target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17).
I forgot to include my CMakeLists.txt above. I tried the install method first, but flailed around with some other flows trying to find the right CMake parameters. In the "submodule flow" I had this but the target_compile_features parameter didn't appear to apply to project as a whole. I'm sure it's my CMake ignorance though. I pulled the line plot example code and tried to build it
Sorry. I wasn't clear. I was talking about what matplot needs to do to solve the problem internally. cxx_std_17 in your project probably won't solve the problem.
Bug category
Describe the bug
I'm already aware of the c++17 requirements but there seems to be a gray area where the std::filesystem library is ACTUALLY included in the c++ version. I had cmake print out the actual compiler command for me and I wasn't seeing stdc++17 or stdc++fs anywhere. Anytime I tried to build the examples or a test project using this I couldn't get it to figure out how to link in file system. I'm putting this here for alter in case anyone else has the same problem as me. I spent WAY too long trying to figure out how to do this properly in the cmake flow, and I'm too stupid to figure that out. I ended up just hacking the cmakefiles to get it to build.
From what I can tell there are a bunch of other issues related to the filesystem flow in this repo so maybe this will help answer some stuff. I'm not sure what the
FindFilesystem.cmake
file is for either, I couldn't tell when it's supposed to run but I don't think it was.Steps to Reproduce
Output
Platform
Environment Details:
Additional context
I'm attempting to build and install
The text was updated successfully, but these errors were encountered: