Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gollvm: build fails in combination with -fcf-protection=branch #38728

Closed
sitilge opened this issue Apr 28, 2020 · 32 comments
Closed

gollvm: build fails in combination with -fcf-protection=branch #38728

sitilge opened this issue Apr 28, 2020 · 32 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@sitilge
Copy link

sitilge commented Apr 28, 2020

Does this issue reproduce with the latest release?

Yes (with latest commit to master).

What operating system and processor architecture are you using (go env)?

Ubuntu Focal Fossa, amd64

What did you do?

I followed the instructions on the gollvm landing page.

What did you expect to see?

The project builds cleanly.

What did you see instead?

I got this output

-- 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

The output of CMakeError.log is around 2.5k lines. Here is a snippet:

Determining if the include file malloc/malloc.h exists failed with the following output:
Change Dir: /home/gopher/workarea/build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_4ce15 && [1/2] Building C object CMakeFiles/cmTC_4ce15.dir/CheckIncludeFile.c.o
FAILED: CMakeFiles/cmTC_4ce15.dir/CheckIncludeFile.c.o 
/usr/bin/cc    -o CMakeFiles/cmTC_4ce15.dir/CheckIncludeFile.c.o   -c CheckIncludeFile.c
CheckIncludeFile.c:1:10: fatal error: malloc/malloc.h: No such file or directory
    1 | #include <malloc/malloc.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

Determining if the include file valgrind/valgrind.h exists failed with the following output:
Change Dir: /home/gopher/workarea/build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_d0b71 && [1/2] Building C object CMakeFiles/cmTC_d0b71.dir/CheckIncludeFile.c.o
FAILED: CMakeFiles/cmTC_d0b71.dir/CheckIncludeFile.c.o 
/usr/bin/cc    -o CMakeFiles/cmTC_d0b71.dir/CheckIncludeFile.c.o   -c CheckIncludeFile.c
CheckIncludeFile.c:1:10: fatal error: valgrind/valgrind.h: No such file or directory
    1 | #include <valgrind/valgrind.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

Has anyone managed to build gollvm? Or have a Docker image? The Docker images publicly available are somewhat old and also gave me bugs.

@ALTree
Copy link
Member

ALTree commented Apr 28, 2020

Hi,

in theory the issue tracker is not for questions or support requests (just Go bugs), but this could be a bug in the makefiles I guess? So leaving open for investigation

cc @thanm @cherrymui

@ALTree ALTree changed the title gollvm : Can someone help me building it? gollvm: "cannot create directory 'workarea': File exists" when following build instructions Apr 28, 2020
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 28, 2020
@ALTree ALTree added this to the gollvm milestone Apr 28, 2020
@thanm
Copy link
Contributor

thanm commented Apr 28, 2020

As mentioned previously, this sort of question is better off sent to the go-nuts mailing list, as opposed creating an issue.

Looking at your cmake output, it seems likely that there is some issue with the C compiler you are using. What happens when you do this:

$ cat > /tmp/example.c <<EOF
#include <sys/mman.h>
int x;
EOF
$ cc -c -o /tmp/example.o /tmp/example.c
$

Does this succeed for you?

@sitilge
Copy link
Author

sitilge commented Apr 29, 2020

@thanm Yes, it succeeds.

cc (Ubuntu 9.3.0-10ubuntu2) 9.3.0

Edit: I accidentally submitted the wrong cc version before. The real version is 9.3.0. The script succeeds.

@sitilge sitilge changed the title gollvm: "cannot create directory 'workarea': File exists" when following build instructions gollvm: Build fails when following build instructions Apr 30, 2020
@thanm thanm self-assigned this May 4, 2020
@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label May 4, 2020
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 4, 2020
@thanm thanm changed the title gollvm: Build fails when following build instructions gollvm: build fails in combination with -fcf-protection=branch May 4, 2020
@thanm
Copy link
Contributor

thanm commented May 4, 2020

Update: with help of @sitilge , who ran some experiments on the build system, it was eventually determined that the system GCC is hard-wiring on the "-fcf-protection=branch" option (or equivalent). This results in function prologs that can't be recognized by ld.gold. Typical function prolog without -cf-protection=branch:

   0: 64 48 3b 24 25 70 00 cmp    %fs:0x70,%rsp
   7: 00 00
   9: 73 12                 jae    1d <main+0x1d>

and prolog with -cf-protection=branch:

   0:	f3 0f 1e fa          	endbr64 
   4:	64 48 3b 24 25 70 00 	cmp    %fs:0x70,%rsp
   b:	00 00 
   d:	73 16                	jae    25 <main+0x25>

The additional 'endbr64' is confusing gold's pattern match.

Next step is to file an upstream issue for the ld.gold problem. Will hold this issue open until I have more info.

