Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac m1 build install dependencies failed #11701

Open
zsmj2017 opened this issue Nov 30, 2024 · 2 comments
Open

Mac m1 build install dependencies failed #11701

zsmj2017 opened this issue Nov 30, 2024 · 2 comments
Labels
build triage Newly created issue that needs attention.

Comments

@zsmj2017
Copy link

Problem description

install macos dependencies

  1. git clone velox && checkout main branch
  2. run ./scripts/setup-macos.sh to install dependencies

error

  1. install cache failed
cannot move 'ccache-4.10.2-darwin/ccache' to '/usr/local/bin/ccache': Permission denied
drwxr-xr-x 44 root wheel 1408 11 30 20:20 /usr/local/bin

Temporary solution: Use sudo when executing mv with ccache.

  1. build folly failed
FAILED: folly/logging/example/logging_example 
: && /Library/Developer/CommandLineTools/usr/bin/c++ -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -isystem /opt/homebrew/include -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  folly/logging/example/CMakeFiles/logging_example.dir/main.cpp.o -o folly/logging/example/logging_example  -Wl,-rpath,/Users/zsmj/vec-spark/velox/deps-install/lib -Wl,-rpath,/opt/homebrew/lib  folly/logging/example/liblogging_example_lib.a  libfolly.a  /Users/zsmj/velox/deps-install/lib/libfmt.a  /Users/zsmj/velox/deps-install/lib/libboost_context.dylib  /Users/zsmj/velox/deps-install/lib/libboost_filesystem.dylib  /Users/zsmj/velox/deps-install/lib/libboost_atomic.dylib  /Users/zsmj/velox/deps-install/lib/libboost_program_options.dylib  /Users/zsmj/velox/deps-install/lib/libboost_regex.dylib  /Users/zsmj/velox/deps-install/lib/libboost_system.dylib  /Users/zsmj/velox/deps-install/lib/libboost_thread.dylib  /Users/zsmj/velox/deps-install/lib/libdouble-conversion.a  /opt/homebrew/lib/libgflags.2.2.2.dylib  /opt/homebrew/lib/libglog.dylib  /opt/homebrew/lib/libevent.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libz.tbd  /opt/homebrew/Cellar/openssl@3/3.4.0/lib/libssl.dylib  /opt/homebrew/Cellar/openssl@3/3.4.0/lib/libcrypto.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libbz2.tbd  /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/liblzma.tbd  /opt/homebrew/lib/liblz4.dylib  /opt/homebrew/lib/libzstd.dylib  /opt/homebrew/lib/libsnappy.dylib  /opt/homebrew/lib/libsodium.dylib  -lc++abi && :
ld: Undefined symbols:
  _mallctl, referenced from:
      folly::usingJEMalloc()::Initializer::operator()() const in libfolly.a[5](Demangle.cpp.o)
      folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a[65](MemoryIdler.cpp.o)
      void folly::detail::mallctlHelper<unsigned int>(char const*, unsigned int*, unsigned int*) in libfolly.a[65](MemoryIdler.cpp.o)
  _mallctlbymib, referenced from:
      folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a[65](MemoryIdler.cpp.o)
  _mallctlnametomib, referenced from:
      folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a[65](MemoryIdler.cpp.o)
  _mallocx, referenced from:
      folly::threadlocal_detail::StaticMetaBase::reallocate(folly::threadlocal_detail::ThreadEntry*, unsigned int, unsigned long&) in libfolly.a[74](ThreadLocalDetail.cpp.o)
  _nallocx, referenced from:
      folly::goodMallocSize(unsigned long) in libfolly.a[5](Demangle.cpp.o)
      folly::threadlocal_detail::StaticMetaBase::reallocate(folly::threadlocal_detail::ThreadEntry*, unsigned int, unsigned long&) in libfolly.a[74](ThreadLocalDetail.cpp.o)
  _sdallocx, referenced from:
      folly::sizedFree(void*, unsigned long) in libfolly.a[71](SplitStringSimd.cpp.o)
  _xallocx, referenced from:
      void folly::fbvector<folly::Range<char const*>, std::__1::allocator<folly::Range<char const*>>>::emplace_back_aux<char const*&, long>(char const*&, long&&) in libfolly.a[71](SplitStringSimd.cpp.o)
      void folly::fbvector<std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char>>>>::emplace_back_aux<char const*&, long>(char const*&, long&&) in libfolly.a[71](SplitStringSimd.cpp.o)
      void folly::fbvector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>::emplace_back_aux<char const*&, long>(char const*&, long&&) in libfolly.a[71](SplitStringSimd.cpp.o)
      void folly::fbvector<folly::basic_fbstring<char, std::__1::char_traits<char>, std::__1::allocator<char>, folly::fbstring_core<char>>, std::__1::allocator<folly::basic_fbstring<char, std::__1::char_traits<char>, std::__1::allocator<char>, folly::fbstring_core<char>>>>::emplace_back_aux<char const*&, long>(char const*&, long&&) in libfolly.a[71](SplitStringSimd.cpp.o)
      folly::threadlocal_detail::StaticMetaBase::reallocate(folly::threadlocal_detail::ThreadEntry*, unsigned int, unsigned long&) in libfolly.a[74](ThreadLocalDetail.cpp.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
+ echo 'build failed'
build failed

It seems like some jemalloc-related symbols are missing.
I don’t understand why we need to build folly/logging/example/logging_example, but if it’s necessary, does this mean we need to add jemalloc as a dependency? Now it is missing.
Additionally, the error still occurs with brew install jemalloc.

Temporary solution: Add a link to jemalloc in libfolly.a in velox-ut/deps-download/folly/CMakeLists.txt.

target_link_libraries(folly PUBLIC folly_deps /opt/homebrew/lib/libjemalloc.dylib)

It’s unclear whether there’s an issue with my environment causing folly to not properly link the correct dependencies during compilation.

System information

velox commit : ac5c15eb7627b42f8d41023215d1d4a7e69d45aaa
CPU: Apple M1 Max
CMake Version: 3.31.1
System: Darwin-23.1.0
Arch: arm64
C++ Compiler Version: Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
C Compiler Version: Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
CMake Prefix Path:

CMake log

No response

@zsmj2017 zsmj2017 added build triage Newly created issue that needs attention. labels Nov 30, 2024
@zsmj2017
Copy link
Author

install cache failed seem same as this issue: #11237

@assignUser
Copy link
Collaborator

No real reason for us to build folly with examples, I'll check if we can turn that off. I'll answer in the other issue regarding ccache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build triage Newly created issue that needs attention.
Projects
None yet
Development

No branches or pull requests

2 participants