filesystem handling does not compile on MacOS
With XCode 13.0, file_writer.cpp fails to compile:
[ 62%] Building CXX object CMakeFiles/caosdb.dir/src/caosdb/file_transmission/file_writer.cpp.o
/Users/test1/.conan/data/caosdb/0.0.17/_/_/build/cab0957096336c988b080beac15e667ceb568f49/src/caosdb/file_transmission/file_writer.cpp:62:11: error: no matching member function for call to 'open'
stream_.open(filename_, std::ios::binary | std::ios::trunc);
~~~~~~~~^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:1387:10: note: candidate function not viable: no known conversion from 'boost::filesystem::path' to 'const char *' for 1st argument
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:1391:10: note: candidate function not viable: no known conversion from 'boost::filesystem::path' to 'const std::string' (aka 'const basic_string<char>') for 1st argument
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/fstream:1395:10: note: candidate function not viable: no known conversion from 'boost::filesystem::path' to 'const filesystem::path' for 1st argument
void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
^
1 error generated.
make[3]: *** [CMakeFiles/caosdb.dir/src/caosdb/file_transmission/file_writer.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/caosdb.dir/all] Error 2
make[1]: *** [all] Error 2
file_writer.h declares:
std::ofstream stream_;
boost::filesystem::path filename_;
It seems that stream_.open(filename_, std::ios::binary | std::ios::trunc);
does not work, since filename_
does not seamlessly translate to something string-like on MacOS.
What I did
make conan
What should happen
-
libcaosdb should compile on macos. -
libcaosdb should link on macos.
Edited by Daniel Hornung