@thanm
Copy link
Contributor

thanm commented May 4, 2020

Sent upstream binutils bug here.

@hdost
Copy link

hdost commented May 7, 2020

Does it mean that this issue should be closed?

@thanm
Copy link
Contributor

thanm commented May 7, 2020

@hdost not yet, I still have a couple of CLs to submit. Should be able to close it out in a day or two.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232740 mentions this issue: gollvm: remaster unit test expected outputs following LLVM align change

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232738 mentions this issue: gollvm: refactor unit testing hooks for expected results

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232497 mentions this issue: gollvm: sync with trunk

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232739 mentions this issue: gollvm: add a new mechanism for remastering unit tests

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232742 mentions this issue: gollvm: add workaround for hard-wired cf-protection=branch

@thanm
Copy link
Contributor

thanm commented May 8, 2020

Thanks again for submitting this bug. I've checked in a series of CLs that should address all of the problems-- things should build cleanly again now at tip for LLVM and gollvm.

@sitilge
Copy link
Author

sitilge commented May 8, 2020

@thanm No problem, that was the least I could do. Thank you for help!

@gchari-asapp
Copy link

gchari-asapp commented Jun 25, 2020

I still get the same error using the latest commit in ubuntu 20.04 x86_64 compiling with both gcc-9 and gcc-8

@thanm
Copy link
Contributor

thanm commented Jun 25, 2020

OK, I will reopen this bug and take another look-- perhaps I missed something the first time around.

@thanm thanm reopened this Jun 25, 2020
@thanm thanm added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Jun 29, 2020
@thanm
Copy link
Contributor

thanm commented Jun 29, 2020

I am still unable to reproduce this latest failure. When I test at tip using a compiler that hard-wires on -fcf-protection=branch I get a clean build.

For anyone still encountering this problem, please rerun your cmake command and look for the following in the trace output:

-- default linker set to "gold"
-- trying -fcf-protection=none workaround
-- applying -fcf-protection=none workaround
-- starting libgo configuration.

If you don't see this, please post what you are seeing from cmake. It would also help to know which specific commit you're picking up in the gollvm repo (e.g. "git log -1 --oneline"). Thanks.

@gchari-asapp
Copy link

