From 6c0a56afee0a61a9d1be0d3b9eedd123c52a560e Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Mon, 17 Jun 2019 21:59:04 +0200 Subject: [PATCH] Link with the dependencies of rust-core (#351) * Link with the dependencies of rust-core When linking against a static library you must explicitly link against the dependencies of that static library. These are the libraries which rust itself links against to create libdeltachat.so, you can see this using `readelf -d libdeltachat.so`. The interesting thing is that all these libraries are actually part of your libc. And depending on which libc and which version of libc you use, some symbols may be available without extra linking. So many people would not have noticed these missing links. There is no need to try to detect exactly which links are needed since the loading only happens lazily anyway, so needlessly linking against a lib which should always be available anyway is fairly harmless. * Attempt to deal with osx correctly --- binding.gyp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index 7d1a185f..62c99f69 100644 --- a/binding.gyp +++ b/binding.gyp @@ -37,7 +37,8 @@ "deltachat-core-rust", ], "libraries": [ - "../deltachat-core-rust/target/release/libdeltachat.a" + "../deltachat-core-rust/target/release/libdeltachat.a", + "-ldl", ], "conditions": [ [ "OS == 'mac'", { @@ -45,7 +46,13 @@ "-framework CoreFoundation", "-framework CoreServices", "-framework Security", + "-lresolv", ], + }, { # OS == 'linux' + "libraries": [ + "-lm", + "-lrt", + ] }], ], }, { # system_dc_core == 'true'