Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

rumeysayilmaz
Copy link
Collaborator

  • Cherry picked changes in this PR to enable build marmara for macOS.
  • As stated in here, reflected changes in src/Makefile.am.

  	build marmara for macos:
	- remove cpath, gcc in .github/workflows/marmara_mac_ci.yml
	- remove installing gcc from  README.md
	- deleted darwin.host.mk.patch
	- deleted darwin.mk.patch
	- change cc/g++ -> clang/clang++ default in depends/builders/darwin.mk and in depends/hosts/darwin.mk
	- fix bdb build on native darwin in depends/packages/bdb.mk
	- fix libcurl linkage under darwin and disable HTTP/2, librtmp and brotli  in depends/packages/libcurl.mk
	- fix MACOSX_DEPLOYMENT_TARGET in depends/packages/libsodium.mk
	- remove gcc specific linker flag -static-libgcc in src/Makefile.am
	- remove -enable-static --disable-shared from scripts in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove gcc related flags from Mac build in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove -Wno-builtin-declaration-mismatch for Mac in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
	- remove linker options -Wl,-undefined -Wl,dynamic_lookup in zcutil/build-mac-dtest.sh and zcutil/build-mac.sh
@dimxy
Copy link
Collaborator

dimxy commented Sep 25, 2024

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
Copy link
Collaborator

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
Copy link
Collaborator Author

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 (KomodoPlatform@a3bba24) be a work around for clang 15 too? @DeckerSU

@DeckerSU
Copy link
Collaborator

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
Copy link
Collaborator

dimxy commented Sep 26, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants