Giter Club home page Giter Club logo

Comments (6)

roynalnaruto avatar roynalnaruto commented on August 19, 2024 1

Thank you @cryptonemo yes, the build can go through. I also need to set the CGO_LDFLAGS="-g -O2 -L/opt/homebrew/lib". Thank you :)

from filecoin-ffi.

vmx avatar vmx commented on August 19, 2024

I'm not on MacOS, but from the error message it seems that you don't have the x86_64-apple-darwin target installed (I also don't know if you can cross-compile on an M1). Though, could you please try to install that target via rustup target add x86_64-apple-darwin and see if that makes it work?

from filecoin-ffi.

roynalnaruto avatar roynalnaruto commented on August 19, 2024

Thanks @vmx for the help. I had already run rustup target add x86_64-apple-darwin, but that added this target in the default toolchain which was not the specific nightly version used by filecoin-ffi (it was the stable toolchain). So I re-added the above target after having set the specific toolchain as default and at least proceeded.

But I got stuck on the following error then:

   Compiling merkletree v0.21.0
error: could not find native static library `ff-derive-crypto`, perhaps an -L flag is missing?

error: aborting due to previous error

error: could not compile `fff`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
[ERROR cargo_lipo] Failed to build "filcrypto" for "x86_64-apple-darwin": Executing "/Users/narurkar/.rustup/toolchains/nightly-2021-04-24-aarch64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "filcrypto" "--target" "x86_64-apple-darwin" "--release" "--lib" "--no-default-features" "--features" "multicore-sdr,blst,gpu" finished with error status: exit status: 101
+ rm -f /var/folders/7h/3_b66mg534x0k6rj4dlczh340000gn/T/tmp.rPq3jXP8
make: *** [.install-filcrypto] Error 1

from filecoin-ffi.

vmx avatar vmx commented on August 19, 2024

The commit you're using is still a WIP, so it could well be there are problems. Could you try the latest commit from #192?

from filecoin-ffi.

roynalnaruto avatar roynalnaruto commented on August 19, 2024

Ah, ok I now used the commit: 84aedba415038e6046aebabecfd7406933c7f547, I still ended up getting those errors.

Removing the target x86_64-apple-darwin from this line at least allows me to proceed with the compilation without the above error.

When using the cgo generated files, the hwloc library cannot be found:

ld: library not found for -lhwloc
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have already installed the hwloc formula using brew install hwloc:

$ brew info hwloc

hwloc: stable 2.5.0 (bottled), HEAD
Portable abstraction of the hierarchical topology of modern architectures
https://www.open-mpi.org/projects/hwloc/
/opt/homebrew/Cellar/hwloc/2.5.0 (957 files, 10.2MB) *
  Poured from bottle on 2021-08-17 at 11:30:32
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/hwloc.rb
License: BSD-3-Clause
==> Dependencies
Build: pkg-config ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 16,247 (30 days), 60,002 (90 days), 261,102 (365 days)
install-on-request: 886 (30 days), 3,937 (90 days), 17,251 (365 days)
build-error: 0 (30 days)

So I tried linking it in the CGO_LDFLAGS:

$ CGO_LDFLAGS="-g -O2 -L/opt/homebrew/opt/hwloc/lib" go vet ./...

and I get this error:

# github.com/filecoin-project/filecoin-ffi/generated
Undefined symbols for architecture arm64:
  "_clCreateCommandQueueWithProperties", referenced from:
      opencl3::command_queue::CommandQueue::create_with_properties::he5eaa5eef3b1d3be in libfilcrypto.a(opencl3-1c7f5b0ce1bd61d8.opencl3.5sx85cca-cgu.2.rcgu.o)
  "_clEnqueueSVMFree", referenced from:
      opencl3::command_queue::CommandQueue::enqueue_svm_free::h043f3e0d27f6e5b9 in libfilcrypto.a(opencl3-1c7f5b0ce1bd61d8.opencl3.5sx85cca-cgu.2.rcgu.o)
  "_clEnqueueSVMMemcpy", referenced from:
      opencl3::command_queue::CommandQueue::enqueue_svm_mem_cpy::hcd2c2bad4506a18e in libfilcrypto.a(opencl3-1c7f5b0ce1bd61d8.opencl3.5sx85cca-cgu.2.rcgu.o)
  "_clGetPipeInfo", referenced from:
      cl3::memory::get_pipe_data::hab64e37ec535213c in libfilcrypto.a(cl3-f475a8013ab67ca1.cl3.2vopi5nt-cgu.2.rcgu.o)
      cl3::memory::get_pipe_info::h72950da477ccac3f in libfilcrypto.a(cl3-f475a8013ab67ca1.cl3.2vopi5nt-cgu.2.rcgu.o)
  "_clSetKernelArgSVMPointer", referenced from:
      opencl3::kernel::Kernel::set_arg_svm_pointer::hb7bba2efcfe216d2 in libfilcrypto.a(opencl3-1c7f5b0ce1bd61d8.opencl3.5sx85cca-cgu.3.rcgu.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

from filecoin-ffi.

cryptonemo avatar cryptonemo commented on August 19, 2024

Try to build on the current filecoin-ffi master branch.

The build.sh script may not work if you don't have the OS X build targets, so you can install them manually if needed:

rustup target add x86_64-apple-darwin --toolchain $(cat rust-toolchain)
rustup target add aarch64-apple-darwin --toolchain $(cat rust-toolchain)

Then build ffi like:

LIBRARY_PATH=/opt/homebrew/lib LDFLAGS="-framework OpenCL" make clean
LIBRARY_PATH=/opt/homebrew/lib LDFLAGS="-framework OpenCL" make

from filecoin-ffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.