Error running gollvm on Ubuntu 20.04

428 views
Skip to first unread message

Khanh TN

unread,
Mar 9, 2021, 12:21:46 PM3/9/21
to golang-nuts
Hi, I'm a newbie.
I built and installed gollvm with instructions from https://go.googlesource.com/gollvm
The build/installation was successful but it cannot run after installing.
The step on the page "Using an installed copy of gollvm" is where the error happens. Running "go" gives me this error:
symbol lookup error: /home/user/another-gollvm-installdir/lib64/libgo.so.13git: undefined symbol: runtime.memmove
I'm on Ubuntu 20.04, gcc 9.3.0.
Anyone has this problem or built gollvm and has the solution for me? Also, can anyone replicate this error? (If you have free time, thanks, building anything llvm takes lots of time lol) (Should I file an issue on github?)

Khanh TN

unread,
Mar 9, 2021, 1:18:20 PM3/9/21
to golang-nuts
To clarify, I got an error on step "Using an installed copy of gollvm" of page https://go.googlesource.com/gollvm

Khanh TN

unread,
Mar 9, 2021, 1:18:20 PM3/9/21
to golang-nuts
Looks like the same error as this one https://github.com/golang/go/issues/44861 . I'm just looking at their first comment on github, ignoring the lengthy bug report.

On Wednesday, March 10, 2021 at 1:21:46 AM UTC+8 Khanh TN wrote:

Ian Lance Taylor

unread,
Mar 9, 2021, 1:24:01 PM3/9/21
to Khanh TN, Than McIntosh, golang-nuts
My guess is that the GoLLVM cmake files need to be updated for the
addition of libgo/runtime/go-memmove.c in
https://golang.org/cl/294931.

Ian

Than McIntosh

unread,
Mar 9, 2021, 1:33:44 PM3/9/21
to Ian Lance Taylor, Khanh TN, golang-nuts
Thanks Ian, yes, that seems likely. I will look into sending a patch.

Than

Khanh TN

unread,
Mar 9, 2021, 9:28:54 PM3/9/21
to golang-nuts
Thanks a lot for the fix!
I tried git pull all the repos and reinstalled gollvm and I can run "go" now.

However there are still problems.
I am trying "go build" on some of my go code. Some build just fine.
But there is one piece of code that "go build" gives this error:
"/usr/bin/ld.gold: error: $WORK/b076/_pkg_.a(gccgo_c.o): failed to match split-stack sequence at section 1 offset 0
/usr/bin/ld.gold: error: $WORK/b076/_pkg_.a(gccgo_c.o): failed to match split-stack sequence at section 1 offset a6"

On this piece, if I run "go build" using normal Go, not gollvm, it builds just fine.
Is there still a bug or is it on my end?

Khanh

On Wednesday, March 10, 2021 at 1:21:46 AM UTC+8 Khanh TN wrote:

Ian Lance Taylor

unread,
Mar 9, 2021, 10:14:19 PM3/9/21
to Khanh TN, golang-nuts, Than McIntosh
On Tue, Mar 9, 2021 at 6:29 PM Khanh TN <tnkh...@gmail.com> wrote:
>
> Thanks a lot for the fix!
> I tried git pull all the repos and reinstalled gollvm and I can run "go" now.
>
> However there are still problems.
> I am trying "go build" on some of my go code. Some build just fine.
> But there is one piece of code that "go build" gives this error:
> "/usr/bin/ld.gold: error: $WORK/b076/_pkg_.a(gccgo_c.o): failed to match split-stack sequence at section 1 offset 0
> /usr/bin/ld.gold: error: $WORK/b076/_pkg_.a(gccgo_c.o): failed to match split-stack sequence at section 1 offset a6"
>
> On this piece, if I run "go build" using normal Go, not gollvm, it builds just fine.
> Is there still a bug or is it on my end?

I'm not sure. What version of gold are you using? Do you happen to
know if the program you are building imports golang.org/x/sys/unix? I
ask that to try to figure out which gccgo_c file is involved here.

Ian

Khanh TN

unread,
Mar 9, 2021, 10:30:45 PM3/9/21
to golang-nuts
Ah, thanks. I see.
Let me investigate my case further. I will report back later, eh, if I remember to.

Khanh

Khanh TN

unread,
Mar 13, 2021, 7:26:06 PM3/13/21
to golang-nuts
Hi Ian,
"gold --version" gives me "GNU gold (GNU Binutils for Ubuntu 2.34) 1.16"
"go list -m all" does list the module golang.org/x/sys. Does it help with the case?
Thanks for your help.

Khanh

On Wednesday, March 10, 2021 at 11:14:19 AM UTC+8 Ian Lance Taylor wrote:

Khanh TN

unread,
Mar 13, 2021, 7:50:46 PM3/13/21
to golang-nuts
Hi, Ian,
It does look like importing golang.org/x/sys/unix causes the problem
A simple go program like

package main

