Best way to distribute a program that uses a shared library

1

I wrote a program that uses a library called curlpp . The program is very simple and all it does is make an HTTP request that returns a JSON (use curlpp to accomplish this request), parse this JSON (use a jsoncons for this) and print on the screen one of its values. The program has only one file of 50 lines. I am developing in Linux Mint and compile with the following command:

g++ -o wrapper main.cpp -lcurl -lcurlpp -std=c++11

The generated executable works normally on my computer, however when I try to run it on other computers it says that the shared curlpp library was not found. I know how it works and what are the differences between shared and static libraries, but my question is:

Do I have to force my user to install curlpp before running my program? Can I distribute curlpp with my program? Is there a way to "merge" this library into my compile-time program?

    
asked by anonymous 14.07.2015 / 02:22

1 answer

2

You need to distribute the library along with your application. You do not necessarily have to install anything, just the library should be together with your application, no matter how you do it. It can be a simple copy.

From what I read in her documentation, the license allows you to distribute it freely without restrictions.

Apparently it has dependencies. So libraries also need to be close to your application. The libCURL license also has no restriction that prevents distribution.

You can link the library statically, then the binaries will be embedded in your application's executable avoiding external dependencies.

For this rather than using the shared library, you need to use the pure library.

You need to read the documentation how to do this for this library specifically. And if it is possible, although almost certainly it is. The license allows to do this. Usually just use the -static directive, but I can not guarantee it. You will need to have curlpp.a .

I'm only worried if the author knows what he's doing. It says "I do not have any license of VC ++ and I do not want to buy one". You do not need to buy any licenses to have a Microsoft compiler. In fact not only is the compilaor free for almost ever, but Visual Studio simplified as well. And it's been a while since the near-complete VS (former Professional) is also free.

libcURL documentation explaining what to do to compile statically.

    
14.07.2015 / 02:35