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

gollvm: error: ‘class llvm::PointerType’ has no member named ‘getElementType’ #56092

Open
iMacker2020 opened this issue Oct 7, 2022 · 4 comments
Assignees
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@iMacker2020
Copy link

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

$ go version
1.19

Does this issue reproduce with the latest release?

Yes.

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

Operating System: linux
Processor Architecture: amd64

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3007501738=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I followed the directions on this page to build gollvm: https://go.googlesource.com/gollvm

What did you expect to see?

I expected to successfully compile gollvm.

What did you see instead?

I saw this error:

/home/user/workarea/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:1433:50: error: ‘class llvm::PointerType’ has no member named ‘getElementType’; did you mean ‘getArrayElementType’?
 1433 |       Type *T = cast(V->getType())->getElementType();
      |                                     ^~~~~~~~~~~~~~
      |                                      getArrayElementType
@iMacker2020
Copy link
Author

Found out that llvm commit ff040eca93fb5700b30fc81cde9b8f9401c8da67 removed the PointerType::getElementType() function.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 7, 2022
@ianlancetaylor ianlancetaylor added this to the gollvm milestone Oct 7, 2022
@ianlancetaylor
Copy link
Contributor

CC @thanm @cherrymui

@thanm
Copy link
Contributor

thanm commented Oct 7, 2022

Hi @iMacker2020 , yes, this is a known limitation of gollcm at the moment; the bridge source code hasn't been updated to take into account this change. See also #51588.

For the time being you can build gollvm by selecting an older version of LLVM; I recommend 09629215c272f09e3ebde6cc7eac9625d28910ff. These commit hashes should produce a working version of gollvm:

gollvm: 253c122ed62d5e9a32a9806e83c47a389a6435bf
llvm-project: 09629215c272f09e3ebde6cc7eac9625d28910ff
gofrontend: 50707b4b51266166ce9bcf9de187e35760ec50f9
libffi: aa3fce08ba620c50db17215a9f14dd0f1facf741
libbacktrace: 2446c66076480ce07a6bd868badcbceb3eeecc2e

Thanks.

@twelveand0
Copy link

Hi @iMacker2020 , yes, this is a known limitation of gollcm at the moment; the bridge source code hasn't been updated to take into account this change. See also #51588.

For the time being you can build gollvm by selecting an older version of LLVM; I recommend 09629215c272f09e3ebde6cc7eac9625d28910ff. These commit hashes should produce a working version of gollvm:

gollvm: 253c122ed62d5e9a32a9806e83c47a389a6435bf llvm-project: 09629215c272f09e3ebde6cc7eac9625d28910ff gofrontend: 50707b4b51266166ce9bcf9de187e35760ec50f9 libffi: aa3fce08ba620c50db17215a9f14dd0f1facf741 libbacktrace: 2446c66076480ce07a6bd868badcbceb3eeecc2e

Thanks.

Just add a note for newcomers:
This version can be successfully built with GCC-11.3.0, but cannot be built with GCC-6.2.0. However, I didn't test with other GCCs whose versions are between 6.2.0 and 11.3.0. So, please at least make sure your GCC version is newer than 6.2.0, otherwise, you will get stuck in compilation errors (such as llvm-godumpspec segmentation fault when processing gen-sysinfo.go.tmp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants