Infinidat / relocatable-python

build system for building a portable python interpreter
24 stars 8 forks source link

openssl ignores LDFLAGS, and therefore has an rpath that does not contain $ORIGIN/../lib #2

Closed 0xkag closed 10 years ago

0xkag commented 11 years ago

This is on develop commit c848b488c876859f624725e8fdaf633aa6391652 (latest as of right now).

After building, the openssl binary does not contain the $ORIGIN rpath, and instead only contains a fixed rpath that openssl puts in from the --prefix arg to config. openssl does not honor $LDFLAGS. The effect is that openssl will always look for system libcrypto, etc. unless LD_LIBRARY_PATH is explicitly set.

$ objdump -x dist/bin/openssl | grep -i rpath
  RPATH                /home/kag/wc/relocatable-python/dist/lib

The fix is simple, but took a while to figure out because of openssl's non-standard build system and recursive make. Simply append

-Wl,-rpath,\\\$\$\$\$\\\$\$\$\$ORIGIN/../lib

to the configure args in buildout-build.cfg.

After building with this arg, the rpath looks much better:

$ objdump -x dist/bin/openssl | grep -i rpath
  RPATH                /home/kag/wc/relocatable-python/dist/lib:$ORIGIN/../lib

The first path is automatically put there by openssl based on --prefix. (This is a separate issue, because with relocatable things you don't want the build-time prefix in the rpath, and especially not listed first, because it will always win over $ORIGIN if it still exists.)

grzn commented 10 years ago

merged. Thanks!