https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107612
--- Comment #10 from Iain Sandoe <iains at gcc dot gnu.org> --- I fixed the plugin build to avoid linking libstdc++ (small additions to Rainer's patch) * linking libstdc++ causes the build to fail because the plugin cannot find the libstdc++ because it is not yet installed. * it's not right to link it anyway - the plugin needs to resolve its symbols from cc1gm2 Adding -nodefaultlibs fixes this + I adjusted the install name. Actually, I do not think the rpaths are needed - because the plugin is explicitly loaded - it does not need to find any dependent libs. ---- diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 0ea73e766d1..8d86c1371f3 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -36,7 +36,10 @@ ifeq (,$(findstring darwin,$(host))) soext=.so else soext=.dylib - PLUGINLDFLAGS=-Wl,-undefined,dynamic_lookup + PLUGINLDFLAGS = -Wl,-undefined,dynamic_lookup + PLUGINLDFLAGS += -Wl,-install_name,m2rte$(soext) + PLUGINLDFLAGS += -Wl,-rpath,@loader_path,-rpath,@loader_path/.. + PLUGINLDFLAGS += -nodefaultlibs endif