marmarachain / marmara

This is the main repository for Marmara Credit Loops Smartchain containing the open source CC Files.
https://marmara.io/
Other
18 stars 8 forks source link

macOS build for marmara and remove explicit reference to libcc.dl and build it as in komodo codebase #49

Open rumeysayilmaz opened 4 days ago

rumeysayilmaz commented 4 days ago
dimxy commented 4 days ago

I got a build error on my macos 12.3.1 Apple clang version 13.1.6 (clang-1316.0.21.2.5) (attn: @DeckerSU )

/Library/Developer/CommandLineTools/usr/bin/clang++ -mmacosx-version-min=10.15 -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++ --sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o src/algebra/curves/alt_bn128/alt_bn128_g1.o   src/algebra/curves/alt_bn128/alt_bn128_g1.cpp -c -MMD -pipe -O2 -DBINARY_OUTPUT -DSTATICLIB -DNO_PT_COMPRESSION=1  -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-comment -Wfatal-errors -O2 -march=x86-64 -g  -DMONTGOMERY_OUTPUT -DCURVE_ALT_BN128 -I/Users/dimxy/repo/marmara/depends/x86_64-apple-darwin21.4.0/include -Isrc -DNO_PROCPS -static -DSTATIC -DMULTICORE -fopenmp
clang: fatal error: unsupported option '-fopenmp'
make[1]: *** [src/algebra/curves/alt_bn128/alt_bn128_g1.o] Error 1
make: *** [/Users/dimxy/repo/marmara/depends/work/build/x86_64-apple-darwin21.4.0/libsnark/0.1-a894dfe24aa/./.stamp_built] Error 2
DeckerSU commented 4 days ago

clang: fatal error: unsupported option '-fopenmp'

It's expected. The error you're seeing, clang: fatal error: unsupported option '-fopenmp', indicates that the version of Clang that ships with macOS (via Xcode) does not support the -fopenmp flag out of the box. This is a common issue because the default Clang on macOS lacks OpenMP support by default.

To build on macOS with Clang, you need to disable OpenMP (Open Multi-Processing) during the libsnark build (for macOS hosts only), or alternatively, remove libsnark entirely, as was done in the upstream codebase. Or, if you want to keep OpenMP enabled, you can use LLVM with OpenMP and libomp installed via Homebrew to build.

rumeysayilmaz commented 4 days ago

Tested on:

HW: MacBook Air M1 OS version: 15.0 Apple clang version: 15.0.0 (clang-1500.3.9.4) Target: arm64-apple-darwin24.0.0

Getting the following error when I build the ./zcutil/build-mac.sh:

make: *** [/Users/rumeysayilmaz/myProjects/hardforks8/marmara/depends/work/build/arm-apple-darwin24.0.0/boost/1_72_0-f64f7e44175/./.stamp_built] Error 1

Could this (https://github.com/KomodoPlatform/komodo/commit/a3bba24373e9cb2af40bbadad9ae8dc317302979) be a work around for clang 15 too? @DeckerSU

DeckerSU commented 4 days ago

Don’t try to build the daemon for the arm-apple-darwin triplet—it won’t work. Instead, build for the x86_64-apple-darwin architecture. Regarding your question, if the Boost build fails with an error like error: integer value -1 is outside the valid range of values [0, 3] for this enumeration type, then this could be the solution. If you’re encountering a different error, it’s likely another issue.

dimxy commented 3 days ago

I passed through the libsnark build error by setting MULTICORE=0 in libsnark.mk but then started getting new incompatibility errors. I guess to fix all them we would need to implement all refactoring that was done in the komodo main repo by @DeckerSU (for e.g. removal of haraka code)