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: assertion failed when compiling golang.org/x/mod/semver on Ubuntu 20.04 #47570

Open
u2400 opened this issue Aug 6, 2021 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@u2400
Copy link

u2400 commented Aug 6, 2021

Does this issue reproduce with the latest release?

Yes.

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

go env Output
(base) root@7e4c15edc8bd:~/workdir/build-debug# cat /etc/issue
Ubuntu 20.04.2 LTS \n \l

What did you do?

I followed the instructions on the gollvm page.

What did you expect to see?

The project builds cleanly.

What did you see instead?

I built gollvm in docker, and got the following error message

Error message:
(base) root@7e4c15edc8bd:~/workdir/build-debug# cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++  -G Ninja ../llvm-project/llvm
...

(base) root@7e4c15edc8bd:~/workdir/build-debug# ninja gollvm
...
[2466/3746] Building Go package 'golang.org/x/mod/semver' (non-PIC)
FAILED: tools/gollvm/libgo/golang.org/x/mod/semver.o /root/workdir/build-debug/tools/gollvm/libgo/golang.org/x/mod/semver.o
cd /root/workdir/build-debug/tools/gollvm/libgo && /usr/local/bin/cmake-3.21.1-linux-x86_64/bin/cmake -E make_directory ./golang.org/x/mod && /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/golang.org/x/mod/semver.o -fgo-pkgpath=golang.org/x/mod/semver -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/golang.org/x/mod/semver/semver.go
llvm-goc: /root/workdir/llvm-project/llvm/include/llvm/IR/Attributes.h:844: llvm::AttrBuilder &llvm::AttrBuilder::addAttribute(Attribute::AttrKind): Assertion Attribute::isEnumAttrKind(Val) && "Adding integer/type attribute without an argument!"' failed. Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATHto point to it): /root/workdir/build-debug/./bin/llvm-goc[0x304676a] /root/workdir/build-debug/./bin/llvm-goc[0x304693b] /root/workdir/build-debug/./bin/llvm-goc[0x3044f0b] /root/workdir/build-debug/./bin/llvm-goc[0x30470b1] /lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f10378513c0] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f103730118b] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f10372e0859] /lib/x86_64-linux-gnu/libc.so.6(+0x25729)[0x7f10372e0729] /lib/x86_64-linux-gnu/libc.so.6(+0x36f36)[0x7f10372f1f36] /root/workdir/build-debug/./bin/llvm-goc[0x6e2a8c] /root/workdir/build-debug/./bin/llvm-goc[0x6ddceb] /root/workdir/build-debug/./bin/llvm-goc[0x6def99] /root/workdir/build-debug/./bin/llvm-goc[0x6ea885] /root/workdir/build-debug/./bin/llvm-goc[0x6ea497] /root/workdir/build-debug/./bin/llvm-goc[0x6e2f0a] /root/workdir/build-debug/./bin/llvm-goc[0x6d8423] /root/workdir/build-debug/./bin/llvm-goc[0x5d64d1] /root/workdir/build-debug/./bin/llvm-goc[0x672b75] /root/workdir/build-debug/./bin/llvm-goc[0x64bbca] /root/workdir/build-debug/./bin/llvm-goc[0x55dad1] /root/workdir/build-debug/./bin/llvm-goc[0x558861] /root/workdir/build-debug/./bin/llvm-goc[0x4e3325] /root/workdir/build-debug/./bin/llvm-goc[0x4e2c2d] /root/workdir/build-debug/./bin/llvm-goc[0x4d0bdb] /root/workdir/build-debug/./bin/llvm-goc[0x4cf7f7] /root/workdir/build-debug/./bin/llvm-goc[0x4c6d10] /root/workdir/build-debug/./bin/llvm-goc[0x4a6cf0] /root/workdir/build-debug/./bin/llvm-goc[0x4a48e1] /root/workdir/build-debug/./bin/llvm-goc[0x4a84e6] /root/workdir/build-debug/./bin/llvm-goc[0x496a76] /root/workdir/build-debug/./bin/llvm-goc[0x496c7c] /root/workdir/build-debug/./bin/llvm-goc[0x48908e] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f10372e20b3] /root/workdir/build-debug/./bin/llvm-goc[0x48843e] PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/golang.org/x/mod/semver.o -fgo-pkgpath=golang.org/x/mod/semver -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/golang.org/x/mod/semver/semver.go Aborted [2470/3746] Building Go package 'hash/maphash' (non-PIC) FAILED: tools/gollvm/libgo/hash/maphash.o /root/workdir/build-debug/tools/gollvm/libgo/hash/maphash.o cd /root/workdir/build-debug/tools/gollvm/libgo && /usr/local/bin/cmake-3.21.1-linux-x86_64/bin/cmake -E make_directory ./hash && /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/hash/maphash.o -fgo-pkgpath=hash/maphash -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/hash/maphash/maphash.go llvm-goc: /root/workdir/llvm-project/llvm/include/llvm/IR/Attributes.h:844: llvm::AttrBuilder &llvm::AttrBuilder::addAttribute(Attribute::AttrKind): AssertionAttribute::isEnumAttrKind(Val) && "Adding integer/type attribute without an argument!"' failed.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
/root/workdir/build-debug/./bin/llvm-goc[0x304676a]
/root/workdir/build-debug/./bin/llvm-goc[0x304693b]
/root/workdir/build-debug/./bin/llvm-goc[0x3044f0b]
/root/workdir/build-debug/./bin/llvm-goc[0x30470b1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f77f20623c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f77f1b1218b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f77f1af1859]
/lib/x86_64-linux-gnu/libc.so.6(+0x25729)[0x7f77f1af1729]
/lib/x86_64-linux-gnu/libc.so.6(+0x36f36)[0x7f77f1b02f36]
/root/workdir/build-debug/./bin/llvm-goc[0x6e2a8c]
/root/workdir/build-debug/./bin/llvm-goc[0x6ddceb]
/root/workdir/build-debug/./bin/llvm-goc[0x6def99]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea885]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea497]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea36e]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea36e]
/root/workdir/build-debug/./bin/llvm-goc[0x6e2f0a]
/root/workdir/build-debug/./bin/llvm-goc[0x6d8423]
/root/workdir/build-debug/./bin/llvm-goc[0x5d64d1]
/root/workdir/build-debug/./bin/llvm-goc[0x55b2be]
/root/workdir/build-debug/./bin/llvm-goc[0x558861]
/root/workdir/build-debug/./bin/llvm-goc[0x4e3325]
/root/workdir/build-debug/./bin/llvm-goc[0x55dcf1]
/root/workdir/build-debug/./bin/llvm-goc[0x558861]
/root/workdir/build-debug/./bin/llvm-goc[0x4e3325]
/root/workdir/build-debug/./bin/llvm-goc[0x4e2c2d]
/root/workdir/build-debug/./bin/llvm-goc[0x4d0bdb]
/root/workdir/build-debug/./bin/llvm-goc[0x4cf7f7]
/root/workdir/build-debug/./bin/llvm-goc[0x4c6d10]
/root/workdir/build-debug/./bin/llvm-goc[0x4a6cf0]
/root/workdir/build-debug/./bin/llvm-goc[0x4a48e1]
/root/workdir/build-debug/./bin/llvm-goc[0x4a84e6]
/root/workdir/build-debug/./bin/llvm-goc[0x496a76]
/root/workdir/build-debug/./bin/llvm-goc[0x496c7c]
/root/workdir/build-debug/./bin/llvm-goc[0x48908e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f77f1af30b3]
/root/workdir/build-debug/./bin/llvm-goc[0x48843e]
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/hash/maphash.o -fgo-pkgpath=hash/maphash -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/hash/maphash/maphash.go
Aborted
[2471/3746] Building Go package 'hash/maphash' (PIC)
FAILED: tools/gollvm/libgo/hash/.pic/maphash.o /root/workdir/build-debug/tools/gollvm/libgo/hash/.pic/maphash.o
cd /root/workdir/build-debug/tools/gollvm/libgo && /usr/local/bin/cmake-3.21.1-linux-x86_64/bin/cmake -E make_directory ./hash/.pic && /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/hash/.pic/maphash.o -fPIC -fgo-pkgpath=hash/maphash -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/hash/maphash/maphash.go
llvm-goc: /root/workdir/llvm-project/llvm/include/llvm/IR/Attributes.h:844: llvm::AttrBuilder &llvm::AttrBuilder::addAttribute(Attribute::AttrKind): Assertion Attribute::isEnumAttrKind(Val) && "Adding integer/type attribute without an argument!"' failed. Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH` to point to it):
/root/workdir/build-debug/./bin/llvm-goc[0x304676a]
/root/workdir/build-debug/./bin/llvm-goc[0x304693b]
/root/workdir/build-debug/./bin/llvm-goc[0x3044f0b]
/root/workdir/build-debug/./bin/llvm-goc[0x30470b1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7fab3011a3c0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fab2fbca18b]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fab2fba9859]
/lib/x86_64-linux-gnu/libc.so.6(+0x25729)[0x7fab2fba9729]
/lib/x86_64-linux-gnu/libc.so.6(+0x36f36)[0x7fab2fbbaf36]
/root/workdir/build-debug/./bin/llvm-goc[0x6e2a8c]
/root/workdir/build-debug/./bin/llvm-goc[0x6ddceb]
/root/workdir/build-debug/./bin/llvm-goc[0x6def99]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea885]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea497]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea36e]
/root/workdir/build-debug/./bin/llvm-goc[0x6ea36e]
/root/workdir/build-debug/./bin/llvm-goc[0x6e2f0a]
/root/workdir/build-debug/./bin/llvm-goc[0x6d8423]
/root/workdir/build-debug/./bin/llvm-goc[0x5d64d1]
/root/workdir/build-debug/./bin/llvm-goc[0x55b2be]
/root/workdir/build-debug/./bin/llvm-goc[0x558861]
/root/workdir/build-debug/./bin/llvm-goc[0x4e3325]
/root/workdir/build-debug/./bin/llvm-goc[0x55dcf1]
/root/workdir/build-debug/./bin/llvm-goc[0x558861]
/root/workdir/build-debug/./bin/llvm-goc[0x4e3325]
/root/workdir/build-debug/./bin/llvm-goc[0x4e2c2d]
/root/workdir/build-debug/./bin/llvm-goc[0x4d0bdb]
/root/workdir/build-debug/./bin/llvm-goc[0x4cf7f7]
/root/workdir/build-debug/./bin/llvm-goc[0x4c6d10]
/root/workdir/build-debug/./bin/llvm-goc[0x4a6cf0]
/root/workdir/build-debug/./bin/llvm-goc[0x4a48e1]
/root/workdir/build-debug/./bin/llvm-goc[0x4a84e6]
/root/workdir/build-debug/./bin/llvm-goc[0x496a76]
/root/workdir/build-debug/./bin/llvm-goc[0x496c7c]
/root/workdir/build-debug/./bin/llvm-goc[0x48908e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fab2fbab0b3]
/root/workdir/build-debug/./bin/llvm-goc[0x48843e]
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /root/workdir/build-debug/./bin/llvm-goc -c -o /root/workdir/build-debug/tools/gollvm/libgo/hash/.pic/maphash.o -fPIC -fgo-pkgpath=hash/maphash -I . /root/workdir/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/hash/maphash/maphash.go
Aborted
[2479/3746] Building Go package 'unicode' (non-PIC)
ninja: build stopped: subcommand failed.

Other Environmental information

(base) root@7e4c15edc8bd:~/workdir/build-debug# ninja --version
1.10.0

(base) root@7e4c15edc8bd:~/workdir/build-debug# python --version
Python 3.9.5

(base) root@7e4c15edc8bd:~/workdir/build-debug# cmake --version
cmake version 3.21.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

(base) root@7e4c15edc8bd:~/workdir/build-debug# clang --version
Ubuntu clang version 11.1.0-++20210801112124+1fdec59bffc1-1~exp1~20210801092747.168
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

This issues(#42843) mentioned the same problem

@bcmills bcmills changed the title gollvm: golang.org/x/mod/semver package is not compiling on Ubuntu 20.04 gollvm: assertion failed when compiling golang.org/x/mod/semver on Ubuntu 20.04 Aug 6, 2021
@ianlancetaylor
Copy link
Contributor

CC @thanm

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 6, 2021
@ianlancetaylor ianlancetaylor added this to the gollvm milestone Aug 6, 2021
@gopherbot
Copy link

Change https://golang.org/cl/340124 mentions this issue: gollvm: update struct ret attribute construction

@thanm
Copy link
Contributor

thanm commented Aug 6, 2021

I sent https://go-review.googlesource.com/c/gollvm/+/340124, which should resolve this particular problem once it is submitted.

For the time being I would recommend RelWithDebInfo with -DCMAKE_BUILD_TYPE= as opposed to Debug, since there seems to be another issue there with Debug that I haven't had a chance to look over.

@u2400
Copy link
Author

u2400 commented Aug 7, 2021

Cool! Although I haven't tried to run it yet, but the build succeeded.

(base) root@7e4c15edc8bd:~/workdir/build-debug# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_USE_LINKER=gold -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++  -G Ninja ../llvm-project/llvm
...
(base) root@7e4c15edc8bd:~/workdir/build-debug# ninja gollvm 
...
[3763/3763] Building go program cgo

Thank you very much!

tk-aria pushed a commit to tk-aria/gollvm that referenced this issue Feb 15, 2022
Additional fixes to call attribute creation code to use
AttrBuilder::addStructRetAttr instead of setting StructRet directly,
similar to the changes made in CL 274833 (this is needed since the
underlying LLVM code has become more strict about how these attrs are
set).

Updates golang/go#47570.

Change-Id: I02d0182c6a559a3ab09ff56e06db9698d2d78bff
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/340124
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
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