비트코인 소스 컴파일
아래 내용대로, 윈도우7에서 비트코인 소스를 컴파일해보았다.
결과 : 성공(?)
경고, 에러가 엄청 나온다.
여러가지 소스(라이브러리)를 사용하여,
전문가가 아니면, 컴파일조차 어렵다.
이런 어려운 소스코드가 제대로(?) 동작한다는게 놀라울 뿐이다.
"Boost Jam"컴파일은 너무 오래걸린다. ㅠ ㅠ
OpenSSL등은 err가 떠서, 아래처럼 소스일부를 추가했다.
#ifndef ERROR_INVALID_FLAGS
#define ERROR_INVALID_FLAGS 0x3EC
#endif
#ifndef ERROR_NO_UNICODE_TRANSLATION
#define ERROR_NO_UNICODE_TRANSLATION 0x459
#endif
https://bitcoin.stackexchange.com/questions/587/how-do-i-build-bitcoin-source-in-windows-7
Install:
- MinGW Automated Installer from
http://sourceforge.net/projects/mingw/files/OldFiles/mingw-get-inst/mingw-get-inst-20110316/. Install with the C++ and MSYS options checked.
오래되어 설치가 안됨.
https://sourceforge.net/projects/mingw-w64/files/latest/download
MSYS 1.0.11 - Activestate Perl (for building openssl) from
http://www.activestate.com/activeperl/downloads. You don't need
anything except ActivePerl and Perl, none of the other fancy crap.
You do want to add Perl to your PATH (its an option in the
installer).
Windows Installer (EXE)
윈도우XP에서 설치가 안됨
The Windows Installer Service could not be accessed
Windows Installer 서비스 시작
서비스가 로컬 컴퓨터에서 시작했다가 중지되었습니다. 어떤 서비스는 할 작업이 없으면 자동으로 중지됩니다.
Download:
- WxWidgets 2.9.1:
http://sourceforge.net/projects/wxwindows/files/2.9.1/wxWidgets-2.9.1.zip/download. Unzip to C:\wxWidgets-2.9.1-mgw - OpenSSL 1.0.0d: http://www.openssl.org/source/openssl-1.0.0d.tar.gz. Untar to C:\openssl-1.0.0c-mgw (yes bitcoin is designed to build with 1.0.0c, but might as well use the latest version since it works right?) Hint: untar using the tar binary which is included in MinGW (do not use 7-zip, it will not handle symlinks correctly) using cd \c\ && tar xvvf\c\Users\Matt\Downloads\openssl-1.0.0d.tar.gz && mv openssl-1.0.0d openssl-1.0.0c-mgw in the msys shell
- Berkeley DB 4.7.25 NC: http://download.oracle.com/berkeley-db/db-4.7.25.NC.zip. Unzip to C:\db-4.7.25.NC-mgw
- Boost 1.43.0:
http://sourceforge.net/projects/boost/files/boost/1.43.0/boost_1_43_0.zip/download. Unzip to C:\boost-1.43.0-mgw Boost Jam:
http://sourceforge.net/projects/boost/files/boost-jam/3.1.18/boost-jam-3.1.18-1-ntx86.zip/download. Unzip wherever you like, I used C:\bjamminiUPnPc binary
http://miniupnp.tuxfamily.org/files/download.php?file=upnpc-exe-win32-20110215.zip. Unzip to C:\upnpc-exe-win32-20110215miniUPnPc source
http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.5.20110215.tar.gz. Untar to C:\upnpc-exe-win32-20110215\miniupnpc (you only need *.h, but the others won't hurt) untar with cd \c\upnpc-exe-win32-20110215 && tar xvvf \c\Users\Matt\Downloads\miniupnpc-1.5.20110215.tar.gz && mv miniupnpc-1.5.20110215 miniupnpc
Note that the reason for using the binary miniupnpc release is that I was unable to get it to build on my system.
Add C:\MinGW\bin to your PATH environment variable (Google is your friend as it depends on your Windows Version).
In the DOS Shell:
wxWidgets:
cd \wxWidgets-2.9.1-mgw\build\msw
mingw32-make -f makefile.gcc
Boost:
cd \boost-1.43.0-mgw
\bjam\bjam.exe toolset=gcc --build-type=complete stage
In the msys Shell (MinGW shell in your start folder or C:\MinGW\msys\1.0\msys.bat):
MinGW는 C:\MinGW\msys\1.0\msys.bat 을 실행하면된다.
MinGW창에 붙여넣기하려면, 창의 왼쪽 상단의 "시스템메뉴->편집->붙여넣기"하면된다.
OpenSSL:
cd /c/openssl-1.0.0c-mgw
./config
make
perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
Copy the libeay32.dll file to the folder where you are building/running bitcoin.
libeay32.dll파일이 생성되었다.
Berkeley DB:
cd /c/db-4.7.25.NC-mgw/build_unix sh ../dist/configure --enable-mingw --enable-cxx make
rm: cannot lstat `conftest.exe': Permission denied
rm: cannot lstat `conftest.exe': Permission denied
cannot open output file conftest.exe: Permission denied
=> "Application Experience"서비스가 중지상태라서, 에러가 발생했다고한다...
서비스에서 "Application Experience"를 시작하니, 정상적으로 컴파일되었다.
Bitcoin
If you wish to use git to pull keep a local repository, you'll have to download msgit fromhttp://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.4-preview20110204.exe&can=2&q= . Otherwise, you can download the latest zip of bitcoin fromhttps://github.com/bitcoin/bitcoin/zipball/master In the msys shell, cd to the unzipped location and
make -f makefile.mingw
Run with ./bitcoin.exe (make sure you have the libeay32.dll in bitcoin folder)
비트코인 소스 컴파일
https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/
# Update & Upgrade the System sudo apt-get update sudo apt-get upgrade # Install dependencies there might be more based on your system # However below instructions are for the fresh Ubuntu install/server # Please carefully watch the logs because if something could not be install # You have to make sure it is installed properly by trying the command or that particular # dependency again sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev sudo apt-get install libboost-all-dev sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler sudo apt-get install libqrencode-dev autoconf openssl libssl-dev libevent-dev sudo apt-get install libminiupnpc-dev # Download Bitcoin Source code # ---------------------------- cd ~ git clone https://github.com/bitcoin/bitcoin.git # Bitcoin uses the Berkley DB 4.8 # We need to install it as well # Download & Install Berkley DB # ----------------------------- cd ~ mkdir bitcoin/db4/ wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' tar -xzvf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix/ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/ make install # Compile Bitcoin with Berkley DB 4.8
C:\db-4.7.25.NC-mgw\build_windows
폴더에 Berkeley_DB.dsw 파일이 있고, VC++6.0으로 컴파일이 된다.
x86용으로 Release,Debug 컴파일 해준다.
Debug,Release 폴더에 수많은 exe파일들이 생성된다.
소스에 Oracle이라고 써있다.
소스파일은 *.c,*.cpp로 되어 구성되어있다.
비트코인 소스가 여러가지 언어, 라이브러리로 되어 있는것과 비교될정도로,
Berkley DB 4.8 소스는 컴파일이 쉬웠다.
build_unix, build_windows 폴더가 나뉘어져 있어, 초보자도 컴파일이 쉽다.
이에 비해, 비트코인 소스는 매우 별로다.
소스코드는 가능하면, 구형 컴파일러에서도 무리없이 컴파일이 되어야,
호환성이 좋은 소스라 할 수 있다.
요즘(2018년) 프로그래머들은 최신 컴파일러가 최고인줄 안다.
물론, 좋은점도 많지만, 소스코드 호환성면에서는 높은 점수를 줄 수 없다.
컴파일된 결과물중, DLL, Lib파일만 있으면 될듯 싶다(exe는 유틸리티일듯)
유닉스로 컴파일시, 에러가 뜬다.
rm: cannot lstat `conftest.exe': Permission denied rm: cannot lstat `conftest.exe': Permission denied rm: cannot lstat `conftest.exe': Permission denied
$ make
make: *** No targets specified and no makefile found. Stop.
dist폴더의 install-sh 파일을 install.sh로 변경하여, build_unix 폴더에 넣고, 다시 make
$ make install
cat install.sh >install
chmod a+x install
된것 같은데....
configure
# -----------------------------------
cd ~/bitcoin/
./autogen.sh
# below command ./configure may return with error for dependencies
# you need to make sure that it returns with no error
# If it does please install the dependencies and rerun the /autogen.sh command again and then below command again
./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"
# below command may take 5-10 minutes based on your system
make -s -j5 # If all went well you will be able to access the binary at below location cd ~/bitcoin/ ./src/bitcoind ./src/bitcoin-qt ./src/bitcoin-cli
Valgrind Suppression File : 리눅스용 메모리 맄 디버깅툴(?)
안되서, 기초부터 다시 시작