Closed PikachuHy closed 2 years ago
What version of gcc/clang do you use? I've noticed that although std::filesystem
is supported by c++17, we also need to link to stdc++fs
when gcc version is under 9.1, and it is more complicated when using clang:
Prior to LLVM 9.0, libc++ provides the implementation of the filesystem library in a separate static library. Users of
<filesystem>
and<experimental/filesystem>
are required to link -lc++fs. Prior to libc++ 7.0, users of<experimental/filesystem>
were required to link libc++experimental.Starting with LLVM 9.0, support for
<filesystem>
is provided in the main library and nothing special is required to use<filesystem>
.
In a word, C++ is sucks (actually I don't like C++ at all :sweat_smile: )... So, maybe the best solution is to upgrade your compiler to the version that fully supports std::filesystem
.
I've noticed that although std::filesystem is supported by c++17, we also need to link to stdc++fs when gcc version is under 9.1
yeah, I've noticed that aswell, when playing around with packaging tinytex/unimath (https://build.opensuse.org/package/show/home:sp1rit:testing:notekit/tinytex)
and for Leap <= 15.4 / SLE 15 <= SP4 and RHEL (CentOS 8) I need to
%if 0%{?sle_version} && 0%{?sle_version} <= 150400 || 0%{?rhel}
sed "/tinytex_lib = library/adependencies: cpp.find_library('stdc++fs')," -i lib/meson.build
sed "s|#include <filesystem>|#include <experimental/filesystem>|" -i lib/otf/fontsense.cpp
sed "s/namespace fs = std::filesystem;/namespace fs = std::experimental::filesystem;/" -i lib/otf/fontsense.cpp
%endif
because they ship to old of an compiler.
The meson build manifest has had a workaround (that at least adds stdc++fs for gcc <= 9.1) for this in the current master. I didn't re-add that because I thought this to be irrelevant due to tinytex only supporting c++17.
I add some code to handle the problem. This change only affects macOS 10.14 or lower.
What version of gcc/clang do you use?
apple clang 11
➜ ~ clang -v
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
maybe the best solution is to upgrade your compiler to the version that fully supports std::filesystem.
For data backup, I will upgrade my MacOS version after June. 😢
closed by #110
This feature https://github.com/NanoMichael/cLaTeXMath/pull/99 use
std::filesystem
, whilestd::filesystem
is not available under macOS 10.15.my version macOS Mojave 10.14.6
due to this limitation, we need to add compatible code.
when
std::filesystem
is not available, we can fallback toboost::filesytem
.