golinkercgopkg-config

go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: cannot find -lgdal


I am trying to run go build on my sources.

go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lgdal
collect2: error: ld returned 1 exit status

My LD_LIBRARY_PATH variable contains /home/fzd/project/lib64, the path to the dir of the libgdal.so file. My PKG_CONFIG_PATH contains the path to the dir of a .pc file with the following contents :

prefix=/home/fzd/project
exec_prefix=${prefix}
libdir=${prefix}/lib64
deplibdir=${prefix}/lib64
includedir=${prefix}/include

Name: myLibs
Description: Libs
Requires:
Version: v1.0
Libs: -L${deplibdir} -lgdal
Cflags: -I${includedir}

I don't know which variable to check. Everything seems fine, and the fun part is that, when I clone my repo elsewhere, I don't have the issue (same LD_LIBRARY_PATH, etc.)

Does anyone have a clue about what I could check?

I am using go1.11.1, on CentOS7.6.


Solution

  • Here are a few things I did to solve this issue: