I don't know why it crashes with Ubuntu, it should be a linker error. I suspect Ubuntu is doing something silly like providing libstdc++.so from GCC 9, which defines std::filesystem::path differently, and so is not compatible with C++17 code compiled using GCC 8.
The -lstdc++fs requirement for std::filesystem in GCC 8 is documented in several places:
https:/ /gcc.gnu. org/onlinedocs/ gcc-8.3. 0/libstdc+ +/manual/ manual/ using.html# manual. intro.using. flags /gcc.gnu. org/onlinedocs/ gcc-8.3. 0/libstdc+ +/manual/ manual/ status. html#status. iso.2017 /gcc.gnu. org/onlinedocs/ gcc-8.3. 0/libstdc+ +/manual/ manual/ using_dynamic_ or_shared. html#manual. intro.using. linkage. experimental
https:/
https:/
I don't know why it crashes with Ubuntu, it should be a linker error. I suspect Ubuntu is doing something silly like providing libstdc++.so from GCC 9, which defines std::filesystem ::path differently, and so is not compatible with C++17 code compiled using GCC 8.