在Mac OS X上的libnix.1.1.0.dylib上失败

时间:2016-02-05 12:42:49

标签: macos makefile dylib

我正在使用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$

我现在该如何进行构建?

1 个答案:

答案 0 :(得分:1)

您通过Homebrew安装的C ++库依赖项(即Boost / Yaml)是使用public class BuyAHouseInc { public void displayClient(String firstName, String surname, String address, int budget) { System.out.println("Client Name: " + firstName + " " + surname); System.out.println("Address: " + address); System.out.println("Budget: " + "€" + budget); } } 编译的。结果是:缺少与GCC编译时STL交互产生的一些符号。

因此,您必须使用clang++进行编译,例如像这样:

clang++

查看git存储库,作者甚至在其Travis CI configuration中启用了Mac OS X:

$ mkdir build
$ CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYP=Release ..
$ make

但他们也明确排除了Mac OS X上的GCC版本:

os:
  - linux
  - osx