Open ashnair1 opened 2 years ago
godal makes use of pkg-config to pass ldflags to cgo, so you will need to let it know where the GDAL pkg-config path is. I don't know the specific install location when using miniconda, but once you know the path something like this would work:
PKG_CONFIG_PATH=//Users/ash/miniconda3/lib/gdal/pkgconfig go run main.go
I had already set PKG_CONFIG_PATH
prior to running the command. The error still occurs.
$ echo $PKG_CONFIG_PATH
/Users/ash/miniconda3/lib/pkgconfig
$ ls $PKG_CONFIG_PATH | grep gdal.pc
gdal.pc
$ go run main.go
dyld[28793]: Library not loaded: @rpath/libgdal.30.dylib
Referenced from: /private/var/folders/y5/yh59dj093xn_dz8lm0mhv6lh0000gp/T/go-build3191999631/b001/exe/test
Reason: tried: '/usr/local/lib/libgdal.30.dylib' (no such file), '/usr/lib/libgdal.30.dylib' (no such file)
signal: abort trap
ok then you'd need to tell it where to find the dynamic library at runtime, something like LD_LIBRARY_PATH=/Users/ash/miniconda3/lib go run main.go
perhaps? I'm just guessing that's where miniconda libs live.
You mean DYLD_LIBRARY_PATH
? This is for MacOS. I tried setting those and the problem persists.
Btw, that is indeed where miniconda libs live
I was trying out the godal library (on my M1 Mac) and wrote a simple script as follows:
Running
go run main.go
throws the following errorgodal has a dependency on gdal and I had installed it via conda. Due to this, the dylib is located under my conda folder -
/Users/ash/miniconda3/lib
not/usr/local/lib
.How can I have the program search for
libgdal.dylib
in/Users/ash/miniconda3/lib
instead of/usr/local/lib
?Had raised this question in StackOverflow previously but didn't get any solutions to this issue. Link - here