On Mon, Aug 12, 2024 at 11:41:20AM +0200, Antonio Caggiano wrote:
 -M is not a valid flag for MacOS ld.
 
 Signed-off-by: Antonio Caggiano <quic_acaggian(a)quicinc.com>
 ---
  m4/guestfs-c.m4 | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
 index c6d33183d..8035a9729 100644
 --- a/m4/guestfs-c.m4
 +++ b/m4/guestfs-c.m4
 @@ -57,7 +57,7 @@ CFLAGS="$CFLAGS -fno-strict-overflow -Wno-strict-overflow"
  dnl Work out how to specify the linker script to the linker.
  VERSION_SCRIPT_FLAGS=-Wl,--version-script=
  `/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null` || \
 -    VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
 +    VERSION_SCRIPT_FLAGS="-Wl,-map -Wl,"
  AC_SUBST(VERSION_SCRIPT_FLAGS) 
Unfortunately -map isn't a flag which Linux's linker understands.
The way to do this is to conditionalise the code based on the $host_os
variable which probably contains "darwin*" for macOS.  I'm sure there
are many examples on line, but here are some from nbdkit:
https://gitlab.com/nbdkit/nbdkit/-/blob/7a72d15a663cf12fdb74219f642756023...
https://gitlab.com/nbdkit/nbdkit/-/blob/7a72d15a663cf12fdb74219f642756023...
https://gitlab.com/nbdkit/nbdkit/-/blob/7a72d15a663cf12fdb74219f642756023...
Rich.
-- 
Richard Jones, Virtualization Group, Red Hat 
http://people.redhat.com/~rjones
Read my programming and virtualization blog: 
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v