Hi Than,
It turned out to be the problem of shell. By SHELL=/bin/sh I can build 
gollvm in the right way, but I still failed on a compile error:

[2066/3237] Building CXX object tools/gollvm/bridge/CMakeFiles/
LLVMCppGoFrontEnd.dir/__/gofrontend/go/go.cc.o
FAILED: tools/gollvm/bridge/CMakeFiles/LLVMCppGoFrontEnd.dir/__/gofrontend/
go/go.cc.o 
/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/gollvm/bridge -I/home/
yt/LLVMsvn/llvm/tools/gollvm/bridge -I/usr/include/libxml2 -Iinclude -I/home
/yt/LLVMsvn/llvm/include -Itools/gollvm/external/install/include -I/home/yt/
LLVMsvn/llvm/tools/gollvm/gofrontend/go -fPIC -fvisibility-inlines-hidden -
Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
-Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -
Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-
non-virtual-dtor -Wno-comment -fdiagnostics-color -g    -fno-exceptions -fno
-rtti -MD -MT tools/gollvm/bridge/CMakeFiles/LLVMCppGoFrontEnd.dir/__/
gofrontend/go/go.cc.o -MF tools/gollvm/bridge/CMakeFiles/LLVMCppGoFrontEnd.
dir/__/gofrontend/go/go.cc.o.d -o tools/gollvm/bridge/CMakeFiles/
LLVMCppGoFrontEnd.dir/__/gofrontend/go/go.cc.o -c /home/yt/LLVMsvn/llvm/
tools/gollvm/gofrontend/go/go.cc
/home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/go/go.cc: In function ‘void 
go_create_gogo(const go_create_gogo_args*)’:
/home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/go/go.cc:47:13: error: ‘const 
struct go_create_gogo_args’ has no member named ‘debug_optimization’
  if (args->debug_optimization)
            ^~~~~~~~~~~~~~~~~~
/home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/go/go.cc:48:42: error: ‘const 
struct go_create_gogo_args’ has no member named ‘debug_optimization’
    ::gogo->set_debug_optimization(args->debug_optimization);
                                         ^~~~~~~~~~~~~~~~~~
[2069/3237] Building CXX object tools/gollvm/bridge/CMakeFiles/
LLVMCppGoFrontEnd.dir/__/gofrontend/go/gogo.cc.o
ninja: build stopped: subcommand failed.


I checked the structure go_create_gogo_args (in gollvm/bridge/go-c.h) and 
there really wasn't a field called debug_optimization there. Could I add 
this field in go_create_gogo_args so I can let the build progress continue?

Thanks.

