[PATCH] Makefile: libfdt: build only the strict necessary

Claudio Fontana posted 1 patch 4 years ago
Test docker-mingw@fedora failed
Test docker-quick@centos7 failed
Test checkpatch passed
Test FreeBSD passed
Test asan failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200408070231.20265-1-cfontana@suse.de
There is a newer version of this series
Makefile  | 21 ++++++++++-----------
configure |  6 +-----
2 files changed, 11 insertions(+), 16 deletions(-)
[PATCH] Makefile: libfdt: build only the strict necessary
Posted by Claudio Fontana 4 years ago
when building dtc/libfdt, we were previously using dtc/Makefile,
which tries to build some artifacts that are not needed,
and can complain on stderr about the absence of tools that
are not required to build just libfdt.

Instead, build only the strict necessary to get libfdt.a .

Remove the subdir-dtc "compatibility gunk" for recursion,
since we are not recursing anymore.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
 Makefile  | 21 ++++++++++-----------
 configure |  6 +-----
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 84ef881600..8a461534d9 100644
--- a/Makefile
+++ b/Makefile
@@ -526,15 +526,16 @@ $(SOFTMMU_FUZZ_RULES): $(edk2-decompressed)
 $(TARGET_DIRS_RULES):
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
 
-DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
-DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
-DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
-
-.PHONY: dtc/all
-dtc/all: .git-submodule-status dtc/libfdt dtc/tests
-	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
-
-dtc/%: .git-submodule-status
+LIBFDT_srcdir = $(SRC_PATH)/dtc/libfdt
+LIBFDT_objdir = dtc/libfdt
+LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
+include $(LIBFDT_srcdir)/Makefile.libfdt
+LIBFDT_objects = $(addprefix $(LIBFDT_objdir)/, $(LIBFDT_OBJS))
+.PHONY: libfdt
+libfdt: .git-submodule-status $(LIBFDT_archive)
+$(LIBFDT_archive): $(LIBFDT_objects)
+$(LIBFDT_objects): | $(LIBFDT_objdir)
+$(LIBFDT_objdir): .git-submodule-status
 	@mkdir -p $@
 
 # Overriding CFLAGS causes us to lose defines added in the sub-makefile.
@@ -563,7 +564,6 @@ slirp/all: .git-submodule-status
 
 # Compatibility gunk to keep make working across the rename of targets
 # for recursion, to be removed some time after 4.1.
-subdir-dtc: dtc/all
 subdir-capstone: capstone/all
 subdir-slirp: slirp/all
 
@@ -821,7 +821,6 @@ distclean: clean
 	rm -rf $$d || exit 1 ; \
         done
 	rm -Rf .sdk
-	if test -f dtc/version_gen.h; then $(MAKE) $(DTC_MAKE_ARGS) clean; fi
 
 KEYMAPS=da     en-gb  et  fr     fr-ch  is  lt  no  pt-br  sv \
 ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th \
diff --git a/configure b/configure
index 22870f3867..eb50d50b0a 100755
--- a/configure
+++ b/configure
@@ -4278,10 +4278,6 @@ EOF
       if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
           fdt=git
           mkdir -p dtc
-          if [ "$pwd_is_source_path" != "y" ] ; then
-              symlink "$source_path/dtc/Makefile" "dtc/Makefile"
-              symlink "$source_path/dtc/scripts" "dtc/scripts"
-          fi
           fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
           fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
           fdt_libs="$fdt_libs"
@@ -8151,7 +8147,7 @@ echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
 echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
 
 if [ "$fdt" = "git" ]; then
-  echo "config-host.h: dtc/all" >> $config_host_mak
+  echo "config-host.h: libfdt" >> $config_host_mak
 fi
 if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
   echo "config-host.h: capstone/all" >> $config_host_mak
-- 
2.16.4


Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

=== OUTPUT BEGIN ===
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
  LD      dtc/libfdt/Makefile.libfdt.mo
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4

real    0m0.410s
user    0m0.216s


The full log is available at
http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

=== OUTPUT BEGIN ===
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
  LD      dtc/libfdt/Makefile.libfdt.mo
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4

real    0m0.512s
user    0m0.320s


The full log is available at
http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by no-reply@patchew.org 4 years ago
Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/



Hi,

This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===

=== OUTPUT BEGIN ===
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
  LD      dtc/libfdt/Makefile.libfdt.mo
cc: fatal error: no input files
compilation terminated.
make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4

real    0m0.585s
user    0m0.384s


The full log is available at
http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by Claudio Fontana 4 years ago
Hi,

On 4/8/20 9:06 AM, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/
> 
> 
> 
> Hi,
> 
> This series failed the asan build test. Please find the testing commands and
> their output below. If you have Docker installed, you can probably reproduce it
> locally.

I can't reproduce this here running the commands (TEST SCRIPT) below..

> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> export ARCH=x86_64
> make docker-image-fedora V=1 NETWORK=1
> time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
> === TEST SCRIPT END ===
> 
> === OUTPUT BEGIN ===
> Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory

hmm this is the include directive

include $(LIBFDT_srcdir)/Makefile.libfdt

