diff mbox

[v2,1/1] Makefile: Capstone: Add support for cross compile ranlib

Message ID 14c2a46a082a9e34d6cbd3aba0fb47e353850d0d.1510153659.git.alistair.francis@xilinx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alistair Francis Nov. 8, 2017, 3:10 p.m. UTC
When cross compiling QEMU for Windows we need to specify the cross
version of ranlib to avoid build errors when building capstone. This
patch ensures we use the same cross prefix on ranlib as other toolchain
components.

This patch fixes this build error when building on RHEL (or Fedora) with
MinGW:
/scratch/jenkins_tmp/workspace/QEMU-BuildAll/label/ssw_rhel7/target/windows/build-windows/capstone/capstone.lib:
error adding symbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
make: *** [qemu-io.exe] Error 1

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daud <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daud <f4bug@amsat.org>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
---

 Makefile  | 2 +-
 configure | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Peter Maydell Nov. 9, 2017, 11:09 a.m. UTC | #1
On 8 November 2017 at 15:10, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> When cross compiling QEMU for Windows we need to specify the cross
> version of ranlib to avoid build errors when building capstone. This
> patch ensures we use the same cross prefix on ranlib as other toolchain
> components.
>
> This patch fixes this build error when building on RHEL (or Fedora) with
> MinGW:
> /scratch/jenkins_tmp/workspace/QEMU-BuildAll/label/ssw_rhel7/target/windows/build-windows/capstone/capstone.lib:
> error adding symbols: Archive has no index; run ranlib to add one
> collect2: error: ld returned 1 exit status
> make: *** [qemu-io.exe] Error 1
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Philippe Mathieu-Daud <f4bug@amsat.org>
> Tested-by: Philippe Mathieu-Daud <f4bug@amsat.org>

Something in your patch handling workflow seems to be
breaking non-ASCII characters, and it has dropped the
last character in Philippe's surname. It would be good
if you could look into fixing this -- we have quite a
few contributors whose names are not representable
purely in ASCII.

thanks
-- PMM
Alistair Francis Nov. 10, 2017, 1:27 a.m. UTC | #2
On Thu, Nov 9, 2017 at 3:09 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 8 November 2017 at 15:10, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> When cross compiling QEMU for Windows we need to specify the cross
>> version of ranlib to avoid build errors when building capstone. This
>> patch ensures we use the same cross prefix on ranlib as other toolchain
>> components.
>>
>> This patch fixes this build error when building on RHEL (or Fedora) with
>> MinGW:
>> /scratch/jenkins_tmp/workspace/QEMU-BuildAll/label/ssw_rhel7/target/windows/build-windows/capstone/capstone.lib:
>> error adding symbols: Archive has no index; run ranlib to add one
>> collect2: error: ld returned 1 exit status
>> make: *** [qemu-io.exe] Error 1
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>> Reviewed-by: Philippe Mathieu-Daud <f4bug@amsat.org>
>> Tested-by: Philippe Mathieu-Daud <f4bug@amsat.org>
>
> Something in your patch handling workflow seems to be
> breaking non-ASCII characters, and it has dropped the
> last character in Philippe's surname. It would be good
> if you could look into fixing this -- we have quite a
> few contributors whose names are not representable
> purely in ASCII.

I think it's the way that I copy lines into the patches. I'll be sure
to make sure I get all the characters next time. Thanks for pointing
it out.

Alistair

>
> thanks
> -- PMM
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 0496c5057a..814f6820d9 100644
--- a/Makefile
+++ b/Makefile
@@ -405,7 +405,7 @@  CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
 CAP_CFLAGS += -DCAPSTONE_HAS_X86
 
 subdir-capstone: .git-submodule-status
-	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
+	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
 
 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
 	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
diff --git a/configure b/configure
index a6055c0710..0e856bbc04 100755
--- a/configure
+++ b/configure
@@ -482,6 +482,7 @@  ccas="${CCAS-$cc}"
 cpp="${CPP-$cc -E}"
 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
 ld="${LD-${cross_prefix}ld}"
+ranlib="${RANLIB-${cross_prefix}ranlib}"
 nm="${NM-${cross_prefix}nm}"
 strip="${STRIP-${cross_prefix}strip}"
 windres="${WINDRES-${cross_prefix}windres}"
@@ -6288,6 +6289,7 @@  echo "CCAS=$ccas" >> $config_host_mak
 echo "CPP=$cpp" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
+echo "RANLIB=$ranlib" >> $config_host_mak
 echo "NM=$nm" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
@@ -6782,6 +6784,7 @@  for rom in seabios vgabios ; do
     echo "OBJCOPY=objcopy" >> $config_mak
     echo "IASL=$iasl" >> $config_mak
     echo "LD=$ld" >> $config_mak
+    echo "RANLIB=$ranlib" >> $config_mak
 done
 
 # set up tests data directory