1

I am very new to C++. I am trying to compile a C++ program which requires some library such as libcurl.a and libcjose.so.0. The compilation is successful and I can run the program in my machine which has those libraries installed.

But when I tried to copy the binary only to another machine, it complains I am missing those libraries:

error while loading shared libraries: libcjose.so.0: cannot open shared object file: No such file or directory

Just wonder is there a way for my to copy/compile the binary only without install those libraries in another machine again?

Kintarō
  • 2,947
  • 10
  • 48
  • 75

2 Answers2

2

You can link all the library statically in your executable. This procedure increase the executable size but let you the possibility to don't have installed libraries.

Further read in :

Zig Razor
  • 3,381
  • 2
  • 15
  • 35
0

You can move the binary with shared libraries (.so, .dll), but it doesn't work very well if you try on another distribution. (ex: builded on Ubuntu, and you try on Fedora).

Gabouchet
  • 181
  • 9