commands I executed are as follows. ```bash go build -x . 2> auto.sh # get the building process rm easyPkg # remove the binary file go clean -cache # clean the cache for rebuilding source auto.sh # rebuild ```
the llvm-project is built by following instructions in section "On Unix-like Systems > Build LLVM and Clang:" in https://clang.llvm.org/get_started.html and replace "Unix Makefiles" with "Ninja" and "make" with "ninja" LLVM version is 15.0.0 gollvm version is ``` go version go1.18 gollvm LLVM 15.0.0git 20220823 (experimental) linux/amd64 ``` 在2022年10月28日星期五 UTC+8 00:55:03<Ian Lance Taylor> 写道: > On Thu, Oct 27, 2022 at 9:11 AM 'Than McIntosh' via golang-nuts > <golan...@googlegroups.com> wrote: > > > > >/data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized > command line option '-fgo-importcfg=/dev/null' > > > > The Go command only passes this option to the compiler if it thinks that > the compiler is the main go compiler ("gc") as opposed to gollvm. What > output do you get when you run "go version" ? > > The code is testing whether the compiler supports that option. The > errors about -fgo-importcfg and -ffile-prefix-map can be ignored. > > Not sure what is happening elsewhere, though. You showed the output > but not the commands. > > Ian > > > > > On Thu, Oct 27, 2022 at 12:05 PM 'Qingwei Li' via golang-nuts < > golan...@googlegroups.com> wrote: > >> > >> the GoLLVM is based on LLVM 15.0.0 > >> > >> Example to reproduce: > >> The structure of project is as follows: > >> > >> ``` > >> easyPkg/ > >> ├── go.mod > >> ├── main.go > >> └── Pkg > >> └── utils.go > >> ``` > >> > >> main.go > >> > >> ``` > >> package main > >> > >> import "easyPkg/Pkg" > >> > >> func main() { > >> Pkg.PkgFunc() > >> } > >> ``` > >> > >> utils.go > >> > >> ``` > >> package Pkg > >> > >> func PkgFunc() { > >> println("pkgFunc") > >> } > >> ``` > >> > >> go.mod > >> > >> ``` > >> module easyPkg > >> > >> go 1.18 > >> ``` > >> > >> use `go build -x . 2> auto.sh` to get the building process. Then delete > the generated binary file `easyPkg` and use `go clean -cache` to clean the > building cache. Then I use the command `source auto.sh` to regenerate the > binary, which fails. > >> > >> part of the error log is as follows > >> > >> ``` > >> /data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized > command line option '-fgo-importcfg=/dev/null' > >> /data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized > command line option '-ffile-prefix-map=a=b' > >> ./main.go:3:19: error: > /tmp/go-build3415416681/b001/_importcfgroot_/easyPkg/libPkg.a exists but > does not contain any Go export data > >> ./main.go:3:19: warning: easyPkg/Pkg: Not a directory > >> ./main.go:3:19: error: import file 'easyPkg/Pkg' not found > >> ./main.go:6:2: error: reference to undefined name 'Pkg' > >> /usr/bin/ld.gold: error: /tmp/go-build3415416681/b001/_pkg_.a: member > at 72 is not an ELF object > >> /usr/bin/ld.gold: error: /tmp/go-build3415416681/b002/_pkg_.a: member > at 72 is not an ELF object > >> buildid: open /tmp/go-build3415416681/b001/exe/a.out: no such file or > directory > >> ``` > >> > >> what can I do on the auto.sh script to regenerate the binary file? Is > the process dumped completed? > >> > >> On a single package with no subdirectory, the result of `go build -x .` > is available for regenerating the binary file. > >> > >> Moreover, my main purpose is to add -emit-llvm option wherever > `llvm-goc` appears and use `llvm-link -S` to link all object files > generated by llvm-goc to get a whole LLVM IR file for the whole project. If > the question above is now insoluble, is there any other way to get the > whole project's LLVM IR? > >> > >> > >> -- > >> 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/b120de38-d603-4a8d-a029-34351abc051cn%40googlegroups.com > . > > > > -- > > 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/CA%2BUr55ENsDS_zpp0TCeyJDfh7jO%2B%3DQOcrfNs1zxqNBYjpPPvDw%40mail.gmail.com > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/193d828b-1f57-4cf9-a661-849127823d0dn%40googlegroups.com.