Sorry, I wasn't clear on that last email. What I'm asking is if you could rerun the compilation by hand, e.g.
$ cat > /tmp/CheckSymbolExists.c << EOF #include <sys/mman.h> int main(int argc, char** argv) { (void)argv; #ifndef mmap return ((int*)(&mmap))[argc]; #else (void)argc; return 0; #endif } EOF $ /usr/bin/cc -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fuse-ld=gold -fsplit-stack -fuse-ld=gold -Wl,-allow-shlib-undefined /tmp/CheckSymbolExists.c -c -o /tmp/CheckSymbolExists.o $ /usr/bin/cc -v -fPIC -fuse-ld=gold -fsplit-stack -fuse-ld=gold -Wl,-allow-shlib-undefined -Wl,--debug,all /tmp/CheckSymbolExists.o -o /tmp/a.out -lm $ I am hoping that might give me a little more info. Thanks, Than On Fri, May 1, 2020 at 9:41 AM Martins Eglitis <mart...@sitilge.id.lv> wrote: > Sure, I have attached the CMakeOutput.log and CMakeError.log > On 2020-05-01 16:19, Than McIntosh wrote: > > > A little more detail on the error in question. This is a very obscure > error, so please bear with me. > > >>/usr/bin/ld.gold: error: > CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o: failed to match > split-stack sequence at section 4 offset 0 > > What's happening here is that the linker (ld.gold) is linking together two > object files, let's call them "a.o" and "b.o". > > The linker detects that one of the objects (let's say "a.o") has a marker > indicating that it was compiled with the "-fsplit-stack" option. The second > object file "b.o" has no such marker (e.g. it apparently wasn't compiled > with -fsplit-stack). > > In addition, the linker sees (from object file relocations) that a > function (let's call it AFunc) in a.o is making a call to BFunc in b.o. In > such instances the gold linker has a feature that will perform a > fixup/rewrite on the calling function to make sure that when the call takes > place, the stack is large enough (so that -split-stack will have the right > effect). > > To apply this fixup, the linker is looking for a specific prolog > instruction sequence-- when it doesn't find that sequence, it issues the > error. > > In the previous LLVM bug I cited, the problem was with the C compiler -- > it was marking the object as split-stack, but not consistently emitting the > prolog sequence that the linker looks for. > > Your compiler is an up-to-date version of GCC, however, so it's hard for > me to believe that the compiler is at fault. > > [This is a lot of technical detail, sorry about that]. > > Do you think you could rerun the compile by hand and send me some of the > output (e.g. regenerate the file "CheckSymbolExists.c" as it appeared in > the cmake output log? > > Thanks, Than > > On Thu, Apr 30, 2020 at 4:39 PM Martins Eglitis <mart...@sitilge.id.lv> > wrote: > >> Sorry, I should have mentioned that I am running a docker container based >> on the latest Ubuntu, and Ubuntu 18.04 as the host. >> >> On April 30, 2020 11:37:15 PM GMT+03:00, Martins Eglitis < >> mart...@sitilge.id.lv> wrote: >>> >>> Yes, >>> >>> cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 >>> >>> >>> On April 30, 2020 11:29:07 PM GMT+03:00, Than McIntosh <th...@google.com> >>> wrote: >>>> >>>> >>/usr/bin/ld.gold: error: CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o: >>>> failed to match split-stack sequence at section 4 offset 0 >>>> >>>> OK, now I think we're getting somewhere, this looks suspicious. For >>>> reference, could you please send me the output of "/usr/bin/cc --version"? >>>> >>>> Thanks, Than >>>> >>>> >>>> >>>> >>>> On Thu, Apr 30, 2020 at 4:26 PM Martins Eglitis <mart...@sitilge.id.lv> >>>> wrote: >>>> >>>>> Hi, >>>>> >>>>> There was something related in "CMakeError.log": >>>>> >>>>> Determining if the mmap exist failed with the following output: >>>>> Change Dir: /home/gopher/workarea/build-debug/CMakeFiles/CMakeTmp >>>>> >>>>> Run Build Command(s):/usr/bin/ninja cmTC_81c99 && [1/2] Building C object >>>>> CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o >>>>> CheckSymbolExists.c: In function 'main': >>>>> CheckSymbolExists.c:8:11: warning: ISO C forbids conversion of function >>>>> pointer to object pointer type [-Wpedantic] >>>>> 8 | return ((int*)(&mmap))[argc]; >>>>> | ^ >>>>> [2/2] Linking C executable cmTC_81c99 >>>>> FAILED: cmTC_81c99 >>>>> : && /usr/bin/cc -fPIC -Werror=date-time -Wall -Wextra >>>>> -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers >>>>> -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-comment >>>>> -fdiagnostics-color -ffunction-sections -fdata-sections -fuse-ld=gold >>>>> -fsplit-stack -fuse-ld=gold -Wl,-allow-shlib-undefined >>>>> CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o -o cmTC_81c99 -lm && : >>>>> /usr/bin/ld.gold: error: CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o: >>>>> failed to match split-stack sequence at section 4 offset 0 >>>>> collect2: error: ld returned 1 exit status >>>>> ninja: build stopped: subcommand failed. >>>>> >>>>> >>>>> File >>>>> /home/gopher/workarea/build-debug/CMakeFiles/CMakeTmp/CheckSymbolExists.c: >>>>> /* */ >>>>> #include <sys/mman.h> >>>>> >>>>> int main(int argc, char** argv) >>>>> { >>>>> (void)argv; >>>>> #ifndef mmap >>>>> return ((int*)(&mmap))[argc]; >>>>> #else >>>>> (void)argc; >>>>> return 0; >>>>> #endif >>>>> } >>>>> >>>>> On 2020-04-30 20:32, Than McIntosh wrote: >>>>> >>>>> Thanks for the email. >>>>> >>>>> Sorry for the delay in responding, this is a very busy time right now >>>>> for our team (release freeze is happening at the end of this week). >>>>> >>>>> Just in general, the gollvm build procedure uses "cmake", and as part >>>>> of this process cmake is running various tests to make sure that the C >>>>> compiler you're using works properly, and to detect whether the system you >>>>> are building on has the right header files, libraries, etc. >>>>> >>>>> Of particular concern is the cmake check for "mmap"-- the mmap() >>>>> routine is definitely available on Ubuntu, so it's puzzling that cmake >>>>> thinks it isn't available. >>>>> >>>>> One thing you might do: after the build fails, try looking at the >>>>> debris in the CMakeFiles dir: >>>>> >>>>> $ ls CMakeFiles >>>>> 3.13.4 cmake.check_cache feature_tests.bin src.c >>>>> 3.15.4 CMakeError.log feature_tests.c >>>>> TargetDirectories.txt >>>>> CheckIncludeFiles CMakeOutput.log feature_tests.cxx test.o >>>>> CheckTypeSize CMakeTmp simple.cc >>>>> >>>>> In that dir, look at "CMakeOutput.log" for the place where this test >>>>> is run: >>>>> >>>>> Look for a section that looks like this: >>>>> >>>>> Determining if the mmap exist passed with the following output: >>>>> Change Dir: /tmp/llvm-project/build-relwithdbg/CMakeFiles/CMakeTmp >>>>> >>>>> Run Build Command:"/usr/local/google/home/thanm/bin/ninja" >>>>> "cmTC_feb45" >>>>> [1/2] Building C object >>>>> CMakeFiles/cmTC_feb45.dir/CheckSymbolExists.c.o >>>>> CheckSymbolExists.c: In function ‘main’: >>>>> CheckSymbolExists.c:8:11: warning: ISO C forbids conversion of >>>>> function pointer to object pointer type [-Wpedantic] >>>>> return ((int*)(&mmap))[argc]; >>>>> ^ >>>>> [2/2] Linking C executable cmTC_feb45 >>>>> >>>>> File >>>>> /tmp/llvm-project/build-relwithdbg/CMakeFiles/CMakeTmp/CheckSymbolExists.c: >>>>> /* */ >>>>> #include <sys/mman.h> >>>>> >>>>> int main(int argc, char** argv) >>>>> { >>>>> (void)argv; >>>>> #ifndef mmap >>>>> return ((int*)(&mmap))[argc]; >>>>> #else >>>>> (void)argc; >>>>> return 0; >>>>> #endif >>>>> } >>>>> >>>>> Are there any clues there perhaps? >>>>> >>>>> Thanks, Than >>>>> >>>>> >>>>> On Thu, Apr 30, 2020 at 1:05 PM <siti...@gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I initially opened an issue, but was suggested to post to the mailing >>>>>> list instead: https://github.com/golang/go/issues/38728 >>>>>> >>>>>> Build keeps failing when trying to build (Ubuntu Focal Fossa, amd64) >>>>>> from the latest commit to the master and following the build >>>>>> instructions. >>>>>> Has anyone succeeded to build gollvm recently? I am getting errors like >>>>>> this: >>>>>> >>>>>> -- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) >>>>>> -- Native target architecture is X86 >>>>>> -- Threads enabled. >>>>>> -- Doxygen disabled. >>>>>> -- Go bindings disabled. >>>>>> -- Ninja version: 1.10.0 >>>>>> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION >>>>>> OCAML_STDLIB_PATH) >>>>>> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION >>>>>> OCAML_STDLIB_PATH) >>>>>> -- OCaml bindings disabled. >>>>>> -- LLVM host triple: x86_64-unknown-linux-gnu >>>>>> -- LLVM default target triple: x86_64-unknown-linux-gnu >>>>>> -- Building with -fPIC >>>>>> -- Constructing LLVMBuild project information >>>>>> -- Targeting AArch64 >>>>>> -- Targeting AMDGPU >>>>>> -- Targeting ARM >>>>>> -- Targeting AVR >>>>>> -- Targeting BPF >>>>>> -- Targeting Hexagon >>>>>> -- Targeting Lanai >>>>>> -- Targeting Mips >>>>>> -- Targeting MSP430 >>>>>> -- Targeting NVPTX >>>>>> -- Targeting PowerPC >>>>>> -- Targeting RISCV >>>>>> -- Targeting Sparc >>>>>> -- Targeting SystemZ >>>>>> -- Targeting WebAssembly >>>>>> -- Targeting X86 >>>>>> -- Targeting XCore >>>>>> CMake Error at tools/gollvm/cmake/modules/AddGollvm.cmake:37 (message): >>>>>> C compiler does not support -fsplit-stack >>>>>> Call Stack (most recent call first): >>>>>> tools/gollvm/CMakeLists.txt:21 (include) >>>>>> >>>>>> >>>>>> -- starting libgo configuration. >>>>>> CMake Error at tools/gollvm/cmake/modules/LibbacktraceUtils.cmake:19 >>>>>> (message): >>>>>> Support for mmap() is required -- setup failed. >>>>>> Call Stack (most recent call first): >>>>>> tools/gollvm/libgo/CMakeLists.txt:45 (setup_libbacktrace) >>>>>> >>>>>> >>>>>> CMake Error at tools/gollvm/cmake/modules/LibffiUtils.cmake:27 (message): >>>>>> Support for mmap() is required -- setup failed. >>>>>> Call Stack (most recent call first): >>>>>> tools/gollvm/libgo/CMakeLists.txt:49 (setup_libffi) >>>>>> >>>>>> >>>>>> -- Libgo: creating stdlib package targets >>>>>> -- Libgo: generating check targets >>>>>> -- libgo configuration complete. >>>>>> -- starting gotools configuration. >>>>>> -- gotools: generating check targets >>>>>> -- gotools configuration complete. >>>>>> -- Registering Bye as a pass plugin (static build: OFF) >>>>>> -- Failed to find LLVM FileCheck >>>>>> -- Version: 0.0.0 >>>>>> -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile >>>>>> -- Performing Test HAVE_POSIX_REGEX -- success >>>>>> -- Performing Test HAVE_STEADY_CLOCK -- success >>>>>> -- Configuring incomplete, errors occurred! >>>>>> See also "/home/gopher/workarea/build-debug/CMakeFiles/CMakeOutput.log". >>>>>> See also "/home/gopher/workarea/build-debug/CMakeFiles/CMakeError.log". >>>>>> ninja: error: loading 'build.ninja': No such file or directory >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> 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/cdb72cf2-2fe2-4f44-87fb-5cc2058dd58a%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/golang-nuts/cdb72cf2-2fe2-4f44-87fb-5cc2058dd58a%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>>> Best regards, >>>>> Martins Eglitis >>>>> >>>>> >> -- >> Sent from my Android device with K-9 Mail. Please excuse my brevity. >> > -- > Best regards, > Martins Eglitis > > -- 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/CA%2BUr55EQ9L-ZnjiPHJjpYTGYMjhWNZtibD-Db7NqBUPU9tCG%3DQ%40mail.gmail.com.