my configuration: Solaris-10, GCC 4.8.2, GNU ld 2.25, GLIB 2.45.2 % which make /MY_BIN/bin/make % make -v GNU Make 3.82
% which gcc /MY_BIN/bin/gcc % gcc -v gcc version 4.8.2 (GCC) % which ld /MY_BIN/bin/ld % ld -v GNU ld (GNU Binutils) 2.25 When compiling this GLIB, it fails during the compilation of its 'gmodule' with the following error: ... CCLD gtester GEN glib-public-headers.txt make[5]: Leaving directory `/MY_SRC/glib-2.45.2/glib' Making all in tests make[5]: Entering directory `/MY_SRC/glib-2.45.2/glib/tests' /MY_BIN/bin/make all-am make[6]: Entering directory `/MY_SRC/glib-2.45.2/glib/tests' make[6]: Nothing to be done for `all-am'. make[6]: Leaving directory `/MY_SRC/glib-2.45.2/glib/tests' make[5]: Leaving directory `/MY_SRC/glib-2.45.2/glib/tests' make[4]: Leaving directory `/MY_SRC/glib-2.45.2/glib' make[3]: Leaving directory `/MY_SRC/glib-2.45.2/glib' Making all in gmodule make[3]: Entering directory `/MY_SRC/glib-2.45.2/gmodule' /MY_BIN/bin/make all-am make[4]: Entering directory `/MY_SRC/glib-2.45.2/gmodule' CCLD libgmodule-2.0.la ld: fatal: unrecognized option '--' ld: fatal: use the -z help option for usage information collect2: error: ld returned 1 exit status make[4]: *** [libgmodule-2.0.la] Error 1 make[4]: Leaving directory `/MY_SRC/glib-2.45.2/gmodule' make[3]: *** [all] Error 2 make[3]: Leaving directory `/MY_SRC/glib-2.45.2/gmodule' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/MY_SRC/glib-2.45.2' make[1]: *** [all] Error 2 make[1]: Leaving directory `/MY_SRC/glib-2.45.2' Doing a 'make' in that 'gmodule' subdir on its own yields exactly the same error: cd /MY_SRC/glib-2.45.2/gmodule; make make all-am make[1]: Entering directory `/MY_SRC/glib-2.45.2/gmodule' CCLD libgmodule-2.0.la ld: fatal: unrecognized option '--' ld: fatal: use the -z help option for usage information collect2: error: ld returned 1 exit status make[1]: *** [libgmodule-2.0.la] Error 1 make[1]: Leaving directory `/MY_SRC/glib-2.45.2/gmodule' make: *** [all] Error 2 In the 'Makefile' of that directory, I added on line 949 an 'echo' command of what it does to compile target 'libgmodule-2.0.la', prior to letting this command execute as it normally does: vi Makefile ... libgmodule-2.0.la: $(libgmodule_2_0_la_OBJECTS) $(libgmodule_2_0_la_DEPENDENCIES) $(EXTRA_libgmodule_2_0_la_DEPENDENCIES) @echo "$(AM_V_CCLD)$(libgmodule_2_0_la_LINK) -rpath $(libdir) $(libgmodule_2_0_la_OBJECTS) $(libgmodule_2_0_la_LIBADD) $(LIBS)" $(AM_V_CCLD)$(libgmodule_2_0_la_LINK) -rpath $(libdir) $(libgmodule_2_0_la_OBJECTS) $(libgmodule_2_0_la_LIBADD) $(LIBS) This gives a little more info about which exact 'ld' command-line is failing: cd /MY_SRC/glib-2.45.2/gmodule; make make all-am make[1]: Entering directory `/MY_SRC/glib-2.45.2/gmodule' @echo CCLD libgmodule-2.0.la;/bin/bash ../libtool --silent --tag=CC --mode=link /MY_BIN/bin/gcc -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -g -O2 -Wl,--export-dynamic -version-info 4502:0:4502 -export-dynamic -o libgmodule-2.0.la -rpath /MY_BIN/lib libgmodule_2_0_la-gmodule.lo ../glib/libglib-2.0.la -lintl CCLD libgmodule-2.0.la ld: fatal: unrecognized option '--' ld: fatal: use the -z help option for usage information collect2: error: ld returned 1 exit status make[1]: *** [libgmodule-2.0.la] Error 1 make[1]: Leaving directory `/MY_SRC/glib-2.45.2/gmodule' make: *** [all] Error 2 Suspecting the option "-Wl,--export-dynamic" , I remove that one from the command-line : cd /MY_SRC/glib-2.45.2/gmodule; /bin/bash ../libtool --silent --tag=CC --mode=link /MY_BIN/bin/gcc -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -g -O2 -version-info 4502:0:4502 -export-dynamic -o libgmodule-2.0.la -rpath /MY_BIN/lib libgmodule_2_0_la-gmodule.lo ../glib/libglib-2.0.la -lintl libtool: link: (cd ".libs" && rm -f "libgmodule-2.0.so.0" && ln -s "libgmodule-2.0.so.0.4502.0" "libgmodule-2.0.so.0") libtool: link: (cd ".libs" && rm -f "libgmodule-2.0.so" && ln -s "libgmodule-2.0.so.0.4502.0" "libgmodule-2.0.so") libtool: link: ( cd ".libs" && rm -f "libgmodule-2.0.la" && ln -s "../libgmodule-2.0.la" "libgmodule-2.0.la" ) -> SUCCESS ! So why is this "-Wl,--export-dynamic" breaking the "ld" ? When I check the documented options for this 'ld' program: % ld --help | grep 'export-dynamic' -E, --export-dynamic Export all dynamic symbols --no-export-dynamic Undo the effect of --export-dynamic Does anyone know what could possibly going wrong here ?