iotaledger / ccurl.interface.py

A python interface to load ccurl library and perform PoW locally.
MIT License
6 stars 3 forks source link

ibccurl.so: unknown file type #15

Open rafalf opened 3 years ago

rafalf commented 3 years ago

I am seeing the following exception on my Mac while performing local POW

exception: dlopen(/Users/rafalfusik/gitprojects/iotaPerfm/venv/lib/python3.7/site-packages/pow/libccurl.so, 6): no suitable image found.  Did find:
    /Users/ABC/gitprojects/iotaPerfm/venv/lib/python3.7/site-packages/pow/libccurl.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    /Users/ABC/gitprojects/iotaPerfm/venv/lib/python3.7/site-packages/pow/libccurl.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

what I have installed

lzpap commented 3 years ago

hey @rafalf , yeah, the pip version is for linux. If you want to use it on Mac, you have to recompile the c library libccurl.so. You can do so by following this: https://github.com/iotaledger/ccurl.interface.py#installation

lzpap commented 3 years ago

@rafalf essentially you need to clone the repo, run init.sh and then pip install -e .

rafalf commented 3 years ago

I ran the init and then installed but then I found out that the image is not getting built

(venv) Rafals-MacBook-Air:ccurl.interface.py ABC$ cd ccurl_repo/ccurl && mkdir -p build && cd build && cmake .. && cmake --build .
CMake Deprecation Warning at deps/libopencl-stub/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rafalfusik/gitprojects/iotaPerfm/ccurl.interface.py/ccurl_repo/ccurl/build
[  6%] Built target OpenCL
[ 36%] Built target ccurl
[ 66%] Built target ccurlstatic
[ 73%] Built target ccurl-cli
[ 80%] Built target ccurld
[ 86%] Built target ccurl-digest
[ 93%] Built target trytes-to-trits
[100%] Built target trytes-to-long
(
cd ../../..
 $(find ./ccurl_repo -name "*.so")

and I get no hits, .so aint getting built

lzpap commented 3 years ago

@rafalf is it possible that on mac, cmake builds a .dylib instead of a .so?

rafalf commented 3 years ago

@lzpap Yup

(venv) Rafals-MacBook-Air:ccurl.interface.py ABC$ find ./ccurl_repo -name "*.dylib"
./ccurl_repo/ccurl/build/lib/libccurl.dylib
lzpap commented 3 years ago

@rafalf just out of curiosity, what happens, when you rename the created file to .so? Does it work? If not, then quite some things should be changed in the repo, it was developed with mainly linux and windows in mind...

rafalf commented 3 years ago

Copied a few bits and pieces from the init

mv ./ccurl_repo/ccurl/build/lib/libccurl.dylib ./ccurl_repo/ccurl/build/lib/libccurl.so
LIB=$(find ./ccurl_repo -name "*.so")
WD=$(pwd)
cp $LIB $WD/pow
pip install -e .

Working like a charme @lzpap . thanks mate!

Getting platforms... 
OpenCL Hashing with 32 loops...
OpenCL Hashing with 32 loops...
OpenCL Hashing with 32 loops...
OpenCL Hashing with 32 loops...
Transaction sent to the tangle: 1i MESSAGE LLB8IOKR8TRB0NA9UXVSX7OBGZEHXJ, time elapsed: 00:00:50
Took 00:00:51 to send and receive 1i MESSAGE LLB8IOKR8TRB0NA9UXVSX7OBGZEHXJ