Skip to content

Commit c6cacc7

Browse files
committed
Support compatible command for processor count on darwin platform
- nproc does not work on OSX - also link errors on OSX, see rusterlium/rustler#12 (comment)
1 parent 2b9aecf commit c6cacc7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rebar3_rust_utils.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ compile_crates(State) ->
3030
%% ===================================================================
3131

3232
compile_crate(CrateDir, PrivDir) ->
33-
Command = "cargo build --release -j$(nproc)",
33+
Command = case os:type() of
34+
{unix,darwin} -> "cargo rustc --release -j$(sysctl -n hw.ncpu) -- -C link-args='-flat_namespace -undefined suppress'";
35+
{unix,linux} -> "cargo build --release -j$(nproc)"
36+
end,
3437

3538
{ok, _} = rebar_utils:sh(Command, [{cd, CrateDir}, {use_stdout, true}]),
3639

0 commit comments

Comments
 (0)