I am trying to create a golang program that uses a static library (.a file)
directory structure for my project as below
└─testserver ├─bin ├─pkg └─src ├─logging └─testserver ├─libtest.a └─test.go
flags for cgo in test.go as below
// #cgo LDFLAGS: -L /home/test/testserver/src/testserver -ltest // #include "test.h" import "C"
when I use the absolute path for LDFLAGS -L, it works fine, but when I change the path to a relative path, for example
//
and then run the command
go install testserver
he returns me an error and says that he "cannot find the -L test"
my question is, how can I use the relative path in LDFLAGS ?, so that I can build the project in any path.
source share