facebookarchive / extension-example

Basic dynamically loadable extension for HHVM
30 stars 13 forks source link

Can't build on MacOS 10.12 Sierra #17

Open wowazzz opened 7 years ago

wowazzz commented 7 years ago

Installed HHVM via Homebrew. Then run ./build.sh and get errors:


[100%] Linking CXX shared library example.so
Undefined symbols for architecture x86_64:
  "HPHP::StringData::Make(char const*, unsigned long, HPHP::CopyStringMode)", referenced from:
      HPHP::Extension::moduleInfo(HPHP::Array&) in example.cpp.o
  "HPHP::bstrcaseeq(char const*, char const*, unsigned long)", referenced from:
      std::__1::unordered_map<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo, HPHP::string_data_hash, HPHP::string_data_isame, std::__1::allocator<std::__1::pair<HPHP::StringData const* const, HPHP::Native::BuiltinFunctionInfo> > >::operator[](HPHP::StringData const*&&) in example.cpp.o
      std::__1::__hash_table<std::__1::__hash_value_type<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo>, std::__1::__unordered_map_hasher<HPHP::StringData const*, std::__1::__hash_value_type<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo>, HPHP::string_data_hash, true>, std::__1::__unordered_map_equal<HPHP::StringData const*, std::__1::__hash_value_type<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo>, HPHP::string_data_isame, true>, std::__1::allocator<std::__1::__hash_value_type<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo> > >::__rehash(unsigned long) in example.cpp.o
  "HPHP::g_destructors", referenced from:
      HPHP::Extension::moduleInfo(HPHP::Array&) in example.cpp.o
  "HPHP::makeStaticString(char const*)", referenced from:
      HPHP::ExampleExtension::moduleInit() in example.cpp.o
  "HPHP::makeStaticString(HPHP::String const&)", referenced from:
      HPHP::ExampleExtension::moduleInit() in example.cpp.o
  "HPHP::Array::set(HPHP::String const&, HPHP::Variant const&, bool)", referenced from:
      HPHP::Extension::moduleInfo(HPHP::Array&) in example.cpp.o
  "HPHP::Class::atomicRelease()", referenced from:
      HPHP::Class::ExtraData::~ExtraData() in example.cpp.o
  "HPHP::Native::s_builtinFunctions", referenced from:
      HPHP::ExampleExtension::moduleInit() in example.cpp.o
  "HPHP::String::~String()", referenced from:
      HPHP::Extension::moduleInfo(HPHP::Array&) in example.cpp.o
      HPHP::ExampleExtension::moduleInit() in example.cpp.o
  "HPHP::Extension::loadSystemlib(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      HPHP::ExampleExtension::moduleInit() in example.cpp.o
  "HPHP::Extension::Extension(char const*, char const*)", referenced from:
      __GLOBAL__sub_I_example.cpp in example.cpp.o
  "HPHP::type_scan::detail::g_metadata_table", referenced from:
      HPHP::MixedArray::Elm::_type_scan_custom_(HPHP::type_scan::Scanner&) const in example.cpp.o
  "HPHP::StringData::hashHelper() const", referenced from:
      std::__1::unordered_map<HPHP::StringData const*, HPHP::Native::BuiltinFunctionInfo, HPHP::string_data_hash, HPHP::string_data_isame, std::__1::allocator<std::__1::pair<HPHP::StringData const* const, HPHP::Native::BuiltinFunctionInfo> > >::operator[](HPHP::StringData const*&&) in example.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [example.so] Error 1
make[1]: *** [CMakeFiles/example.dir/all] Error 2
make: *** [all] Error 2```

What I am doing wrong? Thank you.
mofarrell commented 7 years ago

My guess is a lot of the args passed to the HHVM cmake (brew does this for you) will need to be passed to the cmake call in ./build.sh. https://docs.hhvm.com/hhvm/installation/building-from-source#mac-os-x-homebrew__build-hhvm

As far as I know, no one has built this example on OS X.

wowazzz commented 7 years ago

Thank you for the answer! It not helps... Built HHVM from source, all is the same. So there is any possible to build any extension on osx??