Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: CozyLife on September 03, 2014, 11:40:09 PM



Title: How do you build the Bitcoin deamon for all targets at once?
Post by: CozyLife on September 03, 2014, 11:40:09 PM
I'd like to build the Bitcoin deamon for Linux, Windows, and OSX all at the same time, or at least all from Ubuntu Linux in some way. I'm a web developer, not a software developer, so if this isn't possible, please let me know.


Title: Re: How do you build the Bitcoin deamon for all targets at once?
Post by: btchris on September 04, 2014, 01:24:52 AM
It's possible, but it can be a bit of a pain if you've never done it before. It's the way that the official binaries are built.

On the plus side, it's very well documented here (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md).

If you're starting with an existing Ubuntu system, you can skip down to "Setting up Debian for gitian building" (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md#setting-up-debian-for-gitian-building). This particular section needs a few changes for Ubuntu (it was originally written for Debian 7.4). Specifically, the apt-get line should read:
Code:
sudo apt-get install apt-cacher-ng git python-vm-builder ruby1.9.1 lxc
Don't run the "adduser debian sudo" line. The "set up LXC and the rest with the following, which is a complex jumble of settings and workarounds" section is partly unnecessary, and it should instead look like this for Ubuntu:
Code:
# the version of lxc-start in Ubuntu needs to run as root, so make sure
# that the build script can execute it without providing a password
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" | sudo tee /etc/sudoers.d/gitian-lxc >/dev/null
sudo chmod 440 /etc/sudoers.d/gitian-lxc
# make sure that USE_LXC is always set when logging in,
# and configure LXC IP addresses
echo 'export USE_LXC=1' >> ~/.profile
echo 'export LXC_GUEST_IP=10.0.3.5' >> ~/.profile
echo 'export GITIAN_HOST_IP=10.0.3.1' >> ~/.profile
echo 'export LXC_BRIDGE=lxcbr0' >> ~/.profile
The section which talks about manually installing python-vm-builder can be ignored.

The rest of this document should work on Ubuntu.

One important note: if you're running this on a fully updated Ubuntu 14.04 system, it won't work due to a bug (see here) (https://github.com/devrandom/gitian-builder/issues/63). I think it should work on most previous releases of Ubuntu, or on an unupdated version of 14.04 (but not 14.04.1), but I'm not certain of this....

(edited several times...)


Title: Re: How do you build the Bitcoin deamon for all targets at once?
Post by: CozyLife on September 04, 2014, 02:39:38 AM
It's possible, but it can be a bit of a pain if you've never done it before. It's the way that the official binaries are built.

On the plus side, it's very well documented here (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md).

If you're starting with an existing Ubuntu system, you can skip down to "Setting up Debian for gitian building" (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md#setting-up-debian-for-gitian-building). This particular section needs a few changes for Ubuntu (it was originally written for Debian 7.4). Specifically, the apt-get line should read:
Code:
sudo apt-get install apt-cacher-ng git python-vm-builder ruby1.9.1 qemu-utils debootstrap lxc
Don't run the "adduser debian sudo" line. The "set up LXC and the rest with the following, which is a complex jumble of settings and workarounds" section is partly unnecessary, and it should instead look like this for Ubuntu:
Code:
# the version of lxc-start in Ubuntu needs to run as root, so make sure
# that the build script can execute it without providing a password
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc
# make sure that USE_LXC is always set when logging in,
# and configure LXC IP addresses
echo 'export USE_LXC=1' >> ~/.profile
echo 'LXC_GUEST_IP=10.0.3.5' >> ~/.profile
echo 'GITIAN_HOST_IP=10.0.3.1' >> ~/.profile
echo 'LXC_BRIDGE=lxcbr0' >> ~/.profile
The section which talks about manually installing python-vm-builder can be ignored.

The rest of this document should work on Ubuntu.

One important note: if you're running this on a fully updated Ubuntu 14.04 system, it won't work due to a bug (see here) (https://github.com/devrandom/gitian-builder/issues/63). I think it should work on most previous releases of Ubuntu, or on an unupdated version of 14.04 (but not 14.04.1), but I'm not certain of this....

Awesome! Thank you very much. I'm going to switch to 12.04 instead of 14.04.1 as most of the documentation is built for that anyway.


Title: Re: How do you build the Bitcoin deamon for all targets at once?
Post by: btchris on September 06, 2014, 11:41:42 AM
It's possible, but it can be a bit of a pain if you've never done it before. It's the way that the official binaries are built.

On the plus side, it's very well documented here (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md).

If you're starting with an existing Ubuntu system, you can skip down to "Setting up Debian for gitian building" (https://github.com/bitcoin/bitcoin/blob/master/doc/gitian-building.md#setting-up-debian-for-gitian-building). This particular section needs a few changes for Ubuntu (it was originally written for Debian 7.4). Specifically, the apt-get line should read:
Code:
sudo apt-get install apt-cacher-ng git python-vm-builder ruby1.9.1 lxc
Don't run the "adduser debian sudo" line. The "set up LXC and the rest with the following, which is a complex jumble of settings and workarounds" section is partly unnecessary, and it should instead look like this for Ubuntu:
Code:
# the version of lxc-start in Ubuntu needs to run as root, so make sure
# that the build script can execute it without providing a password
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" | sudo tee /etc/sudoers.d/gitian-lxc >/dev/null
sudo chmod 440 /etc/sudoers.d/gitian-lxc
# make sure that USE_LXC is always set when logging in,
# and configure LXC IP addresses
echo 'export USE_LXC=1' >> ~/.profile
echo 'export LXC_GUEST_IP=10.0.3.5' >> ~/.profile
echo 'export GITIAN_HOST_IP=10.0.3.1' >> ~/.profile
echo 'export LXC_BRIDGE=lxcbr0' >> ~/.profile
The section which talks about manually installing python-vm-builder can be ignored.

The rest of this document should work on Ubuntu.

One important note: if you're running this on a fully updated Ubuntu 14.04 system, it won't work due to a bug (see here) (https://github.com/devrandom/gitian-builder/issues/63). I think it should work on most previous releases of Ubuntu, or on an unupdated version of 14.04 (but not 14.04.1), but I'm not certain of this....

(edited several times...)

FYI the bug affecting 14.04 has been fixed in the current version of Gitian, you can use it as the host OS now (but you should continue to use "precise" as the guest OS as per the docs).