summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_erlc_compiler.erl3
-rw-r--r--src/rebar_port_compiler.erl9
-rw-r--r--src/rebar_utils.erl8
3 files changed, 17 insertions, 3 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index 38dd198..efbdf09 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -52,7 +52,8 @@
%%
%% OtpRelease = erlang:system_info(otp_release).
%% SysArch = erlang:system_info(system_architecture).
-%% Words = integer_to_list(8 * erlang:system_info(wordsize)).
+%% Words = integer_to_list(8 *
+%% erlang:system_info({wordsize, external})).
%%
%% E.g. to define HAVE_SENDFILE only on systems with
%% sendfile(), to define BACKLOG on Linux/FreeBSD as 128,
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index a9b73cc..ad1e387 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -398,7 +398,14 @@ default_env() ->
{"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},
{"darwin", "DRV_LDFLAGS",
"-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
- {"ERLANG_ARCH", integer_to_list(8 * erlang:system_info(wordsize))},
+ {"ERLANG_ARCH",
+ try erlang:system_info({wordsize, external}) of
+ Val ->
+ integer_to_list(8 * Val)
+ catch
+ error:badarg ->
+ integer_to_list(8 * erlang:system_info(wordsize))
+ end},
{"ERLANG_TARGET", rebar_utils:get_arch()},
%% Solaris specific flags
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 792c54f..68ca0dc 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -62,7 +62,13 @@ is_arch(ArchRegex) ->
end.
get_arch() ->
- Words = integer_to_list(8 * erlang:system_info(wordsize)),
+ Words = try erlang:system_info({wordsize, external}) of
+ Val ->
+ integer_to_list(8 * Val)
+ catch
+ error:badarg ->
+ integer_to_list(8 * erlang:system_info(wordsize))
+ end,
erlang:system_info(otp_release) ++ "-"
++ erlang:system_info(system_architecture) ++ "-" ++ Words.