is this test not getting the dtc submodule for some reason?

> cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 

Hmm..

> cc: fatal error: no input files
> compilation terminated.
> make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
> Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
>   LD      dtc/libfdt/Makefile.libfdt.mo
> cc: fatal error: no input files
> compilation terminated.
> make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
> 
> real    0m0.585s
> user    0m0.384s
> 
> 
> The full log is available at
> http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.asan/?type=message.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com
> 


Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by Daniel P. Berrangé 4 years ago
On Wed, Apr 08, 2020 at 09:49:56AM +0200, Claudio Fontana wrote:
> Hi,
> 
> On 4/8/20 9:06 AM, no-reply@patchew.org wrote:
> > Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/
> > 
> > 
> > 
> > Hi,
> > 
> > This series failed the asan build test. Please find the testing commands and
> > their output below. If you have Docker installed, you can probably reproduce it
> > locally.
> 
> I can't reproduce this here running the commands (TEST SCRIPT) below..
> 
> > 
> > === TEST SCRIPT BEGIN ===
> > #!/bin/bash
> > export ARCH=x86_64
> > make docker-image-fedora V=1 NETWORK=1
> > time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
> > === TEST SCRIPT END ===
> > 
> > === OUTPUT BEGIN ===
> > Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
> 
> hmm this is the include directive
> 
> include $(LIBFDT_srcdir)/Makefile.libfdt
> 
> is this test not getting the dtc submodule for some reason?

Note that this test script did not even get as far as trying to
build QEMU itself.

Starting from a clean checkout *WITHOUT* having run configure,
it is trying todo

   make docker-image-fedora V=1 NETWORK=1

This should invoke the rules to launch docker, and then run
configure inside docker. Instead it is trying to build dtc.

So something in your changes has broken the ability to run
the docker make targets.

> 
> > cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 
> 
> Hmm..
> 
> > cc: fatal error: no input files
> > compilation terminated.
> > make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
> > Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
> >   LD      dtc/libfdt/Makefile.libfdt.mo
> > cc: fatal error: no input files
> > compilation terminated.
> > make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
> > 
> > real    0m0.585s
> > user    0m0.384s
> > 
> > 
> > The full log is available at
> > http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.asan/?type=message.
> > ---
> > Email generated automatically by Patchew [https://patchew.org/].
> > Please send your feedback to patchew-devel@redhat.com
> > 
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Re: [PATCH] Makefile: libfdt: build only the strict necessary
Posted by Claudio Fontana 4 years ago
On 4/8/20 11:08 AM, Daniel P. Berrangé wrote:
> On Wed, Apr 08, 2020 at 09:49:56AM +0200, Claudio Fontana wrote:
>> Hi,
>>
>> On 4/8/20 9:06 AM, no-reply@patchew.org wrote:
>>> Patchew URL: https://patchew.org/QEMU/20200408070231.20265-1-cfontana@suse.de/
>>>
>>>
>>>
>>> Hi,
>>>
>>> This series failed the asan build test. Please find the testing commands and
>>> their output below. If you have Docker installed, you can probably reproduce it
>>> locally.
>>
>> I can't reproduce this here running the commands (TEST SCRIPT) below..
>>
>>>
>>> === TEST SCRIPT BEGIN ===
>>> #!/bin/bash
>>> export ARCH=x86_64
>>> make docker-image-fedora V=1 NETWORK=1
>>> time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
>>> === TEST SCRIPT END ===
>>>
>>> === OUTPUT BEGIN ===
>>> Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
>>
>> hmm this is the include directive
>>
>> include $(LIBFDT_srcdir)/Makefile.libfdt
>>
>> is this test not getting the dtc submodule for some reason?
> 
> Note that this test script did not even get as far as trying to
> build QEMU itself.
> 
> Starting from a clean checkout *WITHOUT* having run configure,
> it is trying todo
> 
>    make docker-image-fedora V=1 NETWORK=1
> 
> This should invoke the rules to launch docker, and then run
> configure inside docker. Instead it is trying to build dtc.
> 
> So something in your changes has broken the ability to run
> the docker make targets.

Thanks, I can reproduce this now, will correct.

> 
>>
>>> cc -nostdlib  -o dtc/libfdt/Makefile.libfdt.mo 
>>
>> Hmm..
>>
>>> cc: fatal error: no input files
>>> compilation terminated.
>>> make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
>>> Makefile:532: dtc/libfdt/Makefile.libfdt: No such file or directory
>>>   LD      dtc/libfdt/Makefile.libfdt.mo
>>> cc: fatal error: no input files
>>> compilation terminated.
>>> make: *** [dtc/libfdt/Makefile.libfdt.mo] Error 4
>>>
>>> real    0m0.585s
>>> user    0m0.384s
>>>
>>>
>>> The full log is available at
>>> http://patchew.org/logs/20200408070231.20265-1-cfontana@suse.de/testing.asan/?type=message.
>>> ---
>>> Email generated automatically by Patchew [https://patchew.org/].
>>> Please send your feedback to patchew-devel@redhat.com
>>>
>>
>>
> 
> Regards,
> Daniel
>