On Thursday, May 9, 2019 at 12:21:42 AM UTC+8, Than McIntosh wrote:
>
> Agree, the embedded space looks fishy.
>
> I also note that your shell is set to zsh -- you might try instead using 
> SHELL=/bin/sh to see if that works better.
>
> Thanks, Than
>
>
>
>
> On Wed, May 8, 2019 at 12:04 PM Ting Yuan <yuan...@ict.ac.cn <javascript:>> 
> wrote:
>
>> OK, I got something like
>> ...
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(55):  if(NOT 
>> EXISTS /home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid )
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(57):  else()
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(58):  
>> set(tool_target gotools_cmd_buildid )
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(62):  
>> execute_process(COMMAND /usr/bin/zsh 
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/libgo/match.sh --goarch=amd64 
>> --goos=linux 
>> --srcdir=/home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid 
>> OUTPUT_VARIABLE toolfiles ERROR_VARIABLE errmsg RESULT_VARIABLE exitstatus )
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(68):  if(NOT 0 
>> MATCHES 0 )
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(71):  
>> string(STRIP  
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid/ 
>> buildid.go doc.go
>>  toolfiles )
>> /home/yt/LLVMsvn/llvm/tools/gollvm/gotools/CMakeLists.txt(72):  
>> separate_arguments(toolfiles )
>> ...
>>
>> I found that the absolute path of buildid.go is illegal (there is a space 
>> before the filename). This looks like the root cause.
>>
>> On Wednesday, May 8, 2019 at 11:46:09 PM UTC+8, Than McIntosh wrote:
>>>
>>> Hmm, OK, sounds like 'sed' is not the issue.
>>>
>>> >>I found there are only two files (CMakeLists.txt and gotestprogram.sh) 
>>> under the llvm/tools/gollvm/gotools/. Should the missing files (e.g. 
>>> buildid.go) be there?
>>>
>>> No, this is expected. The Go sources for 'buildid' will be pulled from 
>>> <LLVMROOT>/tools/gollvm/gofrontend/libgo/go/cmd/buildid.
>>>
>>> At this point what I would recommend to gather more info: rerun cmake 
>>> and pass it the "--trace-expand" flag, e.g.
>>>
>>> cmake --trace-expand -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold 
>>> ../llvm
>>>
>>> Be warned that this will produce a huge amount of output (~40M or so). 
>>> Sift through the output and see if you can find the place where it is 
>>> trying to locate the source files for the buildid tool by running 
>>> 'match.sh'. Should look something like
>>>
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(55):  if(NOT EXISTS 
>>> /root/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid )
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(57):  else()
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(58):  set(tool_target 
>>> gotools_cmd_buildid )
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(62):  
>>> execute_process(COMMAND /bin/bash 
>>> /root/llvm/tools/gollvm/gofrontend/libgo/match.sh --goarch=amd64 
>>> --goos=linux 
>>> --srcdir=/root/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid 
>>> OUTPUT_VARIABLE toolfiles ERROR_VARIABLE errmsg RESULT_VARIABLE exitstatus )
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(68):  if(NOT 0 MATCHES 0 )
>>> /root/llvm/tools/gollvm/gotools/CMakeLists.txt(71):  string(STRIP 
>>> /root/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid/buildid.go 
>>> /root/llvm/tools/gollvm/gofrontend/libgo/go/cmd/buildid/doc.go
>>>  toolfiles )
>>>
>>> I am thinking that maybe there is something going wrong with the 
>>> invocation of 'match.sh' in your case that is throwing things off.
>>>
>>> Thanks, Than
>>>
>>>
>>>
>>> On Wed, May 8, 2019 at 11:30 AM Ting Yuan <yuan...@ict.ac.cn> wrote:
>>>
>>>> Hi Than,
>>>>
>>>> On my system the version of sed is 4.4. Is the version mismatch?
>>>>
>>>> I found there are only two files (CMakeLists.txt and gotestprogram.sh) 
>>>> under the llvm/tools/gollvm/gotools/. Should the missing files (e.g. 
>>>> buildid.go) be there?
>>>>
>>>> Thanks.
>>>>
>>>> On Wednesday, May 8, 2019 at 8:50:23 PM UTC+8, Than McIntosh wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> From the error output it sounds like something went wrong with the 
>>>>> initial cmake run -- the error from match.sh seems nonsensical (it 
>>>>> suggests 
>>>>> that the script is looking for gotools sources in the wrong location).
>>>>>
>>>>> One possibility would be that you don't have "sed" installed on your 
>>>>> system?
>>>>>
>>>>> Thanks, Than
>>>>>
>>>>>
>>>>> On Tue, May 7, 2019 at 9:56 PM Ting Yuan <yuan...@ict.ac.cn> wrote:
>>>>>
>>>>>> Hello Than,
>>>>>> when I using ninja to build gollvm, just like
>>>>>>
>>>>>> % cmake -DCMAKE_INSTALL_PREFIX=/home/yt/LLVMsvn/install -
>>>>>> DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER
>>>>>> =gold -G "Ninja" ../llvm
>>>>>> % ninja gollvm
>>>>>>
>>>>>> the build system still reports an error:
>>>>>>
>>>>>> ninja: error: 
>>>>>> '/home/yt/LLVMsvn/llvm-project/llvm/tools/gollvm/gotools/buildid.go', 
>>>>>> needed by 'tools/gollvm/gotools/buildid', missing and no known rule 
>>>>>> to make it
>>>>>>
>>>>>> I notice that some warnings are raised during the configuration like:
>>>>>>
>>>>>> /home/yt/LLVMsvn/llvm-project/llvm/tools/gollvm/gofrontend/libgo/match.sh:138:
>>>>>>  
>>>>>> no such file or directory:  action.go build.go buildid.go exec.go gc.go 
>>>>>> gccgo.go init.go security.go testgo.go
>>>>>>
>>>>>> Is there something I missing ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> 在 2019年5月7日星期二 UTC+8下午9:48:48,Than McIntosh写道:
>>>>>>>
>>>>>>> Hello,
>>>>>>> For the gollvm build ninja is recommended (using "make" is untested 
>>>>>>> and I doubt if it will work).
>>>>>>> Thanks, Than
>>>>>>>
>>>>>>>
>>>>>>> On Tue, May 7, 2019 at 9:27 AM <yuan...@ict.ac.cn> wrote:
>>>>>>>
>>>>>>>> I try to build gollvm on ubuntu(x64) following these commands in 
>>>>>>>> https://go.googlesource.com/gollvm/ :
>>>>>>>>
>>>>>>>> % cd workarea
>>>>>>>> % mkdir build-debug
>>>>>>>> % cd build-debug
>>>>>>>> % cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold ../llvm
>>>>>>>> ...
>>>>>>>> % make gollvm -j4
>>>>>>>> ...
>>>>>>>> %
>>>>>>>>
>>>>>>>> but I got
>>>>>>>>
>>>>>>>> -- Targeting X86
>>>>>>>> -- starting libgo configuration.
>>>>>>>> /home/yt/LLVMsvn/llvm-project/llvm/tools/gollvm/gofrontend/libgo/
>>>>>>>> match.sh:138: no such file or directory:  common.go format.go 
>>>>>>>> reader.go stat_actime1.go stat_actime2.go stat_unix.go strconv.go 
>>>>>>>> writer.go
>>>>>>>> /home/yt/LLVMsvn/llvm-project/llvm/tools/gollvm/gofrontend/libgo/
>>>>>>>> match.sh:138: no such file or directory:  reader.go register.go 
>>>>>>>> struct.go writer.go
>>>>>>>> ......
>>>>>>>> -- Performing Test HAVE_STEADY_CLOCK -- success
>>>>>>>> -- Configuring done
>>>>>>>> -- Generating done
>>>>>>>> -- Build files have been written to: /home/yt/LLVMsvn/llvm-project/
>>>>>>>> debug
>>>>>>>> ...
>>>>>>>> [  0%] Built target LLVMDemangle
>>>>>>>> [  0%] Built target GoDumpSpecMacroParser
>>>>>>>> ...
>>>>>>>> [ 50%] Building Go package 'runtime' (non-PIC)
>>>>>>>> /home/yt/LLVMsvn/llvm-project/debug/tools/gollvm/libgo/sigtab.go:5:
>>>>>>>> 21: error: use of undefined type 'sigTabT'
>>>>>>>> /home/yt/LLVMsvn/llvm-project/debug/tools/gollvm/libgo/sigtab.go:7:
>>>>>>>> 12: error: reference to undefined name '_SigNotify'
>>>>>>>> /home/yt/LLVMsvn/llvm-project/debug/tools/gollvm/libgo/sigtab.go:7:
>>>>>>>> 25: error: reference to undefined name '_SigKill'
>>>>>>>> /home/yt/LLVMsvn/llvm-project/debug/tools/gollvm/libgo/sigtab.go:8:
>>>>>>>> 12: error: reference to undefined name '_SigNotify'
>>>>>>>> ...
>>>>>>>> tools/gollvm/libgo/CMakeFiles/libgo_runtime.dir/build.make:64: 
>>>>>>>> recipe for target 'tools/gollvm/libgo/runtime.o' failed
>>>>>>>> make[3]: *** [tools/gollvm/libgo/runtime.o] Error 3
>>>>>>>> CMakeFiles/Makefile2:16487: recipe for target 
>>>>>>>> 'tools/gollvm/libgo/CMakeFiles/libgo_runtime.dir/all' failed
>>>>>>>> make[2]: *** [tools/gollvm/libgo/CMakeFiles/libgo_runtime.dir/all] 
>>>>>>>> Error 2
>>>>>>>> CMakeFiles/Makefile2:11625: recipe for target 
>>>>>>>> 'tools/gollvm/CMakeFiles/gollvm.dir/rule' failed
>>>>>>>> make[1]: *** [tools/gollvm/CMakeFiles/gollvm.dir/rule] Error 2
>>>>>>>> Makefile:3475: recipe for target 'gollvm' failed
>>>>>>>> make: *** [gollvm] Error 2
>>>>>>>>
>>>>>>>> I have no idea about this problem. Should I switch make to ninja 
>>>>>>>> (like the document said)?
>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> 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 golan...@googlegroups.com.
>>>>>>>> To view this discussion on the web visit 
>>>>>>>> https://groups.google.com/d/msgid/golang-nuts/4529d46b-caf4-475f-bcda-273c1bca5016%40googlegroups.com
>>>>>>>>  
>>>>>>>> <https://groups.google.com/d/msgid/golang-nuts/4529d46b-caf4-475f-bcda-273c1bca5016%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>> -- 
>>>>>> 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 golan...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/golang-nuts/ed517fe7-e180-4d0b-b134-f8ee76427ebf%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/golang-nuts/ed517fe7-e180-4d0b-b134-f8ee76427ebf%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> -- 
>>>> 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 golan...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/golang-nuts/92cbfe57-f1fb-467d-b935-394a842f597e%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/golang-nuts/92cbfe57-f1fb-467d-b935-394a842f597e%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> 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 golan...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/df20fae4-d96d-4c50-a531-01d95ebf83d2%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/df20fae4-d96d-4c50-a531-01d95ebf83d2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/369e31c6-2a6e-45b0-a7dc-400ec4b32ea2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to