spoutn1k/mcmap

Yet Another Filesystem Issue (not due to gcc version, I think!)

jthulhu opened this issue · 3 comments

DL;DR: gcc complaining when I try to compile:
undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' and undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'.

Long story:
Tried to compile mcmap, gcc fails complaining about filesystem, I look for the solution, turns out my distro is outdated (new version came out), I dist-upgrade, everything works fine, no more errors like "filesystem not found" or whatever, just like it is mentioned in the README.
So, I try to compile again, with the latest version of gcc (8.3.0-6), working well, compiles one, two, three files, and BAM:

$ make -j
[...]
/usr/bin/ld: main.default.o: in function `Settings::WorldOptions::WorldOptions()':
main.cpp:(.text._ZN8Settings12WorldOptionsC2Ev[_ZN8Settings12WorldOptionsC5Ev]+0x1ae): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
[...]
/usr/bin/ld: settings.cpp:(.text+0x23e8): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
[...]
$

(and I've skipped many).

Tech spechs:
I'm running under a vanilla Debian Buster (currently stable), gcc 8.3.0-6, NBT19133 branch (I pulled right before trying to compile), full stderr output.

Thanks for bringing that up. I replicated the error in a Debian 10.4 container using your gcc version and fixed it using -lstdc++fs in the LDFLAGS. I wanted to use the latest gcc features but many distros use LTS versions, so here we are.

Please add the flag to your Makefile; I'll roll out the change once I have some time to check it does not break anything else.

Changes merged in commit #3982939; please test on your side and close the issue if resolved.

Worked like a charm!