Need help editing a so that shared libraries (Boost, etc.) are included in the Ubuntu build
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

The source code is located here; Multichain. This is a fork of the Bitcoin source code with some additional modifications and code additions. The compiled apps are;





PROBLEM - The following 3 build steps work correctly, in that the 4 programs compile and are executable, but they only work on the computer that built them;




SOLUTION - The shared libraries (,, etc) need to be included in the compiled apps, so they can be used on other Linux machines without having to otherwise sudo apt-get install * the various dependencies.

Clearly denote the changes within the code using comments (e.g.- #, dnl, //, etc.).

I already have a Ubuntu 16.04 build machine setup with all the dependencies installed, as-well-as another Ubuntu 16.04 server for testing (the newly compiled builds). If you need to use these, please advise, and I'll create a user account (SSH) for you on both of the servers to spare you the setup time.

awarded to CyteBode

Crowdsource coding tasks.

3 Solutions


the principle of so library in their name is that they are "shared objects" and cannot be included in your binary.
Possible things to try are the following :

  • build with "-static" flag, in order to use static library instead of shared if available
  • use a tool to make your shared library static like this one

You don't need to edit the Makefiles. You only need to run
./configure LDFLAGS="-static" instead of ./configure.

If you build the course code, and move those executable files to another machine and attempt to run them, you'll get a myriad of 'error while loading shared libraries...'
ericjarvies almost 4 years ago
Winning solution

After taking a quick look at the makefile, I believe that forcing a static compilation through the configure script would not work.

I tried statifier and it gave me some binaries that would just segfault when run on another machine. One or two of the binaries even segfaulted on the original machine itself. That's likely due to statifier's inability to deal with memory randomization, as stated on the homepage.

There is however this commercial product called Ermine that can do the job. I don't know how much it costs, but there's a free trial version.

Download the .i386 or the .x86_64 binary depending on your architecture. Make it executable with chmod +x. Then run ./ErmineProTrial.<arch> <path to original binary> --output <path to output binary> for all four binaries. For example: ./ErmineProTrial.i386 multichain-2.0-dev/src/multichain-cli --output ~/multichain-cli. The light version may work too.

I tried it on a 32-bit Ubuntu 14.04 virtual machine and I could then successfully run all four of the binaries on a 32-bit Debian virtual machine that did not have the dependencies installed.

@CyteBode - This Ermine solution does indeed work, and is a wonderfully simple -yet powerful- solution, and an overall great product imho (highly recommended). However, notwithstanding the cost and a commercial license, it adds another step to the process. Apart from the actual solution, can you provide an assessment of what would be required in order to get this source code to build Linux Ubuntu executable files that include the respective dependencies?
ericjarvies almost 4 years ago
I think the authors simply never intended the binaries to be built with static linking directly. Starting with a clean slate, the is missing this line: AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"]) under TARGET_OS=LINUX at line 320. Then calling ./ and ./configure --disable-shared --enable-static sets things up for static linking, but then compiling with make fails with undefined references to libdl functions in libcrypto.a. I don't know what the fix would be.
CyteBode almost 4 years ago
View Timeline