> Looks like we're not getting the executable path > correctly on MacOS for some reason.
Indeed, there is no code for it. Can you try the patch below? > Also, mjt pointed out on IRC that we probably want to allow > installing binary modules into a path with the arch name in > it, to allow for multiarch distros. Isn't --libdir enough? Paolo ==================== 8< ======================== From: Paolo Bonzini <pbonz...@redhat.com> Date: Wed, 5 Feb 2014 21:15:01 +0100 Subject: [PATCH] oslib: port qemu_exec_dir to Darwin Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- util/oslib-posix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 372b2f9..590a7d1 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -59,6 +59,12 @@ extern int daemon(int, int); #include <sys/mman.h> #include <libgen.h> +/* Get declaration of _NSGetExecutablePath on MacOS X 10.2 or newer. */ +#if defined(__APPLE__) && defined(__MACH__) +#define ENUM_DYLD_BOOL +#include <mach-o/dyld.h> +#endif + #ifdef CONFIG_LINUX #include <sys/syscall.h> #endif @@ -303,6 +309,15 @@ char *qemu_exec_dir(const char *argv0) p = buf; } } +#elif defined(__APPLE__) && defined(__MACH__) + { + char result[PATH_MAX]; + uint32_t length = PATH_MAX; + if (_NSGetExecutablePath (result, &length) != 0 || result[0] != '/') { + return NULL; + } + p = realpath(result, buf); + } #endif /* If we don't have any way of figuring out the actual executable location then try argv[0]. */ -- 1.8.5.3