Skip to content

Commit 27df464

Browse files
lrascaobelltoy
authored andcommitted
Adapt to new rustc-cdylib-link-arg parameter
After rust-lang/rust/pull/36574 has been merged the latest Rust version 1.49 breaks the linking of dynamic libs in MacOS. These changes ensure that the extra link args are applied only at the dynamic lib generation linking step.
1 parent 7367fb5 commit 27df464

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

ct/rebar3_cargo_SUITE_data/test_nif_app/rust_src/nifsys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Daniel Goertzen <daniel.goertzen@gmail.com>"]
55

66
[lib]
77
name = "nifsys"
8-
crate-type = ["dylib"]
8+
crate-type = ["cdylib"]
99

1010
[dependencies]
1111
rustler = "0.22.0-rc.1"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::env;
2+
3+
fn main() {
4+
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
5+
6+
if target_os == "macos" {
7+
println!("cargo:rustc-cdylib-link-arg=-flat_namespace");
8+
println!("cargo:rustc-cdylib-link-arg=-undefined");
9+
println!("cargo:rustc-cdylib-link-arg=suppress");
10+
}
11+
}

rebar.config

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{project_plugins, [{erlfmt, "~> 0.14"}]}.
22

3-
{deps, [cargo]}.
3+
{deps, [
4+
{cargo,
5+
{git, "https://github.com/rusterlium/erlang-cargo.git",
6+
{branch, "master"}}}
7+
]}.
48

59
{eunit_tests, [rebar3_cargo]}.
610

rebar.lock

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{"1.2.0",
2-
[{<<"cargo">>,{pkg,<<"cargo">>,<<"0.1.2">>},0},
2+
[{<<"cargo">>,
3+
{git,"https://github.com/rusterlium/erlang-cargo.git",
4+
{ref,"99c224d616cdfcee6fc479cf2723437d3acfbb8f"}},
5+
0},
36
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.11.0">>},1}]}.
47
[
58
{pkg_hash,[
6-
{<<"cargo">>, <<"1245B5A21454EBEABACF403911D54A82A0D457A3F635511A03AD06845F5ABF95">>},
79
{<<"jsx">>, <<"08154624050333919B4AC1B789667D5F4DB166DC50E190C4D778D1587F102EE0">>}]},
810
{pkg_hash_ext,[
9-
{<<"cargo">>, <<"EB614BA74F9F5B61643E5CC607BBF7DDC8420D368661E31C04E0DB7AD47E21B3">>},
1011
{<<"jsx">>, <<"EED26A0D04D217F9EECEFFFB89714452556CF90EB38F290A27A4D45B9988F8C0">>}]}
1112
].

0 commit comments

Comments
 (0)