lepus2589 / accelerate-lapacke

CMake wrapper to build and link the LAPACKE library against the native Apple Accelerate Framework
MIT License
1 stars 1 forks source link

Unable to follow instructions and get things to work #1

Open ekrich opened 1 month ago

ekrich commented 1 month ago

Thanks for this project. I had some difficulty getting started.

eric@Erics-MBP-M1 accelerate-lapacke % cmake --build --preset accelerate-lapacke64 --verbose
Error: /Users/eric/workspace/accelerate-lapacke/build/64 is not a directory
eric@Erics-MBP-M1 accelerate-lapacke % cmake --build --preset accelerate-lapacke32 --verbose
Error: /Users/eric/workspace/accelerate-lapacke/build/32 is not a directory

Once I create the directories I get the following:

eric@Erics-MBP-M1 accelerate-lapacke % cmake --build --preset accelerate-lapacke64 --verbose
Error: could not load cache

I tried the following found on SOF:

cmake -S . -B ./build

Then this seemed to help.

cmake -S . -B ./build/64

Then when I tried to build it worked. I don't know much about cmake so maybe this is obvious to others or just omitted from the instructions.

Next I tried to install and got the following which I guess would require sudo:

Install the project...
/opt/homebrew/Cellar/cmake/3.29.6/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
CMake Error at _deps/reference-lapack-build/cmake_install.cmake:41 (file):
  file cannot create directory: /usr/local/lib/pkgconfig.  Maybe need
  administrative privileges.
Call Stack (most recent call first):
  src/cmake_install.cmake:42 (include)
  cmake_install.cmake:42 (include)

make: *** [install] Error 1

I tried linking with -L/path/to/lib where they were built since I didn't want it to go into /usr/local/lib and got the following:

dyld[25695]: Library not loaded: @rpath/liblapacke.3.dylib
  Referenced from: <E2DB11F5-DEE4-37C2-ADDE-58982620D083> /Users/eric/workspace/slapack/slapack/target/scala-3.3.3/slapack-test
  Reason: tried: '/usr/local/lib/liblapacke.3.dylib' (no such file), '/usr/lib/liblapacke.3.dylib' (no such file, not in dyld cache)

Next I tried this maybe to help with the @rpath issue.

cmake -S . -B ./build -D "CMAKE_PREFIX_PATH=~/.local"

I again tried install with no luck - was thinking that maybe the libs would go in ~/.local but not sure.

Sorry, if I don't know a ton about this but thought it might be helpful to share my experience - this seems like this is an extremely useful project. Too bad Apple doesn't just do this for us. Not being cross platform at least with LAPACKE is not great and using LAPACKE is much nicer than LAPACK.

ekrich commented 1 month ago

Some configuration info. OS 13.6.7 arm64 M1 XCode 14.2

% cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

For context I am trying to create bindings for LAPACK that are cross platform. I would prefer the LAPACKE interfaces thus why I am here. This is for Scala Native. https://github.com/scala-native/scala-native I created simple bindings for CBLAS that can be found here for reference. https://github.com/ekrich/sblas

ekrich commented 1 month ago

I did the install using sudo which put the library in /usr/local/lib and then my project worked. Note that the install also put cmake and pkgconfig directories into the lib dir. Doesn't seem like it should do that.