Skip to content

Commit bbbb79a

Browse files
committed
linux: fix PATH_MAX macro redefined in exec-cmd.c on macOS 15.4
Fix an error while building target/linux on macOS 15.4 host, due to the PATH_MAX macro being redefined: mkdir -p /Volumes/test/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.6.86/tools/objtool && make O=/Volumes/test/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.6.86 subdir=tools/objtool --no-print-directory -C objtool exec-cmd.c:15:9: error: 'PATH_MAX' macro redefined [-Werror,-Wmacro-redefined] 15 | #define PATH_MAX 4096 | ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/syslimits.h:103:9: note: previous definition is here 103 | #define PATH_MAX 1024 /* max bytes in pathname */ | ^ exec-cmd.c is compiled as part of objtool to run on the host, and therefore host headers are used, where PATH_MAX is already defined. Using an old OpenWRT snapshot from 2025-02-16, where linux-6.6.77 used to build correctly, does not help. Reveting from Xcode 16.3 to 16.2 does not help either. Signed-off-by: Georgi Valkov <[email protected]>
1 parent b5339fc commit bbbb79a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From 0c1759139188c0873f288758fe57366ed1291c2a Mon Sep 17 00:00:00 2001
2+
From: Georgi Valkov <[email protected]>
3+
Date: Fri, 18 Apr 2025 16:08:16 +0300
4+
Subject: [PATCH] tools/objtool: fix PATH_MAX macro redefined-build OpenWRT on
5+
macOS 15.4
6+
7+
Fix an error while building linux as part of OpenWRT on macOS 15.4 host,
8+
due to the PATH_MAX macro being redefined:
9+
10+
mkdir -p /Volumes/test/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.6.86/tools/objtool && make O=/Volumes/test/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.6.86 subdir=tools/objtool --no-print-directory -C objtool
11+
exec-cmd.c:15:9: error: 'PATH_MAX' macro redefined [-Werror,-Wmacro-redefined]
12+
15 | #define PATH_MAX 4096
13+
| ^
14+
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/syslimits.h:103:9: note: previous definition is here
15+
103 | #define PATH_MAX 1024 /* max bytes in pathname */
16+
| ^
17+
18+
exec-cmd.c is compiled as part of objtool to run on the host, and
19+
therefore host headers are used, where PATH_MAX is already defined.
20+
Using an old OpenWRT snapshot from 2025-02-16, where linux-6.6.77
21+
used to build correctly, does not help. Reveting from Xcode 16.3 to
22+
16.2 does not help either.
23+
24+
Signed-off-by: Georgi Valkov <[email protected]>
25+
---
26+
tools/lib/subcmd/exec-cmd.c | 3 +++
27+
1 file changed, 3 insertions(+)
28+
29+
diff --git a/tools/lib/subcmd/exec-cmd.c b/tools/lib/subcmd/exec-cmd.c
30+
index 7739b5217cf6..dc82cacd82cb 100644
31+
--- a/tools/lib/subcmd/exec-cmd.c
32+
+++ b/tools/lib/subcmd/exec-cmd.c
33+
@@ -12,7 +12,10 @@
34+
#include "subcmd-config.h"
35+
36+
#define MAX_ARGS 32
37+
+
38+
+#ifndef PATH_MAX
39+
#define PATH_MAX 4096
40+
+#endif
41+
42+
static const char *argv_exec_path;
43+
static const char *argv0_path;
44+
--
45+
2.49.0
46+

0 commit comments

Comments
 (0)