Using boost :: filesystem doesn't work because of "_fchmodat" on mac

I want to use some features boost::filesystem

.

I can include boost/filesystem.hpp

and without any problem boost/filesystem/path.hpp

, but as soon as I use some specific functions like boost::filesystem::current_path()

or boost::filesystem::initial_path()

, I get the following compiler error:

Undefined symbols for architecture x86_64:
"_fchmodat", referenced from:
boost::filesystem::detail::permissions(boost::filesystem::path const&,
boost::filesystem::perms, boost::system::error_code*) in 
libboost_filesystem.a(operations.o)
ld: symbol(s) not found for architecture x86_64

      

I link with -lboost-system

and -lboost-filesystem

, and I use -std=c++0x

as compiler tag.

The boost version is 1.56.0 installed with homebrew.

Edit: I also tried using boost 1.57.0 but the error is the same.

+3


source to share


3 answers


Update: This will be fixed in the upcoming Boost 1.60. My fix has already been committed in the Boost.Filesystem for development . You can also apply patch to an earlier version of Boost.

Original answer: This is a bug in Boost.Filesystem and is tracked as Boost Ticket # 10591 . I faced the same problem and developed a patch which I linked to the bug.



It would be great if you could apply a patch to your copy of the Boost.Filesystem sources and tell if it will now work for you.

+1


source


This looks like a Boost bug to me. There should be no difference between linking statically and dynamically with these libraries. Someone posted a fix here but didn't explain what's going on.



Note that the issue persists in Boost 1.58, the current release with this entry.

0


source


Obviously, Qt Creator is linked to libboost-system.a

and libboost-filesystem.a

. But on Mac OS X, it must refer to libboost-system.dylib

and libboost-filesystem.dylib

.

I changed this in the .pro file by explicitly linking to .dylib

-libraries using LIBS += "path/libboost-system.dylib"

. This fixed the problem.

-1


source







All Articles