diff --git a/mk/lib.mk b/mk/lib.mk index 4ad5c636c8d..bb82801d3b4 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -61,7 +61,9 @@ ifeq ($(BUILD_SHARED_LIBS), 1) endif ifneq ($(OS), Darwin) ifneq ($(OS), SunOS) - GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries + ifneq ($(OS), FreeBSD) + GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries + endif endif endif SET_RPATH_TO_LIBS ?= 1 diff --git a/src/libexpr/local.mk b/src/libexpr/local.mk index 4c1f4de1918..dc8aa381b67 100644 --- a/src/libexpr/local.mk +++ b/src/libexpr/local.mk @@ -8,7 +8,9 @@ libexpr_SOURCES := $(wildcard $(d)/*.cc) $(d)/lexer-tab.cc $(d)/parser-tab.cc libexpr_LIBS = libutil libstore libformat -libexpr_LDFLAGS = -ldl +ifneq ($(shell uname),FreeBSD) + libexpr_LDFLAGS = -ldl +endif # The dependency on libgc must be propagated (i.e. meaning that # programs/libraries that use libexpr must explicitly pass -lgc), diff --git a/src/libstore/local.mk b/src/libstore/local.mk index bf5c256c949..01dd0cfb50c 100644 --- a/src/libstore/local.mk +++ b/src/libstore/local.mk @@ -8,7 +8,7 @@ libstore_SOURCES := $(wildcard $(d)/*.cc) libstore_LIBS = libutil libformat -libstore_LDFLAGS = -lsqlite3 -lbz2 -lcurl +libstore_LDFLAGS = $(shell pkg-config --libs sqlite3) -lbz2 $(shell pkg-config --libs libcurl) ifeq ($(OS), SunOS) libstore_LDFLAGS += -lsocket diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index aaae691e9ee..a0416eaec20 100644 --- a/src/nix-daemon/nix-daemon.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -694,8 +694,14 @@ static PeerInfo getPeerInfo(int remote) xucred cred; socklen_t credLen = sizeof(cred); +#if defined(SOL_LOCAL) if (getsockopt(remote, SOL_LOCAL, LOCAL_PEERCRED, &cred, &credLen) == -1) throw SysError("getting peer credentials"); +#else + // e.g. FreeBSD + if (getsockopt(remote, SOL_SOCKET, LOCAL_PEERCRED, &cred, &credLen) == -1) + throw SysError("getting peer credentials"); +#endif peer = { false, 0, true, cred.cr_uid, false, 0 }; #endif