spacemonkeygo / openssl

OpenSSL bindings for Go
http://godoc.org/github.com/spacemonkeygo/openssl
Apache License 2.0
473 stars 236 forks source link

build.go has hardcoded paths for osx/darwin #133

Open Radisovik opened 4 years ago

Radisovik commented 4 years ago

Is it intentional though? build.go has these two hardcoded paths for darwin:

// #cgo darwin CFLAGS: -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl/include // #cgo darwin LDFLAGS: -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto

Shouldn't it instead use pkg-config like windows and linux?

// #cgo linux darwin windows pkg-config: libssl libcrypto

Rikkuru commented 1 year ago

I think this would fix various problems on darwin issue

Rikkuru commented 1 year ago

https://github.com/spacemonkeygo/openssl/pull/160

How about this ?

Tests work on macos with openssl & pkgconfig from homebrew with exception of TestGenerateEd25519 where Ed25519 is marshalled to PEM.

d.fedorova@d-fedorova openssl % PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3.1/lib/pkgconfig" go test ./...            
--- FAIL: TestGenerateEd25519 (0.00s)
    key_test.go:192: failed dumping private key
--- FAIL: TestMarshalEd25519 (0.00s)
    key_test.go:436: failed dumping private key
FAIL
FAIL    github.com/spacemonkeygo/openssl    3.217s
?       github.com/spacemonkeygo/openssl/utils  [no test files]
FAIL

Another pull request says it can't be done and deletes this check from key_test.go

https://github.com/spacemonkeygo/openssl/pull/149/commits/f5ecaf4460d3e462e4e0ff40e4f7705184d2c576#diff-8c1034328da97bb01b73d9ee0012aa03595841ddf1786805eee40b7ce333dadeR431