Build failure with make-4.0
Hi,
I'm working through the packages in Beyond Linux From Scratch in
the expectation that make-4.0 would break something. Got about halfway through and started to doubt that. Then I tried qemu.
Initially 1.6.0, which failed, so tried 1.6.1 and that fails the
same way. Found some comments in the June and July archives about ARFLAGS being empty, and particularly a comment from Peter Maydell
(http://lists.gnu.org/archive/html/qemu-devel/2013-06/msg02952.html)
|However, it's not the cause of the problem: | |> ar libfdt/libfdt.a libfdt/fdt.o libfdt/fdt_ro.o libfdt/fdt_wip.o |> libfdt/fdt_sw.o libfdt/fdt_rw.o libfdt/fdt_strerror.o |> ar: two different operation options specified | |...which is that the top level makefile is passing ARFLAGS="" |and so we don't specify any operation to ar at all. For me |the submake is invoked with ARFLAGS ="rv" (which is Make's |default for when ARFLAGS wasn't specified). | |QEMU's configure and makefile don't fiddle with ARFLAGS at all: |are you passing some odd values in from your environment?
So I tried make-3.82 and 1.6.0 built. Here is the output from
1.6.1 mith "V=1", configured with--prefix=/usr --sysconfdir=/etc --target-list=x86_64-softmmu (sorry about the reformatting when I paste) :
make -I/scratch/ken/qemu-1.6.1/dtc VPATH=/scratch/ken/qemu-1.6.1/dtc -C dtc V="1" LIBFDT_srcdir=/scratch/ken/qemu-1.6.1/dtc/libfdt CPPFLAGS="-I/scratch/ken/qemu-1.6.1/dtc -I/scratch/ken/qemu-1.6.1/dtc -I/scratch/ken/qemu-1.6.1/dtc/libfdt" CFLAGS="-O2 -D_FORTIFY_SOURCE=2 -g -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all -I/usr/include/libpng16 -I/usr/include/nss -I/usr/include/nspr -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/scratch/ken/qemu-1.6.1/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/scratch/ken/qemu-1.6.1/tests" LDFLAGS="-Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g " ARFLAGS="" CC="cc" AR="ar" LD="ld" BUILD_DIR=/scratch/ken/qemu-1.6.1 libfdt/libfdt.a make[1]: Entering directory '/scratch/ken/qemu-1.6.1/dtc'
from which I see that ARFLAGS are empty
and at the place where it fails
cc -I/scratch/ken/qemu-1.6.1/dtc -I/scratch/ken/qemu-1.6.1/dtc -I/scratch/ken/qemu-1.6.1/dtc/libfdt -O2 -D_FORTIFY_SOURCE=2 -g -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits
-fstack-protector-all -I/usr/include/libpng16 -I/usr/include/nss
-I/usr/include/nspr -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/scratch/ken/qemu-1.6.1/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/scratch/ken/qemu-1.6.1/tests -o libfdt/fdt_strerror.o -c libfdt/fdt_strerror.c
ar libfdt/libfdt.a libfdt/fdt.o libfdt/fdt_ro.o libfdt/fdt_wip.o libfdt/fdt_sw.o libfdt/fdt_rw.o libfdt/fdt_strerror.o
ar: two different operation options specified Makefile:234: recipe for target 'libfdt/libfdt.a' failed make[1]: *** [libfdt/libfdt.a] Error 1
make[1]: Leaving directory '/scratch/ken/qemu-1.6.1/dtc' Makefile:153: recipe for target 'subdir-dtc' failed
make: *** [subdir-dtc] Error 2
Any suggestions for how to fix this, please ?
ĸen
Signature · 1 line
das eine Mal als Tragödie, dieses Mal als Farce
Quoted 11 lines · Ken Moffat
ar libfdt/libfdt.a
libfdt/fdt.olibfdt/fdt_ro.olibfdt/fdt_wip.olibfdt/fdt_sw.olibfdt/fdt_rw.olibfdt/fdt_strerror.o
ar: two different operation options specified Makefile:234: recipe for target 'libfdt/libfdt.a' failed make[1]: *** [libfdt/libfdt.a] Error 1
make[1]: Leaving directory '/scratch/ken/qemu-1.6.1/dtc' Makefile:153: recipe for target 'subdir-dtc' failed
make: *** [subdir-dtc] Error 2Any suggestions for how to fix this, please ?
Seems I can just
$export ARFLAGS="rv"
before I configure, and it will build and install. Unless there is some reason NOT to do that, please consider this closed.
ĸen
Signature · 1 line
das eine Mal als Tragödie, dieses Mal als Farce
Quoted 4 lines · Ken Moffat
Seems I can just
$export ARFLAGS="rv"
before I configure, and it will build and install. Unless there is some reason NOT to do that, please consider this closed.
Well, the reason would be that nobody in practice will do that. Make should be setting ARFLAGS correctly (as per its documentation) unless you've somehow managed to set ARFLAGS to something incorrect in your environment. If you "unset ARFLAGS" does it work?
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Ken Moffat
Seems I can just
$export ARFLAGS="rv"
before I configure, and it will build and install. Unless there is some reason NOT to do that, please consider this closed.
Quoted 7 lines
Well, the reason would be that nobody in practice will do that. Make should be setting ARFLAGS correctly (as per its documentation) unless you've somehow managed to set ARFLAGS to something incorrect in your environment. If you "unset ARFLAGS" does it work?
-- PMM
I don't normally touch ARFLAGS. Here's a freshly-untarred qemu
tree.
ken@ac4tv /scratch/ken/tmp/qemu-1.6.1 $echo $ARFLAGS
ken@ac4tv /scratch/ken/tmp/qemu-1.6.1 $unset ARFLAGS
./configure --prefix=/usr --sysconfdir=/etc --target-list=x86_64-softmmu make
AR libfdt/libfdt.a
ar: two different operation options specified Makefile:234: recipe for target 'libfdt/libfdt.a' failed make[1]: *** [libfdt/libfdt.a] Error 1 Makefile:153: recipe for target 'subdir-dtc' failed
make: *** [subdir-dtc] Error 2
ĸen
Signature · 1 line
das eine Mal als Tragödie, dieses Mal als Farce
Quoted 19 lines · Ken Moffat
Quoted 8 lines · Peter Maydell
Well, the reason would be that nobody in practice will do that. Make should be setting ARFLAGS correctly (as per its documentation) unless you've somehow managed to set ARFLAGS to something incorrect in your environment. If you "unset ARFLAGS" does it work?
-- PMM
I don't normally touch ARFLAGS. Here's a freshly-untarred qemu
tree.ken@ac4tv /scratch/ken/tmp/qemu-1.6.1 $echo $ARFLAGS
ken@ac4tv /scratch/ken/tmp/qemu-1.6.1 $unset ARFLAGS
./configure --prefix=/usr --sysconfdir=/etc --target-list=x86_64-softmmu make
Quoted 7 lines
AR libfdt/libfdt.a
ar: two different operation options specified Makefile:234: recipe for target 'libfdt/libfdt.a' failed make[1]: *** [libfdt/libfdt.a] Error 1 Makefile:153: recipe for target 'subdir-dtc' failed
make: *** [subdir-dtc] Error 2
I took this to bug-make, but now I'm back here. The first thing in
rules.mak is
# Don't use implicit rules or variables
# we have explicit rules for everything MAKEFLAGS += -rR
and Paul Smith said -
It's a qemu bug, that just happened to work with make-3.82. By adding the -R flag they are stating they don't want to use ANY default variable values. However they are relying on the default variable value for ARFLAGS to be set. If they want to use -R they should set ARFLAGS to an acceptable value in their makefile.
In previous versions of GNU make adding those flags wouldn't take effect in the current instance of make; it would only be in effect in a sub-make; that bug/mis-feature was fixed in GNU make 4.0. Now adding those flags in a makefile takes effect immediately, within that same instance of make. From the NEWS for GNU make 4.0:
* Setting the -r and -R options in MAKEFLAGS inside a makefile now works as expected, removing all built-in rules and variables, respectively.
Thread starts at
http://lists.gnu.org/archive/html/bug-make/2013-10/msg00151.html
ĸen
Signature · 1 line
das eine Mal als Tragödie, dieses Mal als Farce
Quoted 7 lines · Ken Moffat
I took this to bug-make, but now I'm back here. The first thing in
rules.mak is# Don't use implicit rules or variables
# we have explicit rules for everything MAKEFLAGS += -rR
Quoted 7 lines
and Paul Smith said -
It's a qemu bug, that just happened to work with make-3.82. By adding the -R flag they are stating they don't want to use ANY default variable values. However they are relying on the default variable value for ARFLAGS to be set. If they want to use -R they should set ARFLAGS to an acceptable value in their makefile.
Thanks very much for taking the time to follow this up with the make mailing list (and if you happen to post to that list again you could pass on my thanks to Paul for looking into this as well). I guess we should treat ARFLAGS the same way we do LDFLAGS and friends -- capture the setting in configure (with a default of "rv" if unset) and write it to config-host.mak. Then we'll be setting it explicitly for our top level make which can pass it down correctly to the dtc makefile.
I'll put together a patch...
-- PMM