ngt-rs icon indicating copy to clipboard operation
ngt-rs copied to clipboard

macOS cannot compile

Open jianshu93 opened this issue 2 years ago • 4 comments

Hello Team,

I have the following error in MacOS:

error: failed to run custom build command for ngt-sys v1.14.8-static (/Users/jianshuzhao/Github/ngt-rs/ngt-sys)

Caused by: process didn't exit successfully: /Users/jianshuzhao/Github/ngt-rs/target/release/build/ngt-sys-01413d2ad24e15fd/build-script-build (signal: 6, SIGABRT: process abort signal) --- stdout CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None HOST_CMAKE_TOOLCHAIN_FILE = None CMAKE_TOOLCHAIN_FILE = None CMAKE_GENERATOR_aarch64-apple-darwin = None CMAKE_GENERATOR_aarch64_apple_darwin = None HOST_CMAKE_GENERATOR = None CMAKE_GENERATOR = None CMAKE_PREFIX_PATH_aarch64-apple-darwin = None CMAKE_PREFIX_PATH_aarch64_apple_darwin = None HOST_CMAKE_PREFIX_PATH = None CMAKE_PREFIX_PATH = None CMAKE_aarch64-apple-darwin = None CMAKE_aarch64_apple_darwin = None HOST_CMAKE = None CMAKE = None running: cd "/Users/jianshuzhao/Github/ngt-rs/target/release/build/ngt-sys-cbc11c3c769b2631/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/jianshuzhao/Github/ngt-rs/ngt-sys/NGT" "-DCMAKE_INSTALL_PREFIX=/Users/jianshuzhao/Github/ngt-rs/target/release/build/ngt-sys-cbc11c3c769b2631/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_C_COMPILER=/usr/local/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_CXX_COMPILER=/usr/local/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_ASM_COMPILER=/usr/local/bin/cc" "-DCMAKE_BUILD_TYPE=Release" -- VERSION: 1.14.7 -- CMAKE_BUILD_TYPE: Release -- CMAKE_BUILD_TYPE_LOWER: release -- Configuring done -- Generating done -- Build files have been written to: /Users/jianshuzhao/Github/ngt-rs/ngt-sys/NGT running: cd "/Users/jianshuzhao/Github/ngt-rs/target/release/build/ngt-sys-cbc11c3c769b2631/out/build" && "cmake" "--build" "." "--target" "install" "--config" "Release" "--parallel" "10"

--- stderr CMake Warning (dev): Policy CMP0068 is not set: RPATH settings on macOS do not affect install_name. Run "cmake --help-policy CMP0068" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, the install_name fields for
the following targets are still affected by RPATH settings:

 ngt

This warning is for project developers. Use -Wno-dev to suppress it.

Error: could not load cache thread 'main' panicked at ' command did not execute successfully, got: exit status: 1

build script failed, must exit now', /Users/jianshuzhao/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5

Thanks,

Jianshu

jianshu93 avatar Jan 24 '23 18:01 jianshu93

Hello,

What is your CMake version ?

Do you manage to build NGT using these instructions ?

Are you using special cargo features (static, shared_mem, large_data) ?

lerouxrgd avatar Jan 24 '23 22:01 lerouxrgd

Is this intel only support, or works for m2?

mooreniemi avatar Jan 02 '24 23:01 mooreniemi

As I am not able to test with macOS I cannot really say what is supported there.

A first step is to try to compile NGT (as mentioned here), and if it works then this crate should work too (or should be adapted to work too).

lerouxrgd avatar Jan 02 '24 23:01 lerouxrgd

For posterity, I'm on an M2 and this worked for me:

# i added the lib to Cargo.toml but it failed on cmake not finding OpenMP, so
brew install libomp
export CMAKE_PREFIX_PATH="/opt/homebrew/opt/libomp:$CMAKE_PREFIX_PATH"
# then as normal
cargo build

Not ideal to do an env var end-run around to get libomp in there but it built!

mooreniemi avatar Jan 03 '24 03:01 mooreniemi