Build with GCC12 fails
Checklist
- [X] This is a bug report, not a question. Ask questions on discuss.ipfs.io.
- [X] I have searched on the issue tracker for my bug.
- [X] I am running the latest go-ipfs version or have an issue updating.
Installation method
built from source
Version
Tried to build a72753bad from source.
Config
Does not apply
Description
I've installed the new gcc12 which supposedly supports go in version 1.18.
But apart from a bug which avoids printing out the right version number - which I worked around by a simple echo script giving out the correct version string - it doesn't build:
patch -Np1 -i ../rb.patch
# make sure GOPATH is set to writeable
chmod u+w -R "$GOPATH"
export CGO_LDFLAGS="$LDFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
# dirty fix go1.18
sed -i -r 's,^go 1\.[0-9]+,go 1.18,' go.mod
go mod tidy
go mod vendor
make nofuse
With rb.patch, see https://github.com/ipfs/go-ipfs/pull/8213#issuecomment-881866789.
Building with the normal go compiler works fine.
~~Sorry, this is unclear to me, are you using GCCGO ?~~ nvm yes following your link
~~If yes,~~ Does this bug reproduce with Gollvm + gofrontend ?
Also what does fail means. Any error message ? Or the binary segfault while trying to run it ?
plugin/loader/preload.sh > plugin/loader/preload.go
go version go1.18.0 gccgo (GCC) 12.1.0 linux/amd64
bin/check_go_version 1.17
go fmt plugin/loader/preload.go >/dev/null
go build -buildmode=pie -trimpath -modcacherw "-trimpath" -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=a72753bad-dirty" -tags="nofuse" -o "cmd/ipfs/ipfs" "github.com/ipfs/go-ipfs/cmd/ipfs"
plugin/loader/load_unix.go:10:2: cannot find package "." in:
/home/rubenk/dev/go-ipfs-git.AUR/src/go-ipfs/vendor/plugin
make: *** [cmd/ipfs/Rules.mk:22: cmd/ipfs/ipfs] Error 1
==> ERROR: A failure occurred in build().
Aborting...
Well, the error message makes kind of sense, as there's no folder/file with that name:
$ ls -l /home/rubenk/dev/go-ipfs-git.AUR/src/go-ipfs/vendor/plugin
ls: cannot access '/home/rubenk/dev/go-ipfs-git.AUR/src/go-ipfs/vendor/plugin': No such file or directory
Maybe it's just my shim to have go output the right version string, because of the bug mentioned above.
I use this in /usr/bin/go and moved the normal go binary to /usr/bin/go_real
# gcc-go wrapper
explode_args() {
unset OPTS
local arg=$1
while [[ $arg ]]; do
[[ $arg = "--" ]] && OPTS+=("$@") && break;
if [[ ${arg:0:1} = "-" && ${arg:1:1} != "-" ]]; then
OPTS+=("-${arg:1:1}")
(( ${#arg} > 2 )) && arg="-${arg:2}" || { shift; arg=$1; }
else
OPTS+=("$arg"); shift; arg=$1
fi
done
}
CMDLINE_ARGS=("$@")
explode_args "$@"
VERSION_REQUESTED=0
for ((i = 0; i < "${#OPTS[@]}"; i++)); do
case ${OPTS[$i]} in
version) unset OPTS[$i]; VERSION_REQUESTED=1;
esac
done
if [[ VERSION_REQUESTED -eq 1 ]]; then
echo 'go version go1.18.0 gccgo (GCC) 12.1.0 linux/amd64'
else
/usr/bin/go_real "${CMDLINE_ARGS[@]}"
fi
Does this bug reproduce with Gollvm + gofrontend ?
Don't know. Never used it. I'll look into it.
Maybe it's just my shim to have go output the right version string, because of the bug mentioned above.
That's not the issue, builds fine with the normal go compiler through the same shim.
==> Starting build()...
plugin/loader/preload.sh > plugin/loader/preload.go
go version go1.18.1 linux/amd64
bin/check_go_version 1.17
go fmt plugin/loader/preload.go >/dev/null
go build -buildmode=pie -modcacherw "-trimpath" -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=a72753bad-dirty" -tags="nofuse" -o "cmd/ipfs/ipfs" "github.com/ipfs/go-ipfs/cmd/ipfs"
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Stripping unneeded symbols from binaries and libraries...
-> Compressing man and info pages...
==> Checking for packaging issues...
==> Creating package "go-ipfs-git"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Adding install file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: go-ipfs-git 0.13.0rc1.r18.ga72753bad-1 (Sat 14 May 2022 04:52:14 PM CEST)
Does this bug reproduce with Gollvm + gofrontend ?
Don't know. Never used it. I'll look into it.
There's no package available for them for Arch and I really don't feel like building it myself. :)
2022-09-08 triage conversation: this is a custom build setup. This isn't a priority for core maintainers. Feel free to submit a PR.