Closed
Description
Describe the bug
Under Cygwin filesystem does not compile.
For doxygen an easy fix was possible by changing the line
#elif defined(__linux__)
into
#elif defined(__linux__) || defined(__CYGWIN__)
though when applying this fix to the official repository and running make
to check the tests we get:
Scanning dependencies of target filesystem_test
[ 4%] Building CXX object test/CMakeFiles/filesystem_test.dir/filesystem_test.cpp.o
In file included from /cygdrive/e/Programs/github_repositories/forked/filesystem/test/filesystem_test.cpp:62:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In function ‘bool ghc::filesystem::detail::equals_simple_insensitive(const value_type*, const value_type*)’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:1794:19: error: ‘::strcasecmp’ has not been declared; did you mean ‘strncmp’?
1794 | return 0 == ::strcasecmp(str1, str2);
| ^~~~~~~~~~
| strncmp
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In function ‘void ghc::filesystem::detail::create_symlink(const ghc::filesystem::path&, const ghc::filesystem::path&, bool, std::error_code&)’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:1915:11: error: ‘::symlink’ has not been declared; did you mean ‘ghc::filesystem::file_type::symlink’?
1915 | if (::symlink(target_name.c_str(), new_symlink.c_str()) != 0) {
| ^~~~~~~
| ghc::filesystem::file_type::symlink
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:687:5: note: ‘ghc::filesystem::file_type::symlink’ declared here
687 | symlink,
| ^~~~~~~
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In function ‘ghc::filesystem::path ghc::filesystem::detail::resolveSymlink(const ghc::filesystem::path&, std::error_code&)’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:2056:21: error: ‘::readlink’ has not been declared
2056 | auto rc = ::readlink(p.c_str(), buffer.data(), buffer.size());
| ^~~~~~~~
In file included from /cygdrive/e/Programs/github_repositories/forked/filesystem/test/filesystem_test.cpp:62:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In function ‘void ghc::filesystem::last_write_time(const ghc::filesystem::path&, ghc::filesystem::file_time_type, std::error_code&)’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:4460:11: error: ‘::utimensat’ has not been declared; did you mean ‘utimes’?
4460 | if (::utimensat(AT_FDCWD, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) {
| ^~~~~~~~~
| utimes
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:4460:21: error: ‘AT_FDCWD’ was not declared in this scope
4460 | if (::utimensat(AT_FDCWD, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) {
| ^~~~~~~~
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:4460:49: error: ‘AT_SYMLINK_NOFOLLOW’ was not declared in this scope
4460 | if (::utimensat(AT_FDCWD, p.c_str(), times, AT_SYMLINK_NOFOLLOW) != 0) {
| ^~~~~~~~~~~~~~~~~~~
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In function ‘void ghc::filesystem::resize_file(const ghc::filesystem::path&, uintmax_t, std::error_code&)’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:4767:11: error: ‘::truncate’ has not been declared
4767 | if (::truncate(p.c_str(), static_cast<off_t>(size)) != 0) {
| ^~~~~~~~
In file included from /cygdrive/e/Programs/github_repositories/forked/filesystem/test/filesystem_test.cpp:62:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp: In instantiation of ‘std::string ghc::filesystem::detail::systemErrorText(ErrorNumber) [with ErrorNumber = int; std::string = std::basic_string<char>]’:
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:3467:66: required from here
/cygdrive/e/Programs/github_repositories/forked/filesystem/include/ghc/filesystem.hpp:1840:39: error: ‘strerror_r’ was not declared in this scope; did you mean ‘_strerror_r’?
1840 | return strerror_adapter(strerror_r(code ? code : errno, buffer, sizeof(buffer)), buffer);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| _strerror_r
make[2]: *** [test/CMakeFiles/filesystem_test.dir/build.make:83: test/CMakeFiles/filesystem_test.dir/filesystem_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:153: test/CMakeFiles/filesystem_test.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
To Reproduce
- change the menioned line
- run the tests as indicated in the README
Expected behavior
Official support for Cygwin
Additional context
Used GCC version: gcc (GCC) 10.2.0