Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FreeBSD compilation #643

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mk/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/libexpr/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/nix-daemon/nix-daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down