Skip to contentSkip to conversation

Makefile: libfdt: build only the strict necessary

PATCH Superseded Claudio Fontana 3 participants 7 messages Apr 8, 2020 Kbuild

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: libfdt: build only the strict necessary

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.

---
 Makefile  | 21 ++++++++++-----------
 configure |  6 +-----
 2 files changed, 11 insertions(+), 16 deletions(-)
Makefile +10 -11
index 84ef881600..8a461534d9 100644
@@ -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 \
configure +1 -5
index 22870f3867..eb50d50b0a 100755
@@ -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
Signature · 1 line
2.16.4
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

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/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#2 lore raw

Hi,

Quoted 9 lines · On 4/8/20 9:06 AM, [email protected] wrote:

Patchew URL: https://patchew.org/QEMU/[email protected]/

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..

Quoted 10 lines

=== 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?

Quoted 1 line

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

Hmm..

Quoted 19 lines

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/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#3 lore raw
Quoted 23 lines · Claudio Fontana

Hi,

Quoted 9 lines · On 4/8/20 9:06 AM, [email protected] wrote:

Patchew URL: https://patchew.org/QEMU/[email protected]/

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..

Quoted 8 lines

=== 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 ===

Quoted 8 lines
Quoted 2 lines

=== 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.

Quoted 26 lines
Quoted 2 lines

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

Hmm..

Quoted 19 lines

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/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Regards,
Daniel

Signature · 3 lines
|: 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 :|
#4 lore raw
Quoted 39 lines · Daniel P. Berrangé
Quoted 23 lines · Claudio Fontana

Hi,

Quoted 9 lines · On 4/8/20 9:06 AM, [email protected] wrote:

Patchew URL: https://patchew.org/QEMU/[email protected]/

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..

Quoted 8 lines

=== 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 ===

Quoted 8 lines
Quoted 2 lines

=== 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

Quoted 7 lines

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.

Quoted 31 lines
Quoted 27 lines
Quoted 3 lines

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

Hmm..

Quoted 19 lines

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/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Regards,
Daniel

#5 lore raw
In reply to Claudio Fontana
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

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/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#6 lore raw
In reply to Claudio Fontana
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

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/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]