Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: knightmb on July 30, 2010, 05:39:33 AM



Title: Compiling under Linux (0.3.6) - Older Glibc 2.9 version
Post by: knightmb on July 30, 2010, 05:39:33 AM
I know I've seen this topic a half-dozen times (can't compile), but after spending hours hunting down source and compiling every piece of software listed in the build-unix.txt, correcting path errors in the build files, etc.  I still can't get the program compiled on my Mandriva 2010.0 box, LOL.

The error it hangs at is:
Code:
/usr/bin/ld: cannot find -lboost_system
collect2: ld returned 1 exit status
make: *** [bitcoin] Error 1

The program is there, but I'm not familiar enough with how the boost software works to fix the error. If anyone has any feedback or ideas it would be greatly appreciated. I would like to catch up with everyone else on the Linux client front, but I won't be able to use the new version until the next release that supports Linux builds not using bleeding edge software  ;D


Title: Re: Compiling under Linux (0.3.6)
Post by: teknohog on July 30, 2010, 10:47:41 AM
The error it hangs at is:
Code:
/usr/bin/ld: cannot find -lboost_system
collect2: ld returned 1 exit status
make: *** [bitcoin] Error 1

Try changing the link options (LIBS=... variable) from static to dynamic. This has solved the problem for me. It seems that some packages in Gentoo require extra options to enable static linking, and I have not enabled them as I do not need them otherwise.

On the other hand, static linking of some libraries is a good thing for wider distribution of the binaries, so it makes sense in bitcoin by default.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 02:14:35 PM
That seems to solved the problem, but now it hangs on the wxWidgets 2.9 with a screen full of "undefined reference" errors in the for the displayx11.cpp files.  :'(

I think I might have an easier time compiling on the same Distro that he uses in a virtual box rather than have hunting down all these errors.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 03:13:47 PM
I'm going to take the easier route, found a virtual box of Ubuntu 9.04, so I'm going to fire one up, go through the instructions again and see if I can compile a version that isn't using the latest glibc library for those of us on old distros  ;D


Title: Re: Compiling under Linux (0.3.6)
Post by: jgarzik on July 30, 2010, 03:39:20 PM
I know I've seen this topic a half-dozen times (can't compile), but after spending hours hunting down source and compiling every piece of software listed in the build-unix.txt, correcting path errors in the build files, etc.  I still can't get the program compiled, LOL.

The error it hangs at is:
Code:
/usr/bin/ld: cannot find -lboost_system
collect2: ld returned 1 exit status
make: *** [bitcoin] Error 1

A bit tough to elaborate on, since I don't see your Linux OS version.

For some OS's, like Fedora here, you need to link with the multi-threaded boost libs instead.  This implies adding a "-mt" suffix, eg. -lboost_system-mt rather than -lboost_system, for example.

Here is the complete, makefile-free, working solution I use to build bitcoind on Fedora:
Code:
g++ -O3 -ffast-math -march=native -Wno-invalid-offsetof -Wformat -pthread \
-I"/usr/local/openssl-0.9.8/include" \
-o bitcoind \
rpc.cpp main.cpp util.cpp script.cpp db.cpp net.cpp irc.cpp \
init.cpp cryptopp/sha.cpp cryptopp/cpu.cpp \
-L"/usr/local/openssl-0.9.8/lib" \
-l boost_system-mt -l boost_filesystem-mt -l boost_program_options-mt \
-l boost_thread-mt -l db_cxx -l crypto -l gthread-2.0

(openssl 0.9.8 is installed in /usr/local/openssl-0.9.8, everything else is a system lib)


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 03:51:01 PM
Thanks for the help, I did finally get past those errors, got hung up on the wxWidgets even though it's installed exactly as the instructions showed, I don't know enough about wxWidgets to troubleshoot the error.

But I'm building a Ubuntu box on the same setup (well older version) of what the program is being compiled on for release here in hopes it will speed things up for testing rather than troubleshooting different distro builds.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 05:39:37 PM
I've built a Ubuntu 9.04 box and the irony is, when it finally came time to compile, I get the same errors I got on my Mandriva box.

So I'm stuck at the wxWidgets again. I guess I'm not understanding what my wxWidgets issue is. I've downloaded the 2.9 source directly from the website, compiled and installed without any errors. When it comes time to compile bitcoin, it just throws up a ton of wxWidget errors, too long to really paste here.

Has anyone done a successful build of Bitcoin in Linux, if so I'm curious to which Distro you were using?


Title: Re: Compiling under Linux (0.3.6)
Post by: imnichol on July 30, 2010, 06:02:57 PM
I've built a Ubuntu 9.04 box and the irony is, when it finally came time to compile, I get the same errors I got on my Mandriva box.

So I'm stuck at the wxWidgets again. I guess I'm not understanding what my wxWidgets issue is. I've downloaded the 2.9 source directly from the website, compiled and installed without any errors. When it comes time to compile bitcoin, it just throws up a ton of wxWidget errors, too long to really paste here.

Has anyone done a successful build of Bitcoin in Linux, if so I'm curious to which Distro you were using?

Have you read the directions in `path-to-bitcoin-folder`/src/build-unix.txt?
It contains information about how to compile wx 2.9 that you need to follow.  Apologies if you already know this.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 06:12:48 PM
I've built a Ubuntu 9.04 box and the irony is, when it finally came time to compile, I get the same errors I got on my Mandriva box.

So I'm stuck at the wxWidgets again. I guess I'm not understanding what my wxWidgets issue is. I've downloaded the 2.9 source directly from the website, compiled and installed without any errors. When it comes time to compile bitcoin, it just throws up a ton of wxWidget errors, too long to really paste here.

Has anyone done a successful build of Bitcoin in Linux, if so I'm curious to which Distro you were using?

Have you read the directions in `path-to-bitcoin-folder`/src/build-unix.txt?
It contains information about how to compile wx 2.9 that you need to follow.  Apologies if you already know this.
Yeah, I'm following those to the letter, but I think that's my issue is, there might be a step missing because when compiling bitcoin, the errors point towards something else missing in the wx2.9 stuff (maybe an additional step) necessary. I think I'm close to figuring it out, if I do, I'll be sure to post it and hopefully have the text updated for future people to avoid any frustration  ;D


Title: Re: Compiling under Linux (0.3.6)
Post by: imnichol on July 30, 2010, 06:38:39 PM
Yeah, I'm following those to the letter, but I think that's my issue is, there might be a step missing because when compiling bitcoin, the errors point towards something else missing in the wx2.9 stuff (maybe an additional step) necessary. I think I'm close to figuring it out, if I do, I'll be sure to post it and hopefully have the text updated for future people to avoid any frustration  ;D
You downloaded all the dependencies too?  I know I had a bunch of problems until I did that.  Good luck, I've done it myself so it's definitely possible.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 06:55:55 PM
As far as I know, but I finally got past the wxWidgets problem (typo in a command while installing, grrr)

I've finally landed at the libboost-dev-all package to install, but it's not found in the Ubuntu repository for some reason? I guess I'll just install anything/everything that has to do with boost-dev   ;D


Title: Re: Compiling under Linux (0.3.6)
Post by: imnichol on July 30, 2010, 07:01:56 PM
As far as I know, but I finally got past the wxWidgets problem (typo in a command while installing, grrr)

I've finally landed at the libboost-dev-all package to install, but it's not found in the Ubuntu repository for some reason? I guess I'll just install anything/everything that has to do with boost-dev  ;D

That's what I did and it seemed to work.  Cheers!


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 07:06:46 PM
That's what I'm hoping for as well, between compiling from the website then downloading another hundred megabytes worth of files anyway, hehe.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 07:17:38 PM
As far as I know, but I finally got past the wxWidgets problem (typo in a command while installing, grrr)

I've finally landed at the libboost-dev-all package to install, but it's not found in the Ubuntu repository for some reason? I guess I'll just install anything/everything that has to do with boost-dev  ;D

That's what I did and it seemed to work.  Cheers!
Is there a blanket command with apt-get to install everything that has to do with libboost without it error out on package conflicts? I tried to cheat with a "apt-get install libboost*" but it just complains that it's not possible due to conflicts (which I understand since I can't install 2 versions of the same thing at the same time).


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 07:33:43 PM
Victory at last, finally installed enough files to compile, LOL.

But then, I just noticed a 32bit build on Ubuntu 9.04 was just put up, haha.


Title: Re: Compiling under Linux (0.3.6)
Post by: knightmb on July 30, 2010, 08:11:39 PM
I have a 64bit compile of the linux client bitcoin up here that I just finished. All the debug symbols are stripped as well so the file isn't 60+ megabytes in size.
Test at your own risk (like me right now)

64bit Build Only - Client only (bitcoin)
http://knightmb.dyndns.org/files/bitcoin/bitcoin.tar.gz

64bit Build Only - Daemon only (bitcoind)
http://knightmb.dyndns.org/files/bitcoin/bitcoind.tar.gz

Compiled on a Ubuntu 9.04 box with Glibc 2.9 (so those running 2.9, 2.10, 2.11 should work with this)

[edit]New version has come out since then, so those links are valid not anymore.


Title: Re: Compiling under Linux (0.3.6) - Older Glibc 2.9 version
Post by: imnichol on August 02, 2010, 03:20:58 PM
Now if we can get a repository set up, everything will be awesome.


Title: Re: Compiling under Linux (0.3.6)
Post by: molecular on March 16, 2011, 04:56:11 PM
Try changing the link options (LIBS=... variable) from static to dynamic. This has solved the problem for me. It seems that some packages in Gentoo require extra options to enable static linking, and I have not enabled them as I do not need them otherwise.

Thanks! That did the trick for me (gentoo).

Likely could've also put "dev-libs/boost static-libs" in /usr/portage/package.use and reemerged boost.