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

Boost Filesystem fails to copy between volumes. Consider replacing with std::filesystem. #100

Closed
jmpf opened this issue May 22, 2023 · 7 comments
Labels

Comments

@jmpf
Copy link
Contributor

jmpf commented May 22, 2023

Describe the bug
Boost Filesystem fails to copy between volumes. This is a known Boost bug: https://stackoverflow.com/questions/24209886/invalid-cross-device-link-error-with-boost-filesystem

To Reproduce
This may be specific to Boost 1.74.0 with /tmp and /home on different volumes:

jmpf@csu15256:~/Workspace/Chaste/build$ df /tmp/
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/nvme0n1p2 490617784 404090124  61532180  87% /
jmpf@csu15256:~/Workspace/Chaste/build$ df /home
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/nvme1n1p1 491133848 330703932 135408220  71% /home
ctest -VV -R TestFileFinder
...
13: Entering TestFindMatches
13: Passed
13: Entering TestCopying
13: 
13: /home/jmpf/Workspace/Chaste/global/test/TestFileFinder.hpp:362: Error: Test failed: 
13: Chaste error: ./global/src/FileFinder.cpp:332: boost::filesystem::copy_file: Invalid cross-device link: "/home/jmpf/Workspace/Chaste/global/test/TestFileFinder.hpp", "/tmp/jmpf/testoutput/TestFileFinder_TestCopying/TestFileFinder.hpp"
13: Failed
13: Entering TestDefaultConstructor
13: Passed

Workaround
Change environment variable to give a different output location

export CHASTE_TEST_OUTPUT="/home/jmpf/tmp-chaste/"

Expected behaviour
Test should pass

System
Please provide relevant details of your system, such as:

  • OS version: Ubuntu 22.04
  • Relevant Chaste dependency versions Boost: libboost-filesystem-dev:amd64 1.74.0.3ubuntu7
@jmpf jmpf added the bug label May 22, 2023
@jmpf jmpf changed the title Boost Filesystem fails to copy between volumes. Consider replacing with system::filesystem. Boost Filesystem fails to copy between volumes. Consider replacing with std::filesystem. May 23, 2023
@jmpf
Copy link
Contributor Author

jmpf commented May 23, 2023

We currently use -std=c++14 for compiling Chaste.

It's not clear if all the versions of C++ compilers in use will support the std::filesystem. Probably they all will but some may need #include <experimental/filesystem> rather than #include <filesystem> .

jmpf@csu15256:~$ cat temp.cc
#include <filesystem>
namespace fs=std::filesystem;

int main(){}
jmpf@csu15256:~$ g++ -std=c++17 temp.cc 
jmpf@csu15256:~$ g++ -std=c++14 temp.cc 
temp.cc:2:19: error: ‘filesystem’ is not a namespace-name
    2 | namespace fs=std::filesystem;
      |                   ^~~~~~~~~~

@mirams
Copy link
Member

mirams commented May 23, 2023

Any problem with going straight to compiling with c++17 ? I've forgotten if we have a 'policy' on that move @fcooper8472 ?

@jmpf
Copy link
Contributor Author

jmpf commented May 23, 2023

@mirams How many of our users are using C++ compilers that cannot handle C++17?

@mirams
Copy link
Member

mirams commented May 23, 2023

our what?

@jmpf
Copy link
Contributor Author

jmpf commented Jun 22, 2023

See also #107 -- There's now a compelling reason to switch on C++17 features.

jmpf added a commit that referenced this issue Jun 22, 2023
…ore similar to C++17 std::filesystem names)
jmpf added a commit that referenced this issue Jun 22, 2023
jmpf added a commit that referenced this issue Jun 22, 2023
@jmpf
Copy link
Contributor Author

jmpf commented Jun 22, 2023

Will make https://github.com/Chaste/Chaste/tree/issue_100 into pull request when we're green

@jmpf
Copy link
Contributor Author

jmpf commented Jun 27, 2023

Fixed by #115

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

No branches or pull requests

2 participants