RavenProject / Ravencoin

Ravencoin Core integration/staging tree
https://www.ravencoin.org
MIT License
1.08k stars 670 forks source link

[BUILD] MacOS build needs small updates #1006

Open jeroz1 opened 3 years ago

jeroz1 commented 3 years ago

This is how I got develop to build on Big Sur (11.2.3):

git clone https://github.com/RavenProject/Ravencoin.git
cd Ravencoin/
git checkout develop

brew install automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf python qt5 libevent qrencode
echo 'export PATH="/usr/local/opt/berkeley-db@4/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/qt@5/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
brew install librsvg #Optional For dmg package
brew link berkeley-db4 --force

./autogen.sh
./configure
make -j4
make check # Optional
make deploy # Optional

Main differences:

lorancecall commented 3 years ago

Error issue on OSX 11.4 Big Sur,

wallet/wallet.cpp:2754:5: error: use of undeclared identifier '**random_shuffle**'
    random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
    ^
wallet/wallet.cpp:2957:5: error: use of undeclared identifier '**random_shuffle**'
    random_shuffle(vCoins.begin(), vCoins.end(), GetRandInt);
    ^

..... omitted ...

4 warnings and 2 errors generated.
make[2]: *** [wallet/libraven_wallet_a-wallet.o] Error 1
make[2]: *** Waiting for unfinished jobs....
10 warnings generated.
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

I googled it, and it seems related to the c++ compiler version? reference Any suggestion? or setup I need to do before building?

I found the 'wallet.cpp' in bitcoin core uses Shuffle() instead, but even I simply changed the function, it did not worked for me (FYI, I'm noob in c++)

Below is my g++ version, not sure it can help,

> $ g++ --version                                                                                                                                                                                                                                                [±develop ●]
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
lorancecall commented 3 years ago

After applied the change posted on #1041, I success on building.

Some issue can happen if both qt (ver 6) and qt@5 are installed together. After removing both and re-installing qt@5 resolve this issue. If follow the @jeroz1 instruction above, it will probably not happen unless someone uses qt v6 for their regular dev works.

lorancecall commented 3 years ago

This will be not an issue but install_cli.sh is not executable after build need to grant permission to be executable chmod +x install_cli.sh during build process