-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: go build ignores installed packages in GOPATH #26983
Comments
The error you got is related to Try running |
I'm sure system's linker works since https://github.com/infinivision/vectodb (a cgo wrapper of libfaiss and vectodb.cpp) compilation uses this linker. https://github.com/infinivision/filesyncer (branch remove_dep) "GO111MODULE=on go build -x" output:
My point is, vectodb compilation uses custom build script, filesyncer cannot build that package with standard "GO111MODULE=on go build". There shall be some way to tell filesyncer that fact. At filesyncer master branch, there's following line in Gopkg.toml: |
There is some difference in the build ID between your installed package and the computation of the build ID done when building It might possibly help to treat this package as a binary-only package after you build it. See https://golang.org/cmd/go/#hdr-File_types . I haven't tried this so I don't know whether it will work. |
|
How does it get built? |
Also you have not said explicitly that |
vectodb uses custom build script SConstruct. It invokes gcc and "go build". It works if both vectodb and filesyncer use I edited vectodb and filesyncer to both use |
That will not work in module mode today: see #28146. |
As far as I can tell the Injecting a pre-built copy of that artifact essentially treats the package as a binary-only package, for which we're dropping support (#28152) — in large part due to the difficulty of detecting and diagnosing these sorts of version skew issues. The alternatives discussed in that proposal likely apply here as well: in particular, you may be able to compile the library separately as a Go plugin, or compile platform-specific |
I notice that a |
@bcmills For the project need, an earlier commit f5439f8e92f017daafffe38ef1c5f3aeec189b69 of |
The procedure of the original post — manually installing to (As mentioned above, the long-term alternatives that I know of are to use plugins or |
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?
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.
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.
The text was updated successfully, but these errors were encountered: