Closed hayarobi closed 1 year ago
To build on Apple Silicon, you need to set environment variable GMP_VERSION
to 6.2.1
.
Did you tested this branch on a MacBook M1/M2? Is it passing the tests there?
To build on Apple Silicon, you need to set environment variable
GMP_VERSION
to6.2.1
.
Maybe this can be done in the Makefile, detecting the OS and setting the environment variable
This is not tested
I suspect it should be put at the beginning of the Makefile, before calling cmake
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
# It is running on MacOS
export GMP_VERSION=6.2.1
endif
The initial goal was to have the same results as the old develop branch, but to make it easier way for developers to build on the Apple Silicon Mac, so if you build in the exact same way as before - simply run make - it will build with GMP-6.1.2 as before, and it will fail to build on the Apple Silicon Mac.
I then thought about upgrading libgmp itself to 6.2.1, rather than having it build to 6.2.1 only on Macs. I'm going to work on this in a separate branch, do more testing and synchronization testing, and then PR it separately.
Translated with www.DeepL.com/Translator (free version)
This is not tested
I suspect it should be put at the beginning of the Makefile, before calling cmake
I build on apple silicon mac like below;
export GMP_VERSION=6.2.1 && make
The make clean
command is failing:
~/aergo2# make clean
-- Using libgmp version to 6.1.2
-- Configuring done
-- Generating done
-- Build files have been written to: /root/aergo2/build
make[5]: *** No rule to make target 'clean'. Stop.
make[4]: *** [libtool/CMakeFiles/libgmp-clean.dir/build.make:70: libtool/CMakeFiles/libgmp-clean] Error 2
make[3]: *** [CMakeFiles/Makefile2:646: libtool/CMakeFiles/libgmp-clean.dir/all] Error 2
make[2]: *** [CMakeFiles/Makefile2:389: CMakeFiles/distclean.dir/rule] Error 2
make[1]: *** [Makefile:254: distclean] Error 2
make: *** [Makefile:51: clean] Error 2
This happened when running the command above just after cloning the repo and respective branch, before any build
The
make clean
command is failing:
I know, but I'm still new to cmake and haven't found a proper workaround. Anyway, make clean
doesn't work properly too often, even on existing branches, so I figured it didn't make much difference and not so important now. I'll try to find a way to fix it next time.
OK, I agree.
Overall the build and test is working. I also tested on Alpine and it is OK.
This can be merged if yo wish
This patch is intended to make building projects and working with git easier. It removes source directory of libgmp-6.1.2 but adds tarball archive of libgmp which will be extracted in build time.
Removing libgmp source files make commands like
git ls-files
shows more meaningful output. It also makes it easy to change the version of libgmp, for future use. Also, I made it possible to build by selecting the libgmp-6.2.1 version. With this change, we improved the convenience of development by providing an option to compile the Aergo server on Apple Silicon Macs. (However, since Aergo's lua vm is architecture-dependent, it will be impossible to synchronize with Mainnet and Testnet nodes in Apple Silicon.)