(verbose) Build fails since gcc-7.4 (libstdc++,libtool)

Michael Joost sonet@michael-joost.de
Mon Mar 25 13:24:00 GMT 2019


(Note: this should probably go into bugzilla, but I don't have an account, and am currently unable to obtain one. Please feel fre to transfer it to there)


Symptom:
Since gcc-7.4, and (at least) 8.2, 8.3, the build of gcc fails in libstdc++:

libtool: compile: mv -f "cxx11-ios_failure.o" "tmp-cxx11-ios_failure-lt.o"
mv: cannot stat 'cxx11-ios_failure.o': No such file or directory
make[5]: *** [Makefile:756: cxx11-ios_failure-lt.s] Error 1

This is tied to the new code introduced recently. From the Makefile:

cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
	$(LTCXXCOMPILE) -S $< -o tmp-cxx11-ios_failure-lt.s
	[...]

While this seems correct on first sight, and the .s file is correctly created by the libtool command,
the problems start with the reminder of the libtool command.
Libtool is somehow deducing that the outcome of the complie has to be an .o object file, ignoring the explicit -o option given on the command line.
The reason for that is the libtool variable setting $compiler_c_o="no" for xgcc.

Going back to the configue phase, the result is:
 lt_cv_prog_compiler_c_o=yes
 lt_cv_prog_compiler_c_o_CXX=no

The corresponding code in configure gives a result of zero, no error messages, but yet evaluates to "no".
Apparently, the configure script does a diff/compre against expected output stored in variable $_lt_compiler_boilerplate, and the compiler output is in fact slightly different.
The critical point here is that $_lt_compiler_boilerplate is set from a flat compile (in the current directory), while the subsequent tests employ a different layout inside an /out subdirectory
While this works mostly, it fails badly if doing a verbose build (using --verbose in CFLAGS and CXXFLAGS). In this case the compiler lists the involved files, and the compare fails.

Fix:
While it is possible to circumvent the build failure with omitting verbose builds or overriding the lt_cv_prog_compiler_c_o_CXX configure variable, it is suggested to fix the libtool.m4 code to handle boilerplate expectation and actual tests with the exactly same file/directory layout.



More information about the Gcc-help mailing list