Skip to content

Commit

Permalink
Fix build on macOS with Apple M1
Browse files Browse the repository at this point in the history
/usr/local is for Intel binaries/libraries, /opt/homebrew for ARM [1].

1. https://docs.brew.sh/Installation

Related to tarantool/go-tarantool#260
  • Loading branch information
oleg-jukovec committed Jul 27, 2023
1 parent b95fe9d commit d8f8f51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ package openssl

// #cgo linux windows freebsd openbsd solaris pkg-config: libssl libcrypto
// #cgo linux freebsd openbsd solaris CFLAGS: -Wno-deprecated-declarations
// #cgo darwin CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin LDFLAGS: -L/usr/local/opt/openssl/lib -lssl -lcrypto
// #cgo darwin,386 CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,386 LDFLAGS: -L/usr/local/opt/openssl/lib -lssl -lcrypto
// #cgo darwin,amd64 CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/openssl/lib -lssl -lcrypto
// #cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/openssl/lib -lssl -lcrypto
// #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN
import "C"
8 changes: 6 additions & 2 deletions build_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ package openssl

// #cgo linux windows freebsd openbsd solaris pkg-config: --static libssl libcrypto
// #cgo linux freebsd openbsd solaris CFLAGS: -Wno-deprecated-declarations
// #cgo darwin CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin LDFLAGS: /usr/local/opt/openssl/lib/libcrypto.a /usr/local/opt/openssl/lib/libssl.a
// #cgo darwin,386 CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,386 LDFLAGS: /usr/local/opt/openssl/lib/libcrypto.a /usr/local/opt/openssl/lib/libssl.a
// #cgo darwin,amd64 CFLAGS: -I/usr/local/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,amd64 LDFLAGS: /usr/local/opt/openssl/lib/libcrypto.a /usr/local/opt/openssl/lib/libssl.a
// #cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/openssl/include -Wno-deprecated-declarations
// #cgo darwin,arm64 LDFLAGS: /opt/homebrew/opt/openssl/lib/libcrypto.a /opt/homebrew/opt/openssl/lib/libssl.a
// #cgo windows CFLAGS: -DWIN32_LEAN_AND_MEAN
import "C"

0 comments on commit d8f8f51

Please sign in to comment.