Skip to contentSkip to conversation

cutils: Add missing dyld(3) include on macOS

PATCH In review Philippe Mathieu-Daudé via 2 participants 3 messages Aug 9, 2022 – Aug 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cutils: Add missing dyld(3) include on macOS

Commit 06680b15b4 moved qemu_*_exec_dir() to cutils but forgot to move the macOS dyld(3) include, resulting in the following error (when building with Homebrew GCC on macOS Monterey 12.4):

[313/1197] Compiling C object libqemuutil.a.p/util_cutils.c.o
FAILED: libqemuutil.a.p/util_cutils.c.o
../../util/cutils.c:1039:13: error: implicit declaration of function '_NSGetExecutablePath' [-Werror=implicit-function-declaration]

   1039 |         if (_NSGetExecutablePath(fpath, &len) == 0) {
        |             ^~~~~~~~~~~~~~~~~~~~

../../util/cutils.c:1039:13: error: nested extern declaration of '_NSGetExecutablePath' [-Werror=nested-externs]

Fix by moving the include line to cutils.

Fixes 06680b15b4 ("include: move qemu_*_exec_dir() to cutils")

---
Cc: Marc-André Lureau <[email protected]>
Cc: Markus Armbruster <[email protected]>

---
 util/cutils.c      | 4 ++++
 util/oslib-posix.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
util/cutils.c +4 -0
index cb43dda213..def9c746ce 100644
@@ -39,6 +39,10 @@
 #include <kernel/image.h>
 #endif
 
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
+
 #ifdef G_OS_WIN32
 #include <pathcch.h>
 #include <wchar.h>
util/oslib-posix.c +0 -4
index bffec18869..d55af69c11 100644
@@ -58,10 +58,6 @@
 #include <lwp.h>
 #endif
 
-#ifdef __APPLE__
-#include <mach-o/dyld.h>
-#endif
-
 #include "qemu/mmap-alloc.h"
 
 #ifdef CONFIG_DEBUG_STACK_USAGE
Signature · 1 line
2.36.1
#1 lore raw

+Thomas

Quoted 53 lines · Philippe Mathieu-Daudé

Commit 06680b15b4 moved qemu_*_exec_dir() to cutils but forgot to move the macOS dyld(3) include, resulting in the following error (when building with Homebrew GCC on macOS Monterey 12.4):

   [313/1197] Compiling C object libqemuutil.a.p/util_cutils.c.o
   FAILED: libqemuutil.a.p/util_cutils.c.o
   ../../util/cutils.c:1039:13: error: implicit declaration of function '_NSGetExecutablePath' [-Werror=implicit-function-declaration]
    1039 |         if (_NSGetExecutablePath(fpath, &len) == 0) {
         |             ^~~~~~~~~~~~~~~~~~~~
   ../../util/cutils.c:1039:13: error: nested extern declaration of '_NSGetExecutablePath' [-Werror=nested-externs]

Fix by moving the include line to cutils.

Fixes 06680b15b4 ("include: move qemu_*_exec_dir() to cutils")

---
Cc: Marc-André Lureau <[email protected]>
Cc: Markus Armbruster <[email protected]>

---
  util/cutils.c      | 4 ++++
  util/oslib-posix.c | 4 ----
  2 files changed, 4 insertions(+), 4 deletions(-)
util/cutils.c +4 -0
index cb43dda213..def9c746ce 100644
@@ -39,6 +39,10 @@
  #include <kernel/image.h>
  #endif
 
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
+
  #ifdef G_OS_WIN32
  #include <pathcch.h>
  #include <wchar.h>
util/oslib-posix.c +0 -4
index bffec18869..d55af69c11 100644
@@ -58,10 +58,6 @@
  #include <lwp.h>
  #endif
 
-#ifdef __APPLE__
-#include <mach-o/dyld.h>
-#endif
-
  #include "qemu/mmap-alloc.h"
 
  #ifdef CONFIG_DEBUG_STACK_USAGE
#2 lore raw
In reply to Philippe Mathieu-Daudé via
Quoted 12 lines · Philippe Mathieu-Daudé via

Commit 06680b15b4 moved qemu_*_exec_dir() to cutils but forgot to move the macOS dyld(3) include, resulting in the following error (when building with Homebrew GCC on macOS Monterey 12.4):

[313/1197] Compiling C object libqemuutil.a.p/util_cutils.c.o
FAILED: libqemuutil.a.p/util_cutils.c.o
../../util/cutils.c:1039:13: error: implicit declaration of function '_NSGetExecutablePath' [-Werror=implicit-function-declaration]

   1039 |         if (_NSGetExecutablePath(fpath, &len) == 0) {
        |             ^~~~~~~~~~~~~~~~~~~~

../../util/cutils.c:1039:13: error: nested extern declaration of '_NSGetExecutablePath' [-Werror=nested-externs]

Quoted 7 lines

Fix by moving the include line to cutils.

Fixes 06680b15b4 ("include: move qemu_*_exec_dir() to cutils")

---
Cc: Marc-André Lureau <[email protected]>
Cc: Markus Armbruster <[email protected]>

I wonder why this doesn't show up with clang?

Anyway, obvious fix. I'll take it via target-arm.next for my pull for rc3, unless anybody has a different preference.

thanks
-- PMM