I find those lines intertwined. I paste the whole output of cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm:

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Z3: Found unsuitable version "0.0.0", but required is at least "4.7.1" (found Z3_LIBRARIES-NOTFOUND)
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for link.h
-- Looking for link.h - found
-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/param.h
-- Looking for sys/param.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found
-- Looking for zlib.h
-- Looking for zlib.h - found
-- Looking for fenv.h
-- Looking for fenv.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found
-- Looking for histedit.h
-- Looking for histedit.h - not found
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for linux/magic.h
-- Looking for linux/magic.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_getspecific in pthread
-- Looking for pthread_getspecific in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for compress2 in z
-- Looking for compress2 in z - found
-- Looking for setupterm in terminfo
-- Looking for setupterm in terminfo - not found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
-- Looking for xar_open in xar
-- Looking for xar_open in xar - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for setrlimit
-- Looking for setrlimit - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for posix_fallocate
-- Looking for posix_fallocate - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for lseek64
-- Looking for lseek64 - found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - not found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - not found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Failed
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Performing Test HAVE_STD_IS_TRIVIALLY_COPYABLE
-- Performing Test HAVE_STD_IS_TRIVIALLY_COPYABLE - Success
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- 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.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Success
-- Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG
-- Performing Test CXX_SUPPORTS_REDUNDANT_MOVE_FLAG - Success
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Failed
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Found Python3: /usr/bin/python3.8 (found version "3.8.2") found components: Interpreter
-- Constructing LLVMBuild project information
-- Linker detection: GNU Gold
-- Found Git: /usr/bin/git (found version "2.25.1")
-- 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
-- Performing Test C_SUPPORTS_CF_PROTECTION_BRANCH
-- Performing Test C_SUPPORTS_CF_PROTECTION_BRANCH - Success
-- Performing Test SPLIT_STACK_FUNCTIONAL
-- Performing Test SPLIT_STACK_FUNCTIONAL - Failed
-- trying -fcf-protection=none workaround
-- Performing Test SPLIT_STACK_WORKAROUND
-- Performing Test SPLIT_STACK_WORKAROUND - Success
-- applying -fcf-protection=none workaround
-- starting libgo configuration.
-- Performing Test HAVE_ATOMIC_FUNCTIONS
-- Performing Test HAVE_ATOMIC_FUNCTIONS - Success
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for dl_iterate_phdr
-- Looking for dl_iterate_phdr - found
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for getexecname
-- Looking for getexecname - not found
-- Looking for lstat
-- Looking for lstat - found
-- Looking for readlink
-- Looking for readlink - found
-- Looking for mmap
-- Looking for mmap - found
-- Looking for accept4
-- Looking for accept4 - found
-- Looking for dup3
-- Looking for dup3 - found
-- Looking for epoll_create1
-- Looking for epoll_create1 - found
-- Looking for faccessat
-- Looking for faccessat - found
-- Looking for fallocate
-- Looking for fallocate - found
-- Looking for fchmodat
-- Looking for fchmodat - found
-- Looking for fchownat
-- Looking for fchownat - found
-- Looking for futimesat
-- Looking for futimesat - found
-- Looking for inotify_add_watch
-- Looking for inotify_add_watch - found
-- Looking for inotify_init
-- Looking for inotify_init - found
-- Looking for inotify_init1
-- Looking for inotify_init1 - found
-- Looking for inotify_rm_watch
-- Looking for inotify_rm_watch - found
-- Looking for listxattr
-- Looking for listxattr - found
-- Looking for mincore
-- Looking for mincore - found
-- Looking for mkdirat
-- Looking for mkdirat - found
-- Looking for openat
-- Looking for openat - found
-- Looking for removexattr
-- Looking for removexattr - found
-- Looking for renameat
-- Looking for renameat - found
-- Looking for setxattr
-- Looking for setxattr - found
-- Looking for splice
-- Looking for splice - found
-- Looking for sync_file_range
-- Looking for sync_file_range - found
-- Looking for syscall
-- Looking for syscall - found
-- Looking for tee
-- Looking for tee - found
-- Looking for unlinkat
-- Looking for unlinkat - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for unshare
-- Looking for unshare - found
-- Looking for utimensat
-- Looking for utimensat - found
-- Looking for wait4
-- Looking for wait4 - found
-- Looking for open64
-- Looking for open64 - found
-- Looking for mknodat
-- Looking for mknodat - found
-- Looking for pipe2
-- Looking for pipe2 - found
-- Looking for memmem
-- Looking for memmem - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for linux/ether.h
-- Looking for linux/ether.h - not found
-- Looking for linux/filter.h
-- Looking for linux/filter.h - found
-- Looking for linux/fs.h
-- Looking for linux/fs.h - found
-- Looking for linux/if_addr.h
-- Looking for linux/if_addr.h - found
-- Looking for linux/if_ether.h
-- Looking for linux/if_ether.h - found
-- Looking for linux/if_tun.h
-- Looking for linux/if_tun.h - found
-- Looking for linux/netlink.h
-- Looking for linux/netlink.h - found
-- Looking for linux/ptrace.h
-- Looking for linux/ptrace.h - found
-- Looking for linux/reboot.h
-- Looking for linux/reboot.h - found
-- Looking for linux/rtnetlink.h
-- Looking for linux/rtnetlink.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for net/if.h
-- Looking for net/if.h - found
-- Looking for net/if_arp.h
-- Looking for net/if_arp.h - found
-- Looking for net/route.h
-- Looking for net/route.h - found
-- Looking for netinet/icmp6.h
-- Looking for netinet/icmp6.h - found
-- Looking for netinet/if_ether.h
-- Looking for netinet/if_ether.h - found
-- Looking for netinet/in_systm.h
-- Looking for netinet/in_systm.h - found
-- Looking for netinet/ip.h
-- Looking for netinet/ip.h - found
-- Looking for netinet/ip_mroute.h
-- Looking for netinet/ip_mroute.h - not found
-- Looking for netpacket/packet.h
-- Looking for netpacket/packet.h - found
-- Looking for port.h
-- Looking for port.h - not found
-- Looking for sched.h
-- Looking for sched.h - found
-- Looking for semaphore.h
-- Looking for semaphore.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - found
-- Looking for sys/file.h
-- Looking for sys/file.h - found
-- Looking for sys/inotify.h
-- Looking for sys/inotify.h - found
-- Looking for sys/mount.h
-- Looking for sys/mount.h - found
-- Looking for sys/prctl.h
-- Looking for sys/prctl.h - found
-- Looking for sys/ptrace.h
-- Looking for sys/ptrace.h - found
-- Looking for sys/select.h
-- Looking for sys/select.h - found
-- Looking for sys/statfs.h
-- Looking for sys/statfs.h - found
-- Looking for sys/syscall.h
-- Looking for sys/syscall.h - found
-- Looking for sys/sysinfo.h
-- Looking for sys/sysinfo.h - found
-- Looking for sys/timex.h
-- Looking for sys/timex.h - found
-- Looking for sys/user.h
-- Looking for sys/user.h - found
-- Looking for sys/utsname.h
-- Looking for sys/utsname.h - found
-- Looking for sys/vfs.h
-- Looking for sys/vfs.h - found
-- Looking for syscall.h
-- Looking for syscall.h - found
-- Looking for utime.h
-- Looking for utime.h - found
-- Looking for compress in z
-- Looking for compress in z - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of double
-- Check size of double - done
-- Check size of long double
-- Check size of long double - done
-- Check size of long double
-- Check size of long double - done
-- Check size of void*
-- Check size of void* - done
-- Looking for alloca.h
-- Looking for alloca.h - found
-- Looking for alloca
-- Looking for alloca - not found
-- Looking for memcpy
-- Looking for memcpy - found
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4 - Success
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8 - Success
-- Performing Test HAVE_AS_X86_AES
-- Performing Test HAVE_AS_X86_AES - Success
-- Libgo: creating stdlib package targets
-- Libgo: generating check targets
-- libgo configuration complete.
-- starting gotools configuration.
-- Configuring incomplete, errors occurred!
See also "/root/workarea/llvm-project/CMakeFiles/CMakeOutput.log".
See also "/root/workarea/llvm-project/CMakeFiles/CMakeError.log".

