cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
325 stars 73 forks source link

Build Issue on MacOS Apple Silicon: Incompatibility with librocksdb #206

Closed pycke closed 8 months ago

pycke commented 8 months ago

Hello Calin and Fulcrum Users / Contributors,

I've encountered a build issue while attempting to compile Fulcrum on my Mac Mini with an M2 chip using both Qt Creator IDE and the CLI. It appears that there is an architecture mismatch with the statically-built librocksdb, where it's expecting 'arm64' but finding 'x86_64'.

To resolve this, I followed the build instructions in Fulcrum.pro to compile new static libraries for librocksdb targeting OSX Apple Silicon. Unfortunately, the compilation was unsuccessful with the specified version of librocksdb (v6.14.6, commit ed4316166f67ec892603014634840d29f460f611). Interestingly, compiling the latest version of librocksdb was successful, but integrating the resulting librocksdb.a did not allow Fulcrum to compile successfully afterward.

I'm reaching out to inquire if anyone has managed to build Fulcrum on MacOS Apple Silicon successfully and whether there might be more detailed instructions or tips that could assist in this process. Additionally, it would be very helpful if pre-built static binaries for MacOS Apple Silicon could be provided on the Releases page.

Thanks for maintaining and developing this great project !

cculianu commented 8 months ago

I would do that but I lack a macOS silicon machine. I actually am on macOS myself but I have been hesitant to switch to their ARM-based processor because I love running Windows binaries via CrossOver and in VMware and am hesitant that stuff will be slower on the newer CPU.

But enough about me -- ok so (1) likely the exact 6.1.4 version of rocksdb doesn't like Apple Silicon. The latest does and the latest should work ok with Fulcrum.. provided you tell Fulcrum where to find the headers for your custom-built rocksdb.

  1. You need to install rocksdb after building it, in this case. Maybe in /opt/local/ or somesuch. You may need to reconfigure rocksdb to specify this as the install root... and rebuild.
  2. When configuring Fulcrum with Qt IDE, go to the Project setup and edit the Build option for the "Release" configuration, and add the following Build option to the qmake line: LIBS+=-L/path/to/your/libdir LIBS+=-lrocksdb INCLUDEPATH+=/path/to/your/include/
Screen Shot 2023-11-02 at 9 49 18 AM
cculianu commented 8 months ago

PS: I think in addition to above LIBS+=-lrocksdb should appear on the qmake line to suppress the built-on rocksdb static lib …