Skip to contentSkip to conversation

contrib/elf2dmp: Build download.o with CURL_CFLAGS

PATCH In review Peter Maydell 2 participants 3 messages Jul 19, 2019 – Jul 22, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 contrib/elf2dmp: Build download.o with CURL_CFLAGS

contrib/elf2dmp has a source file which uses curl/curl.h; although we link the final executable with CURL_LIBS, we forgot to build this source file with CURL_CFLAGS, so if the curl header is in a place that's not already on the system include path then it will fail to build.

Add a line specifying the cflags needed for download.o; while we are here, bring the specification of the libs into line with this, since using a per-object variable setting is preferred over adding them to the final executable link line.

---
I'm pretty sure this is what's causing the compile failure described at:
https://stackoverflow.com/questions/57102476/qemu-recipe-for-target-contrib-elf2dmp-download-o-failed
I haven't actually got a setup that reproduces the error, though, so this is tested by looking at the command lines run on an Ubuntu setup that compiles even without the fix.

There's an argument for splitting this into two patches, I suppose, one which just fixes the CURL_CFLAGS bug and one which tidies the CURL_LIBS handling. But it didn't seem worth it to me. Let me know if you'd prefer it split.

---
 Makefile                      | 1 -
 contrib/elf2dmp/Makefile.objs | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +0 -1
index f9791dcb827..27dabb9b1a0 100644
@@ -626,7 +626,6 @@ ifneq ($(EXESUF),)
 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
 endif
 
-elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
 elf2dmp$(EXESUF): $(elf2dmp-obj-y)
 	$(call LINK, $^)
 
contrib/elf2dmp/Makefile.objs +3 -0
index e3140f58cf7..15057169160 100644
@@ -1 +1,4 @@
 elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o
+
+download.o-cflags := $(CURL_CFLAGS)
+download.o-libs   := $(CURL_LIBS)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 7 lines · Peter Maydell

contrib/elf2dmp has a source file which uses curl/curl.h; although we link the final executable with CURL_LIBS, we forgot to build this source file with CURL_CFLAGS, so if the curl header is in a place that's not already on the system include path then it will fail to build.

Quoted 7 lines

Add a line specifying the cflags needed for download.o; while we are here, bring the specification of the libs into line with this, since using a per-object variable setting is preferred over adding them to the final executable link line.

Quoted 42 lines

---
I'm pretty sure this is what's causing the compile failure described at:
https://stackoverflow.com/questions/57102476/qemu-recipe-for-target-contrib-elf2dmp-download-o-failed
I haven't actually got a setup that reproduces the error, though, so this is tested by looking at the command lines run on an Ubuntu setup that compiles even without the fix.

There's an argument for splitting this into two patches, I suppose, one which just fixes the CURL_CFLAGS bug and one which tidies the CURL_LIBS handling. But it didn't seem worth it to me. Let me know if you'd prefer it split.

---
 Makefile                      | 1 -
 contrib/elf2dmp/Makefile.objs | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +0 -1
index f9791dcb827..27dabb9b1a0 100644
@@ -626,7 +626,6 @@ ifneq ($(EXESUF),)
 qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
 endif
 
-elf2dmp$(EXESUF): LIBS += $(CURL_LIBS)
 elf2dmp$(EXESUF): $(elf2dmp-obj-y)
        $(call LINK, $^)
 
contrib/elf2dmp/Makefile.objs +3 -1
index e3140f58cf7..15057169160 100644
@@ -1 +1,4 @@
 elf2dmp-obj-y = main.o addrspace.o download.o pdb.o qemu_elf.o
+
+download.o-cflags := $(CURL_CFLAGS)
+download.o-libs   := $(CURL_LIBS)
--

2.20.1

Signature · 1 line
Marc-André Lureau
#2 lore raw
Quoted 17 lines · Marc-André Lureau

Hi

Quoted 13 lines · Peter Maydell

contrib/elf2dmp has a source file which uses curl/curl.h; although we link the final executable with CURL_LIBS, we forgot to build this source file with CURL_CFLAGS, so if the curl header is in a place that's not already on the system include path then it will fail to build.

Add a line specifying the cflags needed for download.o; while we are here, bring the specification of the libs into line with this, since using a per-object variable setting is preferred over adding them to the final executable link line.

Quoted 3 lines
Quoted 1 line

Thanks. Since we don't have an obvious route for elf2dmp patches to go into master I'll just put this in via the arm pullreq I'm putting together for rc2.

-- PMM