Compiling ACE on MacOS

Hi all (esp. @sweaglesw) ,

Apologies if this has an answer in the ether somewhere, but I’m trying to get ACE to compile on macOS (for this, currently on 10.14). I’m not super up on C compilation, but I have learned a lot in the last couple days! However, I have gone long passed 10 minutes with this problem.

So far, I have made progress (I think) on the compilation, and it seems almost everything is happy and most of the files compiled. However, I’m getting a Undefined symbols for architecture x86_64 error for boost, and so I’m wondering if I’m using the wrong version or something?

Progress/steps:

  1. librepp is compiling fine and in /usr/local/lib/
  2. I commented in the MacOSX.config includes for both /Makefile and /post/Makefile
  3. I’m using gcc 9.3.0 and I had to remove -fnested-functions from MacOSX.config, but it seems to work without?
  4. libboost_regex.a is in /usr/local/lib - I’m getting the version Homebrew is giving me, which seems to be 1.72.0

Any advice on moving beyond the boost problem? Anything else I need to worry about?

Full error response:

bash-3.2$ make
gcc -Wl,-no_pie  -g -O6 -fomit-frame-pointer -funsigned-char -falign-loops=32 -funroll-loops  -m64 -DMACOSX_GCC  -I post/ -DPOST  lexicon.o chart.o dag.o type.o tdl.o rule.o morpho.o roots.o freeze.o unify.o qc.o agenda.o net.o glb.o semindex.o hash.o mrs.o mrsvpm.o mrsdg.o itsdb.o pack.o unpack.o maxent.o generate.o parse.o lui.o conf.o preprocessor.o treebank-control.o token.o lattice-mapping.o lexical-parse.o generalize.o transfer.o transfer-result.o edge-vectors.o forest-out.o exunpack.o semilattice.o rebuild-th.o compile-qc.o idiom.o yy.o lisp.o tnt.o tree.o reconstruct.o arbiter.o profiler.o qcparse.o rule-use-model.o ubertag.o dublin.o licenses.o dag-provenance.o semi.o timeout.o csaw/csaw.o csaw/naive.o csaw/normalize.o main.o post/post.o timer.o linenoise.o lui-cli.o -o ace -lutil /usr/local/lib/librepp.a  -lpthread -lm /usr/local/lib/libboost_regex.a -lstdc++ -ldl
rm -f libace.so
gcc -shared pic/lexicon.o pic/chart.o pic/dag.o pic/type.o pic/tdl.o pic/rule.o pic/morpho.o pic/roots.o pic/freeze.o pic/unify.o pic/qc.o pic/agenda.o pic/net.o pic/glb.o pic/semindex.o pic/hash.o pic/mrs.o pic/mrsvpm.o pic/mrsdg.o pic/itsdb.o pic/pack.o pic/unpack.o pic/maxent.o pic/generate.o pic/parse.o pic/lui.o pic/conf.o pic/preprocessor.o pic/treebank-control.o pic/token.o pic/lattice-mapping.o pic/lexical-parse.o pic/generalize.o pic/transfer.o pic/transfer-result.o pic/edge-vectors.o pic/forest-out.o pic/exunpack.o pic/semilattice.o pic/rebuild-th.o pic/compile-qc.o pic/idiom.o pic/yy.o pic/lisp.o pic/tnt.o pic/tree.o pic/reconstruct.o pic/arbiter.o pic/profiler.o pic/qcparse.o pic/rule-use-model.o pic/ubertag.o pic/dublin.o pic/licenses.o pic/dag-provenance.o pic/semi.o pic/timeout.o pic/csaw/csaw.o pic/csaw/naive.o pic/csaw/normalize.o pic/libace.o pic/timer.o post/post.o -Wl,-soname,libace.so -o libace.so -lrepp  -ldl -lutil
ld: unknown option: -soname
collect2: error: ld returned 1 exit status
make: *** [libace.so] Error 1
make: *** Waiting for unfinished jobs....
Undefined symbols for architecture x86_64:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
      boost::re_detail_107200::lookup_default_collate_name(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libboost_regex.a(regex_traits_defaults.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(wchar_t const*) const", referenced from:
      wchar_t* boost::re_detail_107200::re_is_set_member<wchar_t*, wchar_t, boost::c_regex_traits<wchar_t>, unsigned int>(wchar_t*, wchar_t*, boost::re_detail_107200::re_set_long<unsigned int> const*, boost::re_detail_107200::regex_data<wchar_t, boost::c_regex_traits<wchar_t> > const&, bool) in libboost_regex.a(wide_posix_api.o)
      wchar_t const* boost::re_detail_107200::re_is_set_member<wchar_t const*, wchar_t, boost::c_regex_traits<wchar_t>, unsigned int>(wchar_t const*, wchar_t const*, boost::re_detail_107200::re_set_long<unsigned int> const*, boost::re_detail_107200::regex_data<wchar_t, boost::c_regex_traits<wchar_t> > const&, bool) in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::compare(unsigned long, unsigned long, wchar_t const*, unsigned long) const", referenced from:
      unsigned int boost::re_detail_107200::find_sort_syntax<boost::c_regex_traits<wchar_t>, wchar_t>(boost::c_regex_traits<wchar_t> const*, wchar_t*) in libboost_regex.a(wc_regex_traits.o)
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_alt() in libboost_regex.a(wide_posix_api.o)
      void boost::re_detail_107200::named_subexpressions::set_name<wchar_t>(wchar_t const*, wchar_t const*, int) in libboost_regex.a(wide_posix_api.o)
      void std::__1::vector<std::__1::pair<unsigned long, unsigned long>, std::__1::allocator<std::__1::pair<unsigned long, unsigned long> > >::__push_back_slow_path<std::__1::pair<unsigned long, unsigned long> >(std::__1::pair<unsigned long, unsigned long>&&) in libboost_regex.a(wide_posix_api.o)
      void std::__1::vector<boost::re_detail_107200::digraph<wchar_t>, std::__1::allocator<boost::re_detail_107200::digraph<wchar_t> > >::__push_back_slow_path<boost::re_detail_107200::digraph<wchar_t> const&>(boost::re_detail_107200::digraph<wchar_t> const&) in libboost_regex.a(wide_posix_api.o)
      std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >::assign(unsigned long, unsigned char const&) in libboost_regex.a(wide_posix_api.o)
      void std::__1::vector<std::__1::pair<bool, boost::re_detail_107200::re_syntax_base*>, std::__1::allocator<std::__1::pair<bool, boost::re_detail_107200::re_syntax_base*> > >::__push_back_slow_path<std::__1::pair<bool, boost::re_detail_107200::re_syntax_base*> >(std::__1::pair<bool, boost::re_detail_107200::re_syntax_base*>&&) in libboost_regex.a(wide_posix_api.o)
      __ZNSt3__16vectorIN5boost9sub_matchIPKwEENS_9allocatorIS5_EEE6assignIPS5_EENS_9enable_ifIXaasr21__is_forward_iteratorIT_EE5valuesr16is_constructibleIS5_NS_15iterator_traitsISC_E9referenceEEE5valueEvE4typeESC_SC_ in libboost_regex.a(wide_posix_api.o)
      ...
  "std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_open_paren() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_perl_extension() in libboost_regex.a(wide_posix_api.o)
  "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
      _regerrorW in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::fail(boost::regex_constants::error_type, long) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_extended_escape() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_repeat_range(bool) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_set() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_inner_set(boost::re_detail_107200::basic_char_set<wchar_t, boost::c_regex_traits<wchar_t> >&) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::fail(boost::regex_constants::error_type, long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long) in libboost_regex.a(wide_posix_api.o)
      ...
  "std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      void boost::re_detail_107200::raise_error<boost::regex_traits_wrapper<boost::c_regex_traits<wchar_t> > >(boost::regex_traits_wrapper<boost::c_regex_traits<wchar_t> > const&, boost::regex_constants::error_type) in libboost_regex.a(wide_posix_api.o)
  "std::runtime_error::runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long) in libboost_regex.a(regex.o)
      boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long) in libboost_regex.a(regex.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::fail(boost::regex_constants::error_type, long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long) in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::fail(boost::regex_constants::error_type, long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long) in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
      _regerrorW in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse(wchar_t const*, wchar_t const*, unsigned int) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::fail(boost::regex_constants::error_type, long) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_extended() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_all() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::unwind_alts(long) in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_extended_escape() in libboost_regex.a(wide_posix_api.o)
      boost::re_detail_107200::basic_regex_parser<wchar_t, boost::c_regex_traits<wchar_t> >::parse_repeat(unsigned long, unsigned long) in libboost_regex.a(wide_posix_api.o)
      ...
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::erase(unsigned long, unsigned long)", referenced from:
      boost::c_regex_traits<wchar_t>::transform(wchar_t const*, wchar_t const*) in libboost_regex.a(wc_regex_traits.o)
      boost::c_regex_traits<wchar_t>::transform_primary(wchar_t const*, wchar_t const*) in libboost_regex.a(wc_regex_traits.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::append(unsigned long, wchar_t)", referenced from:
      boost::c_regex_traits<wchar_t>::transform(wchar_t const*, wchar_t const*) in libboost_regex.a(wc_regex_traits.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::assign(unsigned long, wchar_t)", referenced from:
      wchar_t* boost::re_detail_107200::re_is_set_member<wchar_t*, wchar_t, boost::c_regex_traits<wchar_t>, unsigned int>(wchar_t*, wchar_t*, boost::re_detail_107200::re_set_long<unsigned int> const*, boost::re_detail_107200::regex_data<wchar_t, boost::c_regex_traits<wchar_t> > const&, bool) in libboost_regex.a(wide_posix_api.o)
      wchar_t const* boost::re_detail_107200::re_is_set_member<wchar_t const*, wchar_t, boost::c_regex_traits<wchar_t>, unsigned int>(wchar_t const*, wchar_t const*, boost::re_detail_107200::re_set_long<unsigned int> const*, boost::re_detail_107200::regex_data<wchar_t, boost::c_regex_traits<wchar_t> > const&, bool) in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::insert(std::__1::__wrap_iter<wchar_t const*>, wchar_t)", referenced from:
      boost::re_detail_107200::basic_regex_creator<wchar_t, boost::c_regex_traits<wchar_t> >::append_set(boost::re_detail_107200::basic_char_set<wchar_t, boost::c_regex_traits<wchar_t> > const&, mpl_::bool_<false>*) in libboost_regex.a(wide_posix_api.o)
  "std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >::__grow_by(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)", referenced from:
      boost::c_regex_traits<wchar_t>::transform_primary(wchar_t const*, wchar_t const*) in libboost_regex.a(wc_regex_traits.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [ace] Error 1

Note, I also just changed -Wl,-soname,libace.so to -Wl,-install_name,libace.so based on the warning in the above paste for libace.so, but that didn’t seem to change anything.

For reference, full response after clean is here.

Hi TJ,

I believe that error indicates the standard C++ library is missing from the link. Try -lstdc++ or -lc++ … I can’t recall which right now?

You are right that fnested-functions is to be removed. Apple used to ship a compiler that required that flag to support inner functions, but nowadays their compiler just doesn’t support them at all, so you are right to use GCC — which doesn’t require that option.

Woodley

1 Like

Thanks, @sweaglesw! The ticket seemed to be replacing the existing -lstdc++ with -lc++. I’m guessing this is a clang vs gcc thing?

Anyway, with that ace will be available on homebrew momentarily! :slight_smile:

Thanks TJ!