Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: kzv on October 04, 2016, 07:35:32 PM



Title: How to compile static version bitcoind?
Post by: kzv on October 04, 2016, 07:35:32 PM
Hi

i complied a bitcoind in Ubuntu Dektop 64bit

Code:
./configure
make
make install
completed and works well in Ubuntu

i moved this bitcoind into a Centos 64bit 6.5, ran it and some errors came out

Code:
./bitcoind: error while loading shared libraries: libboost_system.so.1.58.0: cannot open shared object file: No such file or directory

i think all *.so lib required need to be compiled together with the bitcoind binnary, but how? i tried

Code:
./configure --disable-shared
make clean
make
sudo make install
completed but still doesn't work in Centos, same error

and tried

Code:
./configure 
make clean
make STATIC=all
sudo make install
completed but still doesn't work in Centos, same error

the bitcoind in https://bitcoin.org/bin/bitcoin-core-0.13.0/bitcoin-0.13.0-x86_64-linux-gnu.tar.gz however works well in both Centos and Ubuntu


Title: Re: How to compile static version bitcoind?
Post by: achow101 on October 04, 2016, 07:53:41 PM
You should use the depends system and compile the libs. Then you can build with those and it would work.


Title: Re: How to compile static version bitcoind?
Post by: kzv on October 04, 2016, 08:02:24 PM
You should use the depends system and compile the libs. Then you can build with those and it would work.

This is all my steps:
Code:
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
sudo apt-get install libminiupnpc-dev
sudo apt-get install libzmq3-dev
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
sudo apt-get install libqrencode-dev
sudo apt-get update
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
wget https://github.com/bitcoin/bitcoin/archive/v0.13.0.tar.gz
tar -xvzf v0.13.0.tar.gz
cd bitcoin-0.13.0
./autogen.sh
./configure
make
sudo make install

exactly what I need to do more?


Title: Re: How to compile static version bitcoind?
Post by: achow101 on October 04, 2016, 08:16:25 PM
Do exactly this from the Bitcoin source dir.

Code:
cd depends
make
cd ..
./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu
make

The binaries produced should work across platforms.


Title: Re: How to compile static version bitcoind?
Post by: kzv on October 05, 2016, 02:01:35 PM
Do exactly this from the Bitcoin source dir.

Code:
cd depends
make
cd ..
./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu
make

The binaries produced should work across platforms.

I tried but I got such errors in CentOS

Code:
./bitcoind: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./bitcoind)
./bitcoind: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./bitcoind)
./bitcoind: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./bitcoind)
./bitcoind: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./bitcoind)
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./bitcoind)
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./bitcoind)


Title: Re: How to compile static version bitcoind?
Post by: achow101 on October 05, 2016, 03:48:50 PM
Try this configure command instead
Code:
./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++"


Title: Re: How to compile static version bitcoind?
Post by: kzv on October 06, 2016, 07:58:35 AM
Try this configure command instead
Code:
./configure --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++"

I tried. Were such errors

Code:
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./bitcoind)
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./bitcoind)


Title: Re: How to compile static version bitcoind?
Post by: achow101 on October 06, 2016, 12:30:55 PM
Ok.. How about this command?
Code:
./configure --enable-glibc-back-compat --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++"


Title: Re: How to compile static version bitcoind?
Post by: kzv on October 06, 2016, 01:08:02 PM
Ok.. How about this command?
Code:
./configure --enable-glibc-back-compat --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++"

It works!!!
Thank you very much!!!  :)