Giter Site home page Giter Site logo

Comments (3)

hop-along-polly avatar hop-along-polly commented on June 3, 2024

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:

from go-yara.

hillu avatar hillu commented on June 3, 2024

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:".

from go-yara.

hop-along-polly avatar hop-along-polly commented on June 3, 2024

@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.

  1. Check which version of go is installed go env | grep GOARCH. In my case I got back GOARCH=amd64 which is not correct
  2. If the GOARCH is incorrect you need to uninstall go. See official instructions here
sudo rm -rf /usr/local/go
sudo rm /etc/paths.d/go
  1. Download and install the correct version of go from the official download page (and don't use homebrew b/c it assumes you want the amd64 version)

CONCLUSION To resolve both errors i've mentioned in this issue.

  1. Install the correct version of go for my systems architecture
  2. Install yara, pkg-config and openssl through homebrew
brew install yara
brew install pkg-config
brew install openssl
  1. Use this command during the 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.

from go-yara.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.