Skip to content

Commit 75db184

Browse files
committed
fix macos command to print defined symbols?
1 parent 66902d7 commit 75db184

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/SPC/builder/unix/UnixBuilderBase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public function getDynamicExportSymbolsArgument(): ?string
4949
throw new WrongUsageException('You must build libphp.a before calling this function.');
5050
}
5151

52-
$cmd = 'nm -g --defined-only -P ' . escapeshellarg($libphp) . ' 2>/dev/null';
52+
$cmd = (SPCTarget::getTargetOS() === 'Linux')
53+
? 'nm -g --defined-only -P ' . escapeshellarg($libphp) . ' 2>/dev/null'
54+
: 'nm -gUj ' . escapeshellarg($libphp) . ' 2>/dev/null';
5355
$out = shell_exec($cmd) ?: '';
5456
if ($out !== '') {
5557
foreach (preg_split('/\R/', trim($out)) as $line) {
@@ -89,7 +91,7 @@ public function getDynamicExportSymbolsArgument(): ?string
8991
$argument = '-Wl,--export-dynamic'; // https://github.com/ziglang/zig/issues/24662
9092
}
9193
if (SPCTarget::getTargetOS() !== 'Linux') {
92-
$argument = "-Wl,-exported_symbols_list {$exportList}";
94+
$argument = "-Wl,-exported_symbols_list,{$exportList}";
9395
}
9496

9597
$this->dynamic_export_list = $argument;

0 commit comments

Comments
 (0)