Skip to content

Add build tag and appropriate LDFLAGS for macOS support #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matiasinsaurralde
Copy link

OpenFHE provides macOS support.

After building OpenFHE on macOS I've noticed that current main branch doesn't build on macOS:

% go test . -tags 'openfhe'                                               
# github.com/collapsinghierarchy/openfhe-go.test
ld: warning: ignoring duplicate libraries: '-lc++'
dyld[48543]: Library not loaded: @rpath/libOPENFHEcore.1.dylib
  Referenced from: <A2C383E2-3C60-3420-FB90-F4D5EFC96691> /private/var/folders/s5/3_m33khx5njfpz_5g1d4wrkc0000gn/T/go-build1261414508/b001/openfhe-go.test
  Reason: no LC_RPATH's found
signal: abort trap
FAIL	github.com/collapsinghierarchy/openfhe-go	0.310s
FAIL

The change adds -Wl,-rpath,/usr/local/lib to macOS (darwin) linker flags, macOS 10.5 and above use/expect rpath for search path:

% go test . -tags 'openfhe'
# github.com/collapsinghierarchy/openfhe-go.test
ld: warning: ignoring duplicate libraries: '-lc++'
ok  	github.com/collapsinghierarchy/openfhe-go	0.328s

The introduction of these linker flags enable macOS support for openfhe-go and the usage of the darwin build tag will ensure they're only used for macOS builds 👍

Signed-off-by: Matías Insaurralde <matias@insaurral.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant