Closed hop-along-polly closed 1 year ago
I resolved the issues with the install command by adding /opt/homebrew/opt/yara/lib/pkgconfig:/opt/homebrew/opt/openssl/lib/pkgconfig
to the PKG_CONFIG_PATH
environment variable.
PKG_CONFIG_PATH=/opt/homebrew/opt/yara/lib/pkgconfig:/opt/homebrew/opt/openssl/lib/pkgconfig go install github.com/hillu/go-yara/v4
You can get away with only adding /opt/homebrew
to the PKG_CONFIG_PATH
as well which begs the question why doesn't pkg-config
look there already?
NOTE: when running my code I'm now getting an error which seems to be a platform related.
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: -no_pie is deprecated when targeting new OS versions
ld: warning: ignoring file /opt/homebrew/Cellar/yara/4.2.3/lib/libyara.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
I don't own a Mac, so I can't confirm or test anything.
The linker complaining about files that are not for the correct architecture seems normal.
Is your last error message complete? Seems that there ought to be some more information after "x86_64:".
@hillu Thanks for the response. I actually figured out this second error as well.
Turns out the error regarding undefined symbols was a result of homebrew installing the amd64
toolchain for go instead of the arm64
toolchain which is correct for an M1 Macbook.
Here's the steps I took to fix this.
go env | grep GOARCH
. In my case I got back GOARCH=amd64
which is not correctsudo rm -rf /usr/local/go
sudo rm /etc/paths.d/go
CONCLUSION To resolve both errors i've mentioned in this issue.
yara
, pkg-config
and openssl
through homebrew
brew install yara
brew install pkg-config
brew install openssl
go install
step
PKG_CONFIG_PATH=/opt/homebrew/opt/yara/lib/pkgconfig:/opt/homebrew/opt/openssl/lib/pkgconfig go install github.com/hillu/go-yara/v4
NOTE: Go tries to use github.com/hillu/go-yara
as the import but I wanted github.com/hillu/go-yara/v4
since I was using yara 4.2. Just be aware of that because it can make it seem like the libcrypto error never got resolved.
When I run
go install github.com/hillu/go-yara
or when I run my prototype app using this library (i.e. go run main.go) on my M1 Macbook I get this error.To resolve this issue I have installed
yara
,openssl
andpkg-config
with homebrew.I have also tried setting the
PKG_CONFIG_PATH
to look at the openssl version installed. According to this LinuxFAQ postbrew install openssl
should include libcryptoI'm not sure if this is a yara issue, a pkg-config issue or something going on with the install of this go module. Any guidance would be greatly appreciated.