Skip to content

Commit 9430863

Browse files
vriesdavidmalcolm
authored andcommitted
Makefile: Prepend to LD_LIBRARY_PATH, instead of overwriting it
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.
1 parent ef78bdc commit 9430863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ plugin: autogenerated-config.h $(PLUGIN_DSO)
132132
# When running the plugin from a working copy, use LD_LIBARY_PATH=gcc-c-api
133133
# so that the plugin can find its libgcc-c-api.so there
134134
#
135-
INVOCATION_ENV_VARS := LD_LIBRARY_PATH=gcc-c-api CC=$(CC)
135+
INVOCATION_ENV_VARS := LD_LIBRARY_PATH=gcc-c-api:$(LD_LIBRARY_PATH) CC=$(CC)
136136

137137
# When installing, both the plugin and libgcc-c-api.so will be installed to
138138
# $(GCCPLUGINS_DIR), so we give the plugin an RPATH of $(GCCPLUGINS_DIR)

0 commit comments

Comments
 (0)