Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::filesystem header detected on macOS Mojave but not supported #150

Open
jwillikers opened this issue Feb 1, 2021 · 4 comments
Open

Comments

@jwillikers
Copy link
Contributor

The check for the std::filesystem header is not robust enough for older versions of macOS.
Versions of macOS up to Mojave may have the std::filesystem header while not having support for std::filesystem implemented in Apple's version of the standard C++ library.
This leads to a compiler error.
In particular, I am using MacPorts Clang 11 on macOS Mojave and version 3.6.0 of toml11.

@ToruNiina
Copy link
Owner

Wait, if I'm not mistaken, it lacks the implementation of filesystem related function in the dynamic library and, at the same time, both __cpp_lib_filesystem and __has_include(<filesystem>) return true?

Hmm, the only idea I have is to detect __APPLE__ and the clang version. But I don't know exactly which version leads the problem. Do you know whether this problem has been resolved with appleclang 12? I found that on travis CI, I only tested even older one. I need to have CIs for macos.

@jwillikers
Copy link
Contributor Author

jwillikers commented Feb 2, 2021

I think its related to the deployment target, i.e. the target version of macOS which ends up causing the error even though the defines are set.
I found this which describes the problem a bit more and links to a workaround here.

ToruNiina added a commit that referenced this issue Mar 25, 2021
As jwillikers pointed out in #150, there is a case where compiler
defines the corresponding feature test macro of <filesystem> but is
actually not available. The macro is a way to disable the feature
regardless of the status of feature test macro.
@ToruNiina
Copy link
Owner

I'm verry sorry for the late reply.
I have decided to add a macro to disable <filesystem> related features because of the following reasons.

  • The problem is limited in a special case and the required solution is also complicated (it depends on the implementation or build systems.)
  • I don't have an older macos machine so I couldn't do enough experiment on the solution and its capability

I'm sorry for the possibly-incomplete solution, but I think it is better to add a way to avoid the problem compared to nothing, so I added TOML11_DISABLE_STD_FILESYSTEM to disable the feature.

@monkeydom
Copy link

Ah nice. That sounds good to me too. Wanted to investigate if I could lower the macOS deployment target again, especially because in my use case the actual file IO is done on the other side of the library fence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants