Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Fix static linking on Mac #16

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
ifeq ($(shell uname), Darwin)
CGO_LDFLAGS := -framework Security
endif

.PHONY: build
build: build-tfhe-rs-capi
cd fhevm && go build .
cd fhevm && CGO_LDFLAGS='$(CGO_LDFLAGS)' go build .

.PHONY: test
test: build-tfhe-rs-capi
cd fhevm && go test -v .
cd fhevm && CGO_LDFLAGS='$(CGO_LDFLAGS)' go test -v .

.PHONY: build-tfhe-rs-capi
build-tfhe-rs-capi:
cd tfhe-rs && make build_c_api_experimental_deterministic_fft
cd tfhe-rs && make build_c_api_experimental_deterministic_fft \
&& cd target/release && rm -f *.dylib *.dll *.so
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to rm here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I saw the description. Wouldn't it work even if we don't remove?

Copy link
Contributor Author

@david-zk david-zk Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default linker prefers dynamic libraries if they are available, now we specify tfhe lib with -ltfhe flag, which doesn't imply if it is static or dynamic, so if we remove dynamic libraries, linker is forced to link statically

Copy link
Contributor Author

@david-zk david-zk Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would work, but then on macbook it links dynamically, I tried -l:libtfhe.a flag but it doesn't work


.PHONY: clean
clean:
Expand Down