Make 在 libnix.1.1.0.dylib Mac OS X 上失败
Make fails on libnix.1.1.0.dylib on Mac OS X
我正在使用 from the github repo 从源代码构建 NIX。
一切都按照说明进行,但最终在 make
.
失败了
我得到的错误是
caffeinated:nix sudoankit$ make all
[ 1%] Linking CXX shared library libnix.dylib
Undefined symbols for architecture x86_64:
"YAML::detail::node_data::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in AttributesFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DataArrayFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DimensionFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in Directory.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DirectoryWithAttributes.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in EntityFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in FeatureFS.cpp.o
...
"YAML::LoadFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
nix::file::AttributesFS::open_or_create() in AttributesFS.cpp.o
"YAML::operator<<(std::basic_ostream<char, std::char_traits<char> >&, YAML::Node const&)", referenced from:
nix::file::AttributesFS::flush() in AttributesFS.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()", referenced from:
bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()", referenced from:
bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) in util.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [libnix.1.1.0.dylib] Error 1
make[1]: *** [CMakeFiles/nix.dir/all] Error 2
make: *** [all] Error 2
caffeinated:nix sudoankit$
我现在应该如何构建它?
您通过 Homebrew 安装的 C++ 库依赖项(即 Boost/Yaml)是使用 clang++
编译的。结果是:使用 GCC 编译时,STL 交互产生的一些符号丢失。
因此,您必须使用 clang++
进行编译,例如像这样:
$ mkdir build
$ CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYP=Release ..
$ make
查看 git 存储库,作者甚至在 Travis CI configuration:
中启用了 Mac OS X
os:
- linux
- osx
但他们也明确排除了基于 Mac OS X:
的 GCC 构建
matrix:
exclude:
- os: osx
compiler: gcc
我正在使用 from the github repo 从源代码构建 NIX。
一切都按照说明进行,但最终在 make
.
我得到的错误是
caffeinated:nix sudoankit$ make all
[ 1%] Linking CXX shared library libnix.dylib
Undefined symbols for architecture x86_64:
"YAML::detail::node_data::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in AttributesFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DataArrayFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DimensionFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in Directory.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in DirectoryWithAttributes.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in EntityFS.cpp.o
YAML::detail::node_ref::set_scalar(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in FeatureFS.cpp.o
...
"YAML::LoadFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
nix::file::AttributesFS::open_or_create() in AttributesFS.cpp.o
"YAML::operator<<(std::basic_ostream<char, std::char_traits<char> >&, YAML::Node const&)", referenced from:
nix::file::AttributesFS::flush() in AttributesFS.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()", referenced from:
bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) in util.cpp.o
"boost::re_detail_106000::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()", referenced from:
bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags) in util.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [libnix.1.1.0.dylib] Error 1
make[1]: *** [CMakeFiles/nix.dir/all] Error 2
make: *** [all] Error 2
caffeinated:nix sudoankit$
我现在应该如何构建它?
您通过 Homebrew 安装的 C++ 库依赖项(即 Boost/Yaml)是使用 clang++
编译的。结果是:使用 GCC 编译时,STL 交互产生的一些符号丢失。
因此,您必须使用 clang++
进行编译,例如像这样:
$ mkdir build
$ CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYP=Release ..
$ make
查看 git 存储库,作者甚至在 Travis CI configuration:
中启用了 Mac OS Xos:
- linux
- osx
但他们也明确排除了基于 Mac OS X:
的 GCC 构建matrix:
exclude:
- os: osx
compiler: gcc