davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler
GNU General Public License v3.0
198 stars 58 forks source link

Makefile: Prepend to LD_LIBRARY_PATH, instead of overwriting it #127

Closed vries closed 6 years ago

vries commented 6 years ago

When compiling with some-gcc which needs /some-gcc-lib/libxyz.so.1, a way to compile gcc-python-plugin is to write a wrapper some-gcc.sh: ... export LD_LIBRARY_PATH=/some-gcc-lib:$LD_LIBRARY_PATH some-gcc "$@" ... and use "make CC=some-gcc.sh", which works fine.

However, when we try without wrapper: ... export LD_LIBRARY_PATH=/some-gcc-lib:$LD_LIBRARY_PATH make CC=some-gcc ... we run into: ... some-gcc/../../lib64/gcc/x86_64-linux/8/cc1: error while loading shared \ libraries: libxyz.so.1: cannot open shared object file: No such file or \ directory ... because this overwrites LD_LIBRARY_PATH, rather than prepending: ... LD_LIBRARY_PATH=gcc-c-api CC=some-gcc python run-test-suite.py ...

Fix INVOCATION_ENV_VARS in Makefile to prepend to LD_LIBRARY_PATH.

davidmalcolm commented 6 years ago

Thanks!