Compile a shared library into a program?

I wrote a program that uses the shared library installed on my system. This library is rarely installed on other systems. How can I compile my program so that the library is not installed on other systems? I have the source code for an accessible library. What is the best way?

Other systems, of course, have the same architecture and OS.

0
source share
2 answers

Compile it as a static library and link it to the executable.

+3
source

Although the OP solved its problem by answering another question, there are (at least) two ways to wedge a shared library into your binary in case

  • missing source code
  • missing compiler (or assembly chain)
  • static link not working or unclear how to do it
  • to save the memory layout - a static link will change it and hidden errors may “wake up”
  • for the "permalink" LD_PRELOAD library to the executable

The first is a statifier (open source, but limited to x86 and x86_64 and only object code)

The second thing I know is the magic ermine (by the same developer). This is a closed source, but the developer is friendly to open source projects, and ermine has the advantage of supporting more platforms, as well as the ability to include all the necessary data files in its virtual file system.

http://statifier.sourceforge.net/ and http://www.magicermine.com/

+1
source

Source: https://habr.com/ru/post/1234356/


All Articles