hillu/go-yara

ld: warning: directory not found for option '-L/usr/local/Cellar/yara/4.1.2/lib'

digitalsurgeon opened this issue · 1 comments

Hello

I am using go-yara in my project, and I have now started seeing the following when I execute: "go run .":
ld: warning: directory not found for option '-L/usr/local/Cellar/yara/4.1.2/lib'

here is my go.mod:

➜  experiments cat go.mod                                            
module experiment

go 1.15

require github.com/hillu/go-yara/v4 v4.0.4

➜  experiments cat hello_yara.go 
package main

import (
        "fmt"
        "os"

        yara "github.com/hillu/go-yara/v4"
)

func main() {
        fmt.Println("Hello, World!")

        c, err := yara.NewCompiler()

        if err != nil {
                fmt.Println("Error")
        } else {
                f, err := os.Open("/Users/am/code/experiments/src/test-data/no-var.yara")
                if err != nil {
                        fmt.Println("Could not open rule file %s", err)
                }

                err = c.AddFile(f, "main")

                if err != nil {
                        fmt.Println("failed to add file to the yara engine: %s", err)
                }

        }
}
➜  experiments go run .
# gs-content-classifier
ld: warning: directory not found for option '-L/usr/local/Cellar/yara/4.1.2/lib'
Hello, World!
➜  experiments

I see here that a new version (4.2.0) of this module was released March 11, perhaps some paths were not updated during this release ?

hillu commented

/usr/local/Cellar leads me to believe that this is on MacOSX. Is that correct?

Your program seems to have been compiled and linked just fine, so you could just ignore the linker's warning.

Unless you have specified the yara_no_pkg_config build tag, pkg-config is used behind the scenes to determine compiler and linker flags. The specific commands are going to be something like pkg-config --cflags yara and pkg-config --libs yara.

The most likely explanation for the warning you get is that you have a stale yara.pc lying around after upgrading libyara.