Commit: de65b356dc2 (HEAD -> master, origin/master, origin/HEAD) [VectorCombine] add/use pass-level IRBuilder

@thanm
Copy link
Contributor

thanm commented Jun 29, 2020

You wrote:

Commit: de65b356dc2 (HEAD -> master, origin/master, origin/HEAD) [VectorCombine] add/use pass-level IRBuilder

That's the LLVM commit hash. I'm interested in the Gollvm hash, e.g.

cd <llvm_project_root>t/llvm/tools/gollvm
git log -1 --oneline

It should be at 2ded6bd. Thanks.

@gchari-asapp
Copy link

Absolutely. I'm sorry for that. Yes:
2ded6bd (HEAD -> master, origin/master, origin/HEAD) gollvm: rework handling of default linker

@thanm
Copy link
Contributor

thanm commented Jun 29, 2020

Thanks. Would it be possible to share the last couple of pages of the CMakeFiles/CMakeOutput.log file? Maybe that might given an indication as to why the cmake run is failing (since I don't see any red flags in the transcript you posted).

@gchari-asapp
Copy link

Sure. I directly attach both log files:
CMakeError.log
CMakeOutput.log

@thanm
Copy link
Contributor

thanm commented Jun 29, 2020

Well, I am stumped at the moment. The log files you posted are functionally identical to the ones from one of my recent builds, but your run seems to fail and mine does not. About all I can suggest at this point is cleaning our your build area (rm -r CMakeFiles CMakeCache.txt) and starting from a clean slate, since I can't find anything actionable in your logs at all.

@gchari-asapp
Copy link

I had already tried to clean my build, that does not fix the issue.
Anyway, thanks anyway for having a look.

Just in case you are interested on following this, the only think that comes to my mind for reproduction is to build the same environment. The issues raises on a fresh ubuntu 20.04 docker container. Other than the base stuff I only recall to have installed git, python and build-essential but probably there are some other basic libs needed. I am running the container on macos, not sure if the container also fails on linux.

@thanm
Copy link
Contributor

thanm commented Jun 29, 2020

If you can post detailed instructions for creating the container (etc) I can give that a try; I do have access to a macbook.

@gchari-asapp
Copy link

gchari-asapp commented Jun 30, 2020

Sure. I attach a Dockerfile.txt
(I had to add the extension txt just to paste it here but should not have extension)

Then I can reproduce just following these steps:

1. mkdir docker
# cd into the new folder, copy the docker file there and remove the extension
2. docker build . -t testgollvm
...
3. docker run -it testgollvm
# Inside docker now
4. cd ~/workarea/build-debug/
5. cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/240637 mentions this issue: gollvm: add the missing setting of -fcf-protection=none

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/240560 mentions this issue: gollvm: extend -fcf-protection workaround to libbacktrace/libffi

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/240558 mentions this issue: gollvm: check/vet shell as part of initial config setup

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/240559 mentions this issue: gollvm: update README to include requirement for 'm4'

@thanm
Copy link
Contributor

thanm commented Jul 1, 2020

I've sent in a couple of CLs that should address the build issues, and @erifan also sent a fix. Things should be buildable using your Docker container now. Note that you'll need to include m4 in the dependences, and insure that SHELL env is set. Let me know if you have additional problems.

@gchari-asapp
Copy link

Yeah. Thanks.

Just in case other face the same issue, I do not know exactly why but echo $SHELL outputs /bin/bash in the docker container although SHELL is not listed as an env var by printenv. This means the cmake only works if I manually export or set SHELL.

I have some issues with the compilation now but I guess this issue is already fixed.

@thanm thanm closed this as completed Jul 6, 2020
@golang golang locked and limited conversation to collaborators Jul 6, 2021
@rsc rsc unassigned thanm Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants