Closed skironDotNet closed 6 years ago
./configure --with-incompatible-bdb
if you want to use any version provided by ubuntu with apt install libdb++-dev libdb-dev
else, you will need to do the following: 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 make install
On Wed, Sep 19, 2018 at 2:59 AM Pawel Cioch notifications@github.com wrote:
I used Dash documentation and I was able to compile on Ubuntu 16 but compiled version by me complains about missing libdb_cxx-4.8.so while on the same machine binaries provided by you works just fine. Also my binaries let say crownd is 113MB in size while yours 11MB, I don't know how to compile in release mode. I was unable to compile for windows on Ubuntu 16 despite having all the dependencies installed. I tried may approaches using documentations from Crown source code, using public doc deom Dash and Bitcoin, all quite similar, so after whole day of trying I just got linux binaries no matter what.
So could someone provide with detailed documentation how to compile to get same results as you do? I don't need dependencies ie sudo apt install libventxxx, just final compilation commands ./autogen ... what flags for ./configure or make and so on
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Crowndev/crown-core/issues/92, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0r31s53c_GclTkO1rOoVOCEtliqEiQks5ucZb4gaJpZM4WvOU3 .
--
Mvh Fabian Olesen
If it moves, compile it.
Yes I found about Barkley DB here https://michael.mckinnon.id.au/2016/05/13/building-a-namecoin-server-with-ubuntu-16-04/
Now there is a pice of code in file crown-core/depends/Makefile
ifneq ($(DEBUG),) release_type=debug else release_type=release endif
What about the flags for debug vs release version again I think this is what makes the size difference for crownd 111.2MB (mine) vs 10.1MB (yours)
error while loading shared libraries: libboost_system.so.1.58.0
So there must be some undocumented "magic" ie. flags that change the way output binary is compiled or just "simple" knowledge of experienced people that is not documented because too obvious to them
I hope you'll be patient with me... on Thursday I'll try on fresh Ubuntu 18.04 as recommended in Dash/Bitcoin docs and I'll try first with
./configure --with-incompatible-bdb
Thank you.
@skironDotNet You can't (easily) compile an executable for Windows on linux.
Self-compiled executables are usually dynamically linked. They rely on shared libraries on your machine to provide some of the code. If you move the executable to a different machine it will only run if the same (version) shared libraries are installed. The libboost version is different between Ubuntu 14.04 and 16.04 (and 18.04)
If you statically link your executables they include all the dependencies they need in the executable. This (usually) makes them much larger, but you can move them between different machines (having different versions of "common" shared libraries) and they will execute perfectly.
Bitcoin and altcoins traditionally compile with BDB 4.8, but can run happily with 5.3 (using --with-incompatible-bdb switch). The potential problem is backwards incompatibility; once you've run with 5.3 you can't go back to 4.8.
You are likely to run into assorted problems compiling on Ubuntu 18.04. The reliable way to resolve them is to build all the depends that Crown needs and then link with them. Do that by
cd crowncoin
./autogen.sh
make -C depends
-- this will download the source for all the dependencies, compile them all and stick the results in crowncoin/depends/x86_64-unknown-linux-gnu (assuming you're on a 64-bit machine). It'll take between about 1 and 6 hours depending on your network speed and CPU. Then you can
./configure --prefix=/path/to/crowncoin/depends/x86_64-unknown-linux-gnu <any other switches>
make
It's important to specify the full absolute path to the depends directory. You can add any other configuration switches you want, eg: --disable-tests or whatever. You won't need --with-incompatible-bdb. And you'll end up with (mostly) statically linked executables (the C runtime stuff is dynamically linked, all of the SSL, BDB, Qt, Boost and other depends are built-in), specifically
src/crownd
src/crown-cli
src/crown-tx
src/qt/crown-qt (if you didn't disable it)
which you can copy to wherever you want to run them from, eg: /usr/local/bin They'll be pretty large. You can make them much smaller by removing debug symbols using the strip command, eg:
cd /usr/local/bin
sudo strip crownd crown-cli crown-tx crown-qt
Good luck!
@walkjivefly Thank you for this detailed guidance, the strip command I've never seen before anywhere so that's awesome to know.
As for Ubuntu 18 I don't desire to use it, in fact I should ask Crown devs "which OS do you use for linux compilation". Ubuntu 18 is just mentioned in many docs thus I assumed maybe should try...
As for "You can't (easily) compile an executable for Windows on linux." I see the posts linux is preferred OS for compilations for Windows https://docs.dash.org/en/latest/developers/compiling.html#windows-build but I won't argue on that since it doesn't make sense, but I see reasons why it would be actually easier on Linux, for example I've never successfully complied anything C/C++ on windows assuming it needs "make" or even MsBuild. I guess I could try using bash for windows cygwin or whatnot, but it still doesn't make sense as I don't know how to obtain libboost and generally bitcoin ppa libraries... anyhow Windows is not that much of deal for me as far as needing windows binaries.
I'll close this thread, once I'll get some satisfying results
@walkjivefly I used Ubuntu 16.04 using your approach worked, got small binaries even without using strip, but QT didn't build and when used flag --with-gui it was complaining dependencies not found... but linux binaries behaves much better still don't know why they don't work in ubuntu 14 while crown binaries compiled by developers available in release tab work in both 14 and 16, maybe they compile on 14
also found this for windows
cd into depends and do make HOST=x86_64-w64-mingw32 -j4. cd back out and do ./configure --prefix=
pwd
/depends/x86_64-w64-mingw32. Then when you do make you will produce .exe files which only work on windows. – Andrew Chow♦ Feb 8 at 16:03
but again ubuntu 14 i mentioned as required
https://bitcoin.stackexchange.com/a/59707
I'll leave this thread open for now in case crown devs would like to add anything to help understand the whole compilation process
Compiling for Windows on Linux Ubuntu 16.04
Install all dependencies
Delete main source code folder - this is important to start with fresh copy if you already build linux binaries
git clone {source code repo url}
cd repoName, in my case
cd crowncore
This folder may not exists initailly but once created by whatever it may choke on permission so if you get error about that do this
sudo chown -R yourUserName:YourUserName ~/.ccache
This is important! DO NOT RUN ./autogen first!
Prepare Windows dependencies
cd depends
make HOST=x86_64-w64-mingw32 -j4
this will take forever, lots of compilations for windows... once done
Go back to main source folder
cd ..
now autogen should work, and --with-gui flag should work because step 7. prepared everything if not errored somewhere
./autogen.sh
./configure --with-gui --disable-tests --with-incompatible-bdb --prefix=`pwd`/depends/x86_64-w64-mingw32
make
Optional to put all binaries in one place
make install DESTDIR=~/crown-win64
Dig down to bin folder under ~/crown-win64/ the bin folder also contains now libbitcoinconsensus-0.dll file and all .exe files
And here just a little proof src folder contains .exe files
@skironDotNet Glad you had a productive day! Thanks for the info regarding compiling for Windows; that's my "learn something new every day" for today.
I used Dash documentation and I was able to compile on Ubuntu 16 but compiled version by me complains about missing libdb_cxx-4.8.so while on the same machine binaries provided by you works just fine. Also my binaries let say crownd is 113MB in size while yours 11MB, I don't know how to compile in release mode. I was unable to compile for windows on Ubuntu 16 despite having all the dependencies installed. I tried may approaches using documentations from Crown source code, using public doc deom Dash and Bitcoin, all quite similar, so after whole day of trying I just got linux binaries no matter what.
So could someone provide with detailed documentation how to compile to get same results as you do? I don't need dependencies ie sudo apt install libventxxx, just final compilation commands ./autogen ... what flags for ./configure or make and so on