Issue
I am writing a simple program with C++ using CLion, cmake in Ubuntu.
The program uses CURL, Qt and OpenCV library, so I installed prebuilt packages using apt.
I finished writing my code, uploaded to github, and now I want to define current code as version 1 and make an release.
My initial thought was: build the program as single executable and share it as a release.
But simply copying the executable file, the build result of cmake, does not seem to work on other systems; due to library issues.
For example, I copied the executable to the newly installed-clean ubuntu system, and when I execute it, the shared library error occurs, like with libcurl.
Are there any neat ways to release my program, that makes the user could just download and execute it?
Thank you!
Solution
If you want to release executables for Linux, you're potentially taking on a pile of work. Not only do different Linux distributions handle packaging and dependency management differently, there can be inconsistencies even in different releases of the same distribution.
It's extremely difficult to support even one distribution unless you have a team of people working with you, or you have time on your hands. Every time there's a new release, even a minor one, you'll have to rebuild, retest, and repackage.
Most Linux distributions have tools to simplify packaging, and can produce packages with embedded dependency information, which makes life easier for users. But you're still faced with an ongoing maintenance burden.
Alternatively, you can take the approach that some large Linux projects adopt, and release statically-linked binaries. This usually results in enormous executables, and it still isn't foolproof.
If your application is any good, and it's open source with a reasonable licence, and easily available from a well-known place like GitHub, it may get picked up by distribution maintainers. Building a distribution requires a colossal amount of compilation and packaging, most of which is automated. So adding extra packages, if they build cleanly, isn't a huge hassle for a distro maintainer.
Otherwise, I think your best bet is just to release source code, and document what its dependencies are. Ideally, a build will fail cleanly with a clear warning if dependencies are missing -- sadly, many Linux applications (including my own) fall short of this goal.
Answered By - Kevin Boone