import (
         "fmt"
         "golang.org/x/sys/unix"
)
 
func main() {
   fmt.Println("Hello, World!")
   fmt.Println(unix.Getpagesize())
}


does cause the same error as before. This file builds and runs fine with my normal Go but gives that error with Gollvm. If I do not include unix, Gollvm does work though.
What do you suggest?

Khanh
On Wednesday, March 10, 2021 at 11:14:19 AM UTC+8 Ian Lance Taylor wrote:

Ian Lance Taylor

unread,
Mar 15, 2021, 7:53:34 PM3/15/21
to Khanh TN, golang-nuts
On Sat, Mar 13, 2021 at 4:51 PM Khanh TN <tnkh...@gmail.com> wrote:
>
> Hi, Ian,
> It does look like importing golang.org/x/sys/unix causes the problem
> A simple go program like
>
> package main
>
> import (
> "fmt"
> "golang.org/x/sys/unix"
> )
>
> func main() {
> fmt.Println("Hello, World!")
> fmt.Println(unix.Getpagesize())
> }
>
> does cause the same error as before. This file builds and runs fine with my normal Go but gives that error with Gollvm. If I do not include unix, Gollvm does work though.
> What do you suggest?

This sounds like a bug somewhere between LLVM and gold. You should
probably file a bug report against gold (at
https://sourceware.org/bugzilla). I don't know why nobody else has
reported this.

You may be able to make progress by using lld. I don't know; I've
never tried it myself.

Ian

Khanh TN

unread,
Mar 15, 2021, 8:09:59 PM3/15/21
to golang-nuts
Hi Ian,
This problem is somewhat resolved for me now. Gollvm works perfectly in my fresh installed Debian.
Maybe Go and Gollvm has some conflicts in my previous build or Ubuntu got some problem.
Thanks a lot for your help.

Khanh

hohoho syncxxx

unread,
Apr 25, 2022, 1:17:21 AM4/25/22
to golang-nuts
Hi, I meet that error in ubuntu too.  And here is my env:
LLVM: 2c5590adfe09

gollvm: f17ba8c7708356ef447525e05cd6f2770845c7d7

gofrontend: e3bfc0889237a5bb8aa7ae30e1cff14f90a5f941

libffi: 0f2dd369cd5edcefad29b3fca4e1d08cb34f8f19

libbacktrace: d0f5e95a87a4d3e0a1ed6c069b5dae7cbab3ed2a


When I compile the code:
package main

import (
         "fmt"
         "golang.org/x/sys/unix"
)
 
func main() {
   fmt.Println("Hello, World!")
   fmt.Println(unix.Getpagesize())
}


It report another error:

no required module provides package golang.org/x/sys/unix: go.mod file not found in current directory or any parent directory; see 'go help modules'

Ian Lance Taylor

unread,
Apr 25, 2022, 1:26:24 AM4/25/22
to hohoho syncxxx, golang-nuts
On Sun, Apr 24, 2022 at 10:17 PM hohoho syncxxx
<just1ce...@gmail.com> wrote:
>
> Hi, I meet that error in ubuntu too. And here is my env:
> LLVM: 2c5590adfe09
>
> gollvm: f17ba8c7708356ef447525e05cd6f2770845c7d7
>
> gofrontend: e3bfc0889237a5bb8aa7ae30e1cff14f90a5f941
>
> libffi: 0f2dd369cd5edcefad29b3fca4e1d08cb34f8f19
>
> libbacktrace: d0f5e95a87a4d3e0a1ed6c069b5dae7cbab3ed2a
>
> When I compile the code:
> package main
>
> import (
> "fmt"
> "golang.org/x/sys/unix"
> )
>
> func main() {
> fmt.Println("Hello, World!")
> fmt.Println(unix.Getpagesize())
> }
>
>
> It report another error:
>
> no required module provides package golang.org/x/sys/unix: go.mod file not found in current directory or any parent directory; see 'go help modules'

If you haven't already, please run "go help modules".

The short version is that you need to create a go.mod file (you can do
this using "go mod init") and then run "go get golang.org/x/sys/unix".

Ian

hiter adole

unread,
Jul 17, 2022, 10:59:14 AM7/17/22
to golang-nuts
Hi khanh:

I met that problem too, and I thought I somehow fix it. I located the source code and found that when caller function is compiled with "fsplit-stack" and callee function is compiled with "fno-split-stack", the address of caller functions has to be relocated. However it remains me that as a normal user, we are unable to change the code of go library, therefore I tried to compile the go project with "sudo", everything works.

yours
Zhou Qingyang
在2021年3月16日星期二 UTC+8 08:09:59<tnkh...@gmail.com> 写道:

hiter adole

unread,
Jul 18, 2022, 8:50:14 AM7/18/22
to golang-nuts
Sorry for confusing, but I got something wrong: gollvm still does not work under root. It seems problems related with split-stack, but I do not know how to fix it yet.
Reply all
Reply to author
Forward
0 new messages