diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-05-17 17:08:57 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-06-01 08:05:21 +0000 |
commit | c57ab1768767ca4f860ce5ca5faf54a7dba4969f (patch) | |
tree | 5d723362b0724b23154d3ba5c782ee47ed55aa57 /nix-rust | |
parent | e8f585be70b22c11db5356f886049f432699eac3 (diff) |
Only link with libdl on Linux
Linux is (as far as I know) the only mainstream operating system that
requires linking with libdl for dlopen. On BSD, libdl doesn't exist,
so on non-FreeBSD BSDs linking will currently fail. On macOS, it's
apparently just a symlink to libSystem (macOS libc), presumably
present for compatibility with things that assume Linux.
So the right thing to do here is to only add -ldl on Linux, not to add
it for everything that isn't FreeBSD.
Diffstat (limited to 'nix-rust')
-rw-r--r-- | nix-rust/local.mk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nix-rust/local.mk b/nix-rust/local.mk index 50db4783c..9650cdf93 100644 --- a/nix-rust/local.mk +++ b/nix-rust/local.mk @@ -8,8 +8,13 @@ endif libnixrust_PATH := $(d)/target/$(RUST_DIR)/libnixrust.$(SO_EXT) libnixrust_INSTALL_PATH := $(libdir)/libnixrust.$(SO_EXT) -libnixrust_LDFLAGS_USE := -L$(d)/target/$(RUST_DIR) -lnixrust -ldl -libnixrust_LDFLAGS_USE_INSTALLED := -L$(libdir) -lnixrust -ldl +libnixrust_LDFLAGS_USE := -L$(d)/target/$(RUST_DIR) -lnixrust +libnixrust_LDFLAGS_USE_INSTALLED := -L$(libdir) -lnixrust + +ifeq ($(OS), Linux) +libnixrust_LDFLAGS_USE += -ldl +libnixrust_LDFLAGS_USE_INSTALLED += -ldl +endif ifeq ($(OS), Darwin) libnixrust_BUILD_FLAGS = NIX_LDFLAGS="-undefined dynamic_lookup" |