Unable to build gollvm: missing and no known rule to make it

326 views
Skip to first unread message

Pure White

unread,
Nov 21, 2021, 9:07:21 AM11/21/21
to golang-nuts
Hi,
I'm trying to build gollvm, but encountered some problems.
When executing `cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm`, there's some error log:screenshot-20211121-220213.pngscreenshot-20211121-220227.png

After this, I run `ninja gollvm` and get the following:
```
ninja: error: '/data00/home/purewhite/gollvm/llvm-project/llvm/tools/gollvm/gotools/buildid.go', needed by 'tools/gollvm/gotools/buildid', missing and no known rule to make it
```
The commits of related projects are below:
llvm-project: 3234f2d9c1669459833e717d34c10296d78b7818
gollvm: f17ba8c7708356ef447525e05cd6f2770845c7d7
gofrontend: 3e9f4ee16683883ccfb8661d99318c74bb7a4bef
They are all the latest commits(at this time).

Does anyone know how to deal with this? Or can anyone reproduce this error?

Than McIntosh

unread,
Nov 22, 2021, 11:02:38 AM11/22/21
to Pure White, golang-nuts
Hi,

I sometimes see that error when doing an incremental build of libgo after something has changed in the go frontend repo. I suggest that in your build directory you remove the libgo dir (e.g. from build area root "rm -rf  tools/gollvm/libgo"), rerun cmake, and then try again.

I did a test build just now with tip:

LLVM: 56db1c072c92be36fb1d76aa30487ad62dc58ea8
gollvm: 263e415e02543b9d46d19b5076454ae6c07860fe
gofrontend: 3e9f4ee16683883ccfb8661d99318c74bb7a4bef

and it seems to work ok.

Thanks, Than

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0959a8a9-358f-4e46-b7d0-c5015bbd81c2n%40googlegroups.com.

Pure White

unread,
Nov 22, 2021, 11:41:51 AM11/22/21
to golang-nuts
Hi,
the `libgo` under gollvm seems is a part of gollvm, and after I delete it there's another error:
```
$ cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm
-- Native target architecture is X86
-- Threads enabled.
...
-- Targeting XCore
-- default linker set to "gold"
CMake Error at tools/gollvm/CMakeLists.txt:131 (add_subdirectory):
  add_subdirectory given source "libgo" which is not an existing directory.


-- starting gotools configuration.
CMake Error at tools/gollvm/gotools/CMakeLists.txt:40 (mkzdefaultcc):
  Unknown CMake command "mkzdefaultcc".


-- Configuring incomplete, errors occurred!
See also "/data00/home/purewhite/gollvm/build-debug/CMakeFiles/CMakeOutput.log".
See also "/data00/home/purewhite/gollvm/build-debug/CMakeFiles/CMakeError.log".
```

Than McIntosh

unread,
Nov 22, 2021, 11:54:06 AM11/22/21
to Pure White, golang-nuts
Hi,

Sorry for the misunderstanding--

When I said "from build area root" I am talking about the directory where you are running "ninja", not the directory that contains the source code for gollvm. Within your gollvm git repo, you will definitely still need the "libgo" subdir.

So let's say that you have your LLVM repo checked out in

   /tmp/llvm-project

meaning that within this directory you would have

   /tmp/llvm-project/llvm/tools/gollvm
   /tmp/llvm-project/llvm/tools/gollvm/libgo
   /tmp/llvm-project/llvm/tools/gollvm/gofrontend
   ...

Then somewhere else you would have your build area, perhaps in /tmp/build. Within that build area you first run cmake, then run ninja e.g.

  cd /tmp/build
  cmake <various cmake options> -G Ninja ../llvm-project/llvm
  ninja ...

What I am suggesting is that from your build area (/tmp/build, NOT /tmp/llvm-project) you issue the command

  rm -rf tools/gollvm/libgo

Thanks, Than


Pure White

unread,
Nov 22, 2021, 9:23:52 PM11/22/21
to golang-nuts
Thanks for your reply and sorry for my misunderstanding!
I've tried but the problem still exists.
My directory layout is:
```
/data00/home/purewhite/gollvm (the `workarea`)
/data00/home/purewhite/gollvm/build-debug
/data00/home/purewhite/gollvm/llvm-project
/data00/home/purewhite/gollvm/llvm-project/llvm/tools/...
```
Which is totally consistent with the README of gollvm.

The error logs are still something like:
```
...
/data00/home/purewhite/gollvm/llvm-project/llvm/tools/gollvm/gofrontend/libgo/match.sh:143: no such file or directory:  common.go format.go reader.go stat_actime1.go stat_actime2.go stat_unix.go strconv.go writer.go
/data00/home/purewhite/gollvm/llvm-project/llvm/tools/gollvm/gofrontend/libgo/match.sh:143: no such file or directory:  reader.go register.go struct.go writer.go
/data00/home/purewhite/gollvm/llvm-project/llvm/tools/gollvm/gofrontend/libgo/match.sh:143: no such file or directory:  bufio.go scan.go
/data00/home/purewhite/gollvm/llvm-project/llvm/tools/gollvm/gofrontend/libgo/match.sh:143: no such file or directory:  buffer.go bytes.go reader.go
...
```

I think there may be some problems with the `match.sh` script, I will dive into it later.

Pure White

unread,
Nov 23, 2021, 12:24:43 AM11/23/21
to golang-nuts
Hi,
    I've found the problems. That's because I'm using zsh instead of bash.
    After I switched to bash, everything works fine.
    Maybe there's some behaviour difference between zsh and bash, but I'm not familiar with the shells, thus not able to fix them.
    I've submitted a CL for this: https://go-review.googlesource.com/c/gollvm/+/366097
Reply all
Reply to author
Forward
0 new messages