Skip to content

Commit

Permalink
fixed cli crash with boost >= 1.70
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal authored and wipedlife committed Jun 1, 2021
1 parent ffb77b2 commit 1743569
Show file tree
Hide file tree
Showing 7 changed files with 669 additions and 3 deletions.
16 changes: 16 additions & 0 deletions android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ARM compilation. TODO
Create standalone: https://developer.android.com/ndk/guides/standalone_toolchain
Then change variables for you in setenv-android.sh and preparedepencies.sh ($ST and $NDK_PATH will be for standalone) but ANDROID_NDK_ROOT for real NDK-bundle.
then run preparedepencies.sh
then go to ../src/ and run compile_android.sh
Or change variables in gostcoin-qt-android.pro and compile for Qt...
```
lialh4@RBH4:~/GTMP/src$ lddandr gostcoind
0x00000001 (NEEDED) Shared library: [libssl.so.1.1]
0x00000001 (NEEDED) Shared library: [libcrypto.so.1.1]
0x00000001 (NEEDED) Shared library: [libz.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x00000001 (NEEDED) Shared library: [libc++_shared.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libc.so]
```
9 changes: 9 additions & 0 deletions android/aliases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if $CROSS_COMPILE_ISCLANG;then
alias gcc="$TOOLCHAIN/$CROSS_COMPILE""clang"
#echo gcc=$C
alias g++="$TOOLCHAIN/$CROSS_COMPILE""clang++"
else
alias gcc="$TOOLCHAIN/$CROSS_COMPILE""gcc"
#echo gcc=$C
alias g++="$TOOLCHAIN/$CROSS_COMPILE""g++"
fi;
97 changes: 97 additions & 0 deletions android/preparedepencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
# ndk/build/tools/make_standalone_toolchain.py for standalone build
preinit(){
source setenv-android.sh

export STANDALONE=/home/lialh4/Android/Sdk/ndk/arm-linux-androideabi/

export CPPFLAGS=--sysroot=$ANDROID_SYSROOT
export CXXFLAGS="--sysroot=$ANDROID_SYSROOT"
export TOOLCHAIN=$ANDROID_TOOLCHAIN
export NDK_PATH=$ANDROID_NDK_ROOT
export PATH=$TOOLCHAIN/bin/:$PATH:$STANDALONE/bin/
export ARCH=arm
export bdbv=18.1.40
export CROSS_COMPILE_ISCLANG=true
export CROSS_COMPILE=
}

download_depencies(){
wget -t0 https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1k.zip
wget -t0 https://fossies.org/linux/misc/db-$bdbv.tar.gz
wget -t0 https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
git clone https://github.com/GOSTSec/android-ifaddrs-from-android-source
}
check_depencies(){
if ! test -e OpenSSL_1_1_1k.zip || ! test -e db-*.tar.gz || ! test -e boost*.tar.gz;then
echo "Not exists depencies, download"
download_depencies
fi;
unpack_depencies
}
unpack_depencies(){
if ! test -d openssl-OpenSSL_1_1_1k || ! test -d "db-$bdbv" || ! test -d boost_1_76_0;then
tar xzvf "db-$bdbv.tar.gz" -C .
7z x OpenSSL_1_1_1k.zip
tar xvpf boost_1_76_0.tar.gz -C .
fi;
}
compile_openssl(){

cd openssl-OpenSSL_1_1_1k
./Configure android-arm shared no-ssl3 no-comp no-hw no-engine || exit 1
echo $ANDROID_NDK_ROOT/platforms/android-21/arch-arm/usr/lib/
make || exit 1
cd ..
}
compile_db(){
cd db-$bdbv/dist
if ! test -e config.sub.old;then
mv config.sub config.sub.old
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O config.sub
mv config.guess config.guess.old
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O config.guess
cp config.* ../lang/sql/sqlite/
fi;
cd ../build_unix
export ANDROID_HOME=$ANDROID_NDK_ROOT
../dist/configure --enable-cxx --disable-shared --disable-replication --host=arm-linux-androideabi CC=arm-linux-androideabi-gcc CPPFLAGS="-I$ANDROID_HOME/sysroot/usr/include/arm-linux-androideabi/ -I$ANDROID_HOME/sysroot/usr/include/ -I$ANDROID_HOME/sources/cxx-stl/llvm-libc++/include/"
make
cd ..
}
compile_boost(){
cd boost_1_76_0
./bootstrap.sh
echo -e "import option ;\nusing gcc : arm : arm-linux-androideabi-g++ ;\noption.set keep-going : false ; ">project-config.jam
echo "$PATH"
./b2 --layout=versioned --build-type=complete toolset=gcc-arm variant=release link=static threading=multi threadapi=pthread target-os=android define=BOOST_MATH_DISABLE_FLOAT128
cd stage/lib
for lib in *.a;
do
normalname=${lib/-*1_76.a/.a}
echo "cp $lib to $normalname"
cp $lib $normalname
done;
cd ../../..
}

compile_level_db(){
#maybe not need... because will be compiled but... automatic
cd ../src/leveldb
TARGET_OS=OS_ANDROID_CROSSCOMPILE make libleveldb.a libmemenv.a
cd ../../android
}
preinit
check_depencies
shopt -s expand_aliases
. aliases.sh
#gcc -v

compile_openssl
compile_boost
compile_db
#compile_level_db


echo "Now cd to ../src/ and run compile_android.sh"

0 comments on commit 1743569

Please sign in to comment.