libtool has a command line option to not suppress printing output of the second pass of the compiler on the same object, which basically means it normally hides output which it shouldn't be doing at all. Specifically, libtool uses this: # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' in ltmain.sh to hide stuff, which is very annoying to say the least and hinders bug hunting efforts because it produces bug reports like this: mygcc --FFfobOMG111 2>&1 >/dev/null [Error 1] as exemplified in the URL attached to this bug report. That build log has at least one failed build and one that succeeded, which is perhaps something worth debugging in an entirely different, but the libtool problem remains the same. THIS BUG IS ABOUT LIBTOOL THROWING AWAY USEFUL DEBUGGING INFORMATION. I've seen several cases where either of the non-PIC and PIC compile runs fails, the core of the matter being that in debugging that, libtool shouldn't throw out useful information (ever, at all).
"in an entirely different" <-- bug. Sorry for the bug spam. 8)
this is by design and Gentoo isnt about to change it (even though i agree with you; hiding stderr output by default is stupid) feel free to contact the libtool guys to see if they'll change http://www.gnu.org/software/libtool/libtool.html
*** Bug 250613 has been marked as a duplicate of this bug. ***
I just hit this in a fascinating place. When working on xz, I set `-Werror=suggest-attribute=returns_nonnull`. ``` $ make make all-recursive make[1]: Entering directory '/home/sam/git/xz' Making all in src make[2]: Entering directory '/home/sam/git/xz/src' Making all in liblzma make[3]: Entering directory '/home/sam/git/xz/src/liblzma' Making all in api make[4]: Entering directory '/home/sam/git/xz/src/liblzma/api' make[4]: Nothing to be done for 'all'. make[4]: Leaving directory '/home/sam/git/xz/src/liblzma/api' make[4]: Entering directory '/home/sam/git/xz/src/liblzma' /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3 -Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time -Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wmissing-variable-declarations -Werror -O3 -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wsuggest-attribute=cold -Wsuggest-attribute=malloc -Wsuggest-attribute=returns_nonnull -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c -o liblzma_la-common.lo `test -f 'common/common.c' || echo './'`common/common.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3 -Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time -Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wmissing-variable-declarations -Werror -O3 -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wsuggest-attribute=cold -Wsuggest-attribute=malloc -Wsuggest-attribute=returns_nonnull -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c common/common.c -fPIC -DPIC -o .libs/liblzma_la-common.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3 -Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time -Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wmissing-variable-declarations -Werror -O3 -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wsuggest-attribute=cold -Wsuggest-attribute=malloc -Wsuggest-attribute=returns_nonnull -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c common/common.c -o liblzma_la-common.o >/dev/null 2>&1 make[4]: *** [Makefile:1137: liblzma_la-common.lo] Error 1 make[4]: Leaving directory '/home/sam/git/xz/src/liblzma' make[3]: *** [Makefile:1758: all-recursive] Error 1 make[3]: Leaving directory '/home/sam/git/xz/src/liblzma' make[2]: *** [Makefile:427: all-recursive] Error 1 make[2]: Leaving directory '/home/sam/git/xz/src' make[1]: *** [Makefile:595: all-recursive] Error 1 make[1]: Leaving directory '/home/sam/git/xz' make: *** [Makefile:485: all] Error 2 ``` There's a mysterious '>/dev/null 2>&1' on the second line where liblzma_la-common.o is built without PIC. Indeed, if I run the failing command manually: ``` $ gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wshift-overflow=2 -Wstrict-overflow=3 -Walloc-zero -Wduplicated-cond -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wdate-time -Wsign-conversion -Wfloat-conversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wmissing-variable-declarations -Werror -O3 -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wsuggest-attribute=cold -Wsuggest-attribute=malloc -Wsuggest-attribute=returns_nonnull -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c common/common.c -o liblzma_la-common.o common/common.c: In function ‘lzma_version_string’: common/common.c:27:1: error: function might be candidate for attribute ‘returns_nonnull’ [-Werror=suggest-attribute=returns_nonnull] 27 | lzma_version_string(void) | ^~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ``` With -fPIC, IPA doesn't end up doing attribute discovery. Without it, it does. This behaviour is insane. It needs to be patched out in elt-patches at least.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=9d08565368ff450c17a27bd0394a814d0aa928e7 commit 9d08565368ff450c17a27bd0394a814d0aa928e7 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-04-15 06:17:43 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-04-15 06:17:43 +0000 patches/verbose-pic: new patch to not suppress compiler output (!) Bug: https://bugs.gentoo.org/135865 Signed-off-by: Sam James <sam@gentoo.org> eltpatch.in | 2 +- patches/verbose-pic/2.4.7 | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-)
Fixed in elt-patches. We should still report this upstream though.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=17931e1b6b52d43eb304e5be2319e578e9c22e9f commit 17931e1b6b52d43eb304e5be2319e578e9c22e9f Author: Sam James <sam@gentoo.org> AuthorDate: 2024-07-21 12:35:38 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-07-21 12:35:38 +0000 patches/verbose-pic: add 1.3134-2.2.7a-gnu variant A user reported a confusing failure with GCC, so let's fix it there too. Bug: https://bugs.gentoo.org/135865 Signed-off-by: Sam James <sam@gentoo.org> patches/verbose-pic/1.3134-2.2.7a-gnu | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
Sent upstream for discussion at https://lists.gnu.org/archive/html/libtool-patches/2024-08/msg00000.html.