Skip to content

Resolve link errors on Mac OS X

Christopher Friedt qemu-devel qemu-trivial 1 version NAK

Status from this message: NAK

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/2Use libtool instead of ar to create static libraries on Darwin.rules.mak+4 -00 replies
2/2Remove unnecessary CONFIG_EVENTFD preprocessor conditional to satisfy linkutil/event_notifier-posix.c+0 -21 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/2][RESENT-INLINE] Resolve link errors on Mac OS X

Hi list,

I recently tried to build Qemu on Mac and ran into a couple of trivial issues that I've provided patches for. I suppose that normally people just use 'brew install qemu', but there is really no reason that it can't be built from source, particularly for those modifying Qemu regularly.

In any case, the first change moves to using 'libtool -static' to create libraries on Mac OS X. If one attempts to use ar and ranlib, then the final link will fail with error messages resembling the following:

ld: warning: ignoring file libqemuutil.a, file was built for archive which is not the architecture being linked (x86_64): libqemuutil.a Undefined symbols for architecture x86_64:
...

Notice ld (Apple's ld64) presumes the static library is a relocatable with architecture 'archive' rather than x86_64, in this case.

A similar fix is required for dtc - again quite trivial, but I can provide that if necessary.

The second patch removes the preprocessor conditional around the function event_notifier_init_fd() in util/event_notifier-posix.c so that the link does not fail on systems where CONFIG_POSIX is defined but CONFIG_EVENTFD is not (such as under Mac OS X).

There is more information in each of the commits that follows.

Please feel free to comment.

Cheers,

C

Christopher Friedt (2):
Use libtool instead of ar to create static libraries on Darwin. Remove unnecessary CONFIG_EVENTFD preprocessor conditional to satisfy
link

 rules.mak                   | 4 ++++
 util/event_notifier-posix.c | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.6.4 (Apple Git-63)