lambdaclass/concrete

Installation in Macbook pro M2

Closed this issue · 3 comments

Hi guys!

I'm using a macbook pro M2 (AArch64)

I followed the instructions for installing concrete. I came quite far, but had a problem when concrete tries to link the binary

  Compiling tracing-subscriber v0.3.18
   Compiling concrete_parser v0.1.0 (/Users/kenarab/git/concrete/crates/concrete_parser)
   Compiling melior-macro v0.10.2
   Compiling melior v0.16.2
   Compiling concrete_driver v0.1.0 (/Users/kenarab/git/concrete/crates/concrete_driver)
   Compiling concrete v0.1.0 (/Users/kenarab/git/concrete/crates/concrete)
    Building [=======================> ] 270/271: concrete(bin)       

And the errors seems to be with a non compliant LLVM

LLVMDemangle" "-lm" "-lz" "-lzstd" "-lcurses" "-lxml2" "-lc++" "-lm" "-lz" "-lzstd" "-lcurses" "-lxml2" "-lc++" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/opt/homebrew/Cellar/rust/1.77.1/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/kenarab/git/concrete/target/release/deps/concrete-57fd24f9222538ba" "-Wl,-dead_strip" "-nodefaultlibs" "-L/opt/homebrew/lib" "-L/usr/local/lib"
  = note: ld: warning: ignoring duplicate libraries: '-lc++', '-lcurses', '-lm', '-lxml2', '-lz', '-lzstd'
          Undefined symbols for architecture arm64:
            "llvm::sys::RWMutexImpl::~RWMutexImpl()", referenced from:
                (anonymous namespace)::LowerVectorToLLVMPass::runOnOperation() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
                mlir::LLVMTypeConverter::~LLVMTypeConverter() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
                mlir::LLVMTypeConverter::~LLVMTypeConverter() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          
error: could not compile `concrete` (bin "concrete") due to 1 previous error
make: *** [build] Error 101

The cmake script for LLVM I used is this one

cmake -G Ninja ../llvm \
  -DLLVM_ENABLE_PROJECTS=mlir \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_TARGETS_TO_BUILD="AArch64" \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0

I built LLVM repo checking out tag llvmorg-17.0.6, as you stated LLVM 17 with MLIR enabled.
For building and installing custm LLVM have run this command

ninja build & ninja install

Thank you!

Did you try installing llvm with brew? Also did you setup the environment variables?

you can find the path to put to the env vars with brew --prefix llvm@17

Nope...

I built myself llvm with mlir enabled.

If I use brew installed llvm version as you suggested, the build process brokens much earlier, at mlir-sys just because llvm does not have mlir enabled. So the problem is elsewhere, an incompatibility with mlir implementation or version needed?

  Compiling mlir-sys v0.2.1

Caused by:
  process didn't exit successfully: `/Users/kenarab/git/concrete/target/release/build/mlir-sys-6f63e6675a5feb34/build-script-build` (exit status: 1)
  --- stderr
  failed to find correct version (17.x.x) of llvm-config (found )
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `tblgen v0.3.0`

Caused by:
  process didn't exit successfully: `/Users/kenarab/git/concrete/target/release/build/tblgen-f64794b262ef1624/build-script-build` (exit status: 1)
  --- stderr
  failed to find correct version (17.x.x) of llvm-config (found )
make: *** [build] Error 101

I'm sorry. Was my fault, I was not pointing the env variables to the right installation path. It worked ok using brew llvm version!

Thanks to @JulianGCalderon