Skip to content

cmd/go: go build ignores installed packages in GOPATH #26983

Closed
@yuzhichang

Description

@yuzhichang

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.11rc1 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/abclab/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/abclab/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build545148080=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Build and install https://github.com/infinivision/vectodb.
    Note this is cgo wrapper of some C++ code, and requires custom build script and some third-party C++ shared libraries. It cannot be built with standard "go build".
    vectodb is installed to /home/abclab/go/pkg/linux_amd64/github.com/infinivision/vectodb.a.

  2. Try build https://github.com/infinivision/filesyncer (branch replace_dep) with build.sh. This script invokes "GO111MODULE=on go build...".
    I got the error:
    github.com/infinivision/vectodb
    /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lfaiss
    collect2: error: ld returned 1 exit status

It tried to build vectodb with standard "go build", failed with missing an third-party C++ shared library.

What did you expect to see?

"GO111MODULE=on go build..." shall reuse installed packages in GOPATH.

What did you see instead?

"GO111MODULE=on go build..." ignored vectodb.a in GOPATH, tried to build vectodb with standard "go build", and failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions