Skip to content
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

Build with GCC12 fails #8975

Open
3 tasks done
RubenKelevra opened this issue May 14, 2022 · 9 comments
Open
3 tasks done

Build with GCC12 fails #8975

RubenKelevra opened this issue May 14, 2022 · 9 comments
Labels
kind/bug A bug in existing code (including security flaws) P4 Very low priority topic/build Topic build

Comments

@RubenKelevra
Copy link
Contributor

Checklist

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 #8213 (comment).

Building with the normal go compiler works fine.

@RubenKelevra RubenKelevra added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels May 14, 2022
@Jorropo
Copy link
Contributor

Jorropo commented May 14, 2022

Sorry, this is unclear to me, are you using GCCGO ? nvm yes following your link

If yes, Does this bug reproduce with Gollvm + gofrontend ?

@Jorropo Jorropo added the topic/build Topic build label May 14, 2022
@Jorropo
Copy link
Contributor

Jorropo commented May 14, 2022

Also what does fail means.
Any error message ? Or the binary segfault while trying to run it ?

@RubenKelevra
Copy link
Contributor Author

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...

@RubenKelevra
Copy link
Contributor Author

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

@RubenKelevra
Copy link
Contributor Author

RubenKelevra commented May 14, 2022

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

@RubenKelevra
Copy link
Contributor Author

Does this bug reproduce with Gollvm + gofrontend ?

Don't know. Never used it. I'll look into it.

@RubenKelevra
Copy link
Contributor Author

RubenKelevra commented May 14, 2022

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)

@RubenKelevra
Copy link
Contributor Author

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. :)

@BigLep BigLep added P4 Very low priority and removed need/triage Needs initial labeling and prioritization labels Sep 8, 2022
@BigLep
Copy link
Contributor

BigLep commented Sep 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) P4 Very low priority topic/build Topic build
Projects
None yet
Development

No branches or pull requests

3 participants