Question

I'm quite new to using boost and I can't seem to find documentation anywhere on how to distribute your application when using boost?

Many of the libraries are shared libraries, I'm not expecting my users to have boost installed, I'm only using a single library (regex) so is there an easy way to package the regex library with my application without compiling with the static version?

Was it helpful?

Solution

Linux

For binary distribution, I recommend using the distribution's package management, which should take care of any dependencies. Some commercial apps just use binary blobs and you need to install a version of boost by yourself.

Finding libraries is a bit more difficult on linux. It does not automatically load shared objects from the current directory if they are linked at compile time (as opposed to loading at runtime with dlopen).

You have to use the LD_LIBRARY_PATH env variable or use rpath. Both has it's drawbacks.

Windows

There is no way around including the dlls. The usual approach is to put everything into a directory and zip it up.

Both

To build from source you need the boost sources anyway, so no need to include libraries.

Most libraries in boost are header only anyway, regexp is not one of them. It should be sufficient to include dlls for this module. In Linux you can check against which shared libs your binary is compiled by using:

ldd binary
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top