Make code relocatable

Some times, the CI will fail with symbol lookup error errors, such as:

https://gitlab.cern.ch/lhcb/Allen/-/jobs/6230569

This could be due to code not being relocatable, ie. https://stackoverflow.com/questions/41847916/runtime-symbol-lookup-error-after-compilation-and-linking-of-so .