bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10197: compilation failure with no message caused by libtool


From: Eric Blake
Subject: bug#10197: compilation failure with no message caused by libtool
Date: Fri, 02 Dec 2011 11:41:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

I ran into a weird case today - trying to compile libvirt with CFLAGS
including -Wsuggest-attribute=pure -fipa-pure-const produced a compile
failure, but no message.  It turns out that for the file in question,
libtool ended up compiling things twice, but gcc only warns when -fPIC
is not in effect (for some reason, the combination of fPIC and
-fipa-pure-const appears to not catch the warning, unless -O is also
present).

$ gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib
-I../gnulib/lib -I../include -I../src/util -I../include -DIN_LIBVIRT
-I/usr/include/libxml2 -Wsuggest-attribute=pure -fipa-pure-const -c
util/buf.c -fPIC -DPIC -o a.o

$ gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib
-I../gnulib/lib -I../include -I../src/util -I../include -DIN_LIBVIRT
-I/usr/include/libxml2 -Wsuggest-attribute=pure -fipa-pure-const -c
util/buf.c -o b.o
util/buf.c:86:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]
util/buf.c:227:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]
util/buf.c:242:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]

But because the warning only occurs during the second compilation, I end
up with no warning message:

$ make
make  all-am
make[1]: Entering directory `/home/remote/eblake/libvirt/src'
  CC     libvirt_util_la-buf.lo
make[1]: *** [libvirt_util_la-buf.lo] Error 1
make[1]: Leaving directory `/home/remote/eblake/libvirt/src'
make: *** [all] Error 2

Proof that -O makes a difference:

$ gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib
-I../gnulib/lib -I../include -I../src/util -I../include -DIN_LIBVIRT
-I/usr/include/libxml2 -Wsuggest-attribute=pure -fipa-pure-const -c
util/buf.c -fPIC -DPIC -o a.o -O
util/buf.c: In function ‘virBufferGetIndent’:
util/buf.c:86:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]
util/buf.c: In function ‘virBufferError’:
util/buf.c:227:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]
util/buf.c: In function ‘virBufferUse’:
util/buf.c:242:1: warning: function might be candidate for attribute
‘pure’ [-Wsuggest-attribute=pure]

The full libtool invocation in question:

$ make V=1
make  all-am
make[1]: Entering directory `/home/remote/eblake/libvirt/src'
/bin/sh ../libtool  --tag=CC   --mode=compile ccache gcc -std=gnu99
-DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include
-I../src/util -I../include -DIN_LIBVIRT        -I/usr/include/libxml2
-Wall -W -Wformat-y2k -Wformat-security -Winit-self
-Wmissing-include-dirs -Wunused -Wunknown-pragmas -Wstrict-aliasing
-Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align
-Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes
-Wold-style-definition -Wmissing-prototypes -Wmissing-declarations
-Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls
-Wnested-externs -Winline -Winvalid-pch -Wvolatile-register-var
-Wdisabled-optimization -Wbuiltin-macro-redefined -Wmudflap
-Wpacked-bitfield-compat -Wsync-nand -Wattributes -Wcoverage-mismatch
-Wmultichar -Wabi -Wcpp -Wdeprecated -Wdeprecated-declarations
-Wdiv-by-zero -Wdouble-promotion -Wendif-labels -Wextra
-Wformat-contains-nul -Wformat-extra-args -Wformat-zero-length
-Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow -Wpointer-to-int-cast
-Wpragmas -Wsuggest-attribute=const -Wsuggest-attribute=noreturn
-Wsuggest-attribute=pure -Wtrampolines -Wno-missing-field-initializers
-Wno-sign-compare -Wjump-misses-init -Wno-format-nonliteral
-Wframe-larger-than=4096 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-all
--param=ssp-buffer-size=4 -fexceptions -fasynchronous-unwind-tables
-fdiagnostics-show-option -funit-at-a-time -fipa-pure-const -Werror
 -g -MT libvirt_util_la-buf.lo -MD -MP -MF .deps/libvirt_util_la-buf.Tpo
-c -o libvirt_util_la-buf.lo `test -f 'util/buf.c' || echo './'`util/buf.c
libtool: compile:  ccache gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..
-I../gnulib/lib -I../gnulib/lib -I../include -I../src/util -I../include
-DIN_LIBVIRT -I/usr/include/libxml2 -Wall -W -Wformat-y2k
-Wformat-security -Winit-self -Wmissing-include-dirs -Wunused
-Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings -Wlogical-op
-Waggregate-return -Wstrict-prototypes -Wold-style-definition
-Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn
-Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Winline
-Winvalid-pch -Wvolatile-register-var -Wdisabled-optimization
-Wbuiltin-macro-redefined -Wmudflap -Wpacked-bitfield-compat -Wsync-nand
-Wattributes -Wcoverage-mismatch -Wmultichar -Wabi -Wcpp -Wdeprecated
-Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion
-Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args
-Wformat-zero-length -Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow
-Wpointer-to-int-cast -Wpragmas -Wsuggest-attribute=const
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines
-Wno-missing-field-initializers -Wno-sign-compare -Wjump-misses-init
-Wno-format-nonliteral -Wframe-larger-than=4096 -Wp,-D_FORTIFY_SOURCE=2
-fstack-protector-all --param=ssp-buffer-size=4 -fexceptions
-fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time
-fipa-pure-const -Werror -g -MT libvirt_util_la-buf.lo -MD -MP -MF
.deps/libvirt_util_la-buf.Tpo -c util/buf.c  -fPIC -DPIC -o
.libs/libvirt_util_la-buf.o
libtool: compile:  ccache gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..
-I../gnulib/lib -I../gnulib/lib -I../include -I../src/util -I../include
-DIN_LIBVIRT -I/usr/include/libxml2 -Wall -W -Wformat-y2k
-Wformat-security -Winit-self -Wmissing-include-dirs -Wunused
-Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings -Wlogical-op
-Waggregate-return -Wstrict-prototypes -Wold-style-definition
-Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn
-Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Winline
-Winvalid-pch -Wvolatile-register-var -Wdisabled-optimization
-Wbuiltin-macro-redefined -Wmudflap -Wpacked-bitfield-compat -Wsync-nand
-Wattributes -Wcoverage-mismatch -Wmultichar -Wabi -Wcpp -Wdeprecated
-Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion
-Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args
-Wformat-zero-length -Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow
-Wpointer-to-int-cast -Wpragmas -Wsuggest-attribute=const
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines
-Wno-missing-field-initializers -Wno-sign-compare -Wjump-misses-init
-Wno-format-nonliteral -Wframe-larger-than=4096 -Wp,-D_FORTIFY_SOURCE=2
-fstack-protector-all --param=ssp-buffer-size=4 -fexceptions
-fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time
-fipa-pure-const -Werror -g -MT libvirt_util_la-buf.lo -MD -MP -MF
.deps/libvirt_util_la-buf.Tpo -c util/buf.c -o libvirt_util_la-buf.o
>/dev/null 2>&1
make[1]: *** [libvirt_util_la-buf.lo] Error 1
make[1]: Leaving directory `/home/remote/eblake/libvirt/src'
make: *** [all] Error 2

Any suggestions on how to make libtool display the compiler errors that
occur only when -fPIC is missing?  Or am I stuck not using
-fipa-pure-const without also passing -O?

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]