Creating relocatable Linux executables by setting RPATH with $ORIGIN

Luke Chen
3 min readJul 27, 2019

Lots of modern C/C++ projects leverage Autotools to create GNU building system e.g. generate make files based on the platform. Executable files (binaries) are generated during the make/compile process, and can be executed locally on the machine where the compilation is performed. However, if the same executable were moved onto a different machine, or simply a different folder on the same machine, the “library not found” error might be encountered while running the executable.

What is RPATH and $ORIGIN

--

--

Luke Chen

OpenSource & Automation make me excited. Release engineering @MongoDB