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 failed, on FreeBSD 13.0 x86_64 #42282

Open
advancedwebdeveloper opened this issue Oct 29, 2020 · 21 comments
Open

gollvm: build failed, on FreeBSD 13.0 x86_64 #42282

advancedwebdeveloper opened this issue Oct 29, 2020 · 21 comments
Milestone

Comments

@advancedwebdeveloper
Copy link

@advancedwebdeveloper advancedwebdeveloper commented Oct 29, 2020

Hi.
I was investigating current blocking issues, on FreeBSD 13.0.

$cmake -DCMAKE_CXX_FLAGS=' -I~/workarea/freebsd_src/include ' -DCMAKE_C_FLAGS=' -I~/workarea/freebsd_src/include ' ../

-- The C compiler identification is Clang 11.0.0
-- The CXX compiler identification is Clang 11.0.0
-- The ASM compiler identification is Clang
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default to Debug
-- Performing Test LLVM_LIBSTDCXX_MIN
-- Performing Test LLVM_LIBSTDCXX_MIN - Success
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
-- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
-- 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

And then some problems arrived:

-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found

. Then it went pretty fine:

-- 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/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sysexits.h
-- Looking for sysexits.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found

.
The following source file isn't critical, really:

-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found

.
And then:

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

.
I am not using MacOS - so not sure why would CMake find this source file:

-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found

.
Let's continue:

-- Looking for histedit.h
-- Looking for histedit.h - found

.
This source file appears to be pretty much MacOS related -and that is not what we require, for our use case:

-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found

.
Some threading related stuff followed:

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

.
The next header is related to a performance monitoring framework:

-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found

. @ianlancetaylor , did anyone tried to monitor performance of Golang applications, using perfmon2?
.

-- Looking for pthread.h
-- Looking for pthread.h - found

.
Now some FreeBSD specific (predictive failures) arriving:

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

.
I am not an expert in FreeBSD - so some comments are welcome.

-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.11")
-- Looking for compress2
-- Looking for compress2 - found
-- Found LibXml2: /usr/local/lib/libxml2.so (found version "2.9.10")
-- Looking for xmlReadMemory
-- Looking for xmlReadMemory - found
-- Looking for el_init in edit
-- Looking for el_init in edit - found

.
I was not able to verify if this source file has to be involved:

-- Looking for xar_open in xar
-- Looking for xar_open in xar - not found

.

-- Looking for arc4random
-- Looking for arc4random - found

.
Here is a mission feature - and some links/explanation on FreeBSD's backtracing support would be of help:

-- Looking for backtrace
-- Looking for backtrace - not found

.
I suspect that I haven't installed (via "pkg" tool? threw a corresponding BSD "port"?) libexecinfo package/dependency.
But no - it was found (thus do not understand why the header, referenced above, wasn't found):

-- Found Backtrace: /usr/lib/libexecinfo.so
.
I am super glad that the following option is available - but I am unsure what is it for:
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
.
Related (against the previously discussed feature) dependency:

-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - not 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

Not sure that the following headers are required, in our case (look like it is related to the file I/O):

-- Looking for lseek64
-- Looking for lseek64 - not found

.

-- Looking for mallctl
-- Looking for mallctl - found

.
Now, a critical issue (FreeBSD vs Linux, for sure):

-- Looking for mallinfo
-- Looking for mallinfo - not 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

This looks pretty critical:

-- 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 - found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Success
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success

. Now, the following looks super obvious - simply ignoring:

-- Looking for GLIBC
-- Looking for GLIBC - not 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 HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_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 - Success
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
Unfamiliar people shouldn't be confused - ignoring this:

-- Go bindings disabled.
.
These could be ignored:
-- 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

.
Now, here is some significant information:

-- LLVM host triple: x86_64-unknown-freebsd13.0
-- LLVM default target triple: x86_64-unknown-freebsd13.0
.
Some extra attention, on these lines, please:

-- 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 - Success
-- 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_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success

Some explanation would be much appreciated, on this:

-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Failed

.

-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR - Success
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Success
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Success

.
Is the following function being a purely MacOS specific one?

-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found

.

-- Found Python3: /usr/local/bin/python3.7 (found version "3.7.9") found components: Interpreter
-- Constructing LLVMBuild project information
-- Linker detection: LLD
-- Found Git: /usr/local/bin/git (found version "2.28.0")

I was trying to avoid passing too many CMake's flags (just to track down the "default" influence) - but non-needed back-ends could stripped down by -DLLVM_TARGET_TO_BUILD flag:

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

-- default linker set to "gold"
-- Performing Test C_SUPPORTS_CF_PROTECTION_BRANCH
-- Performing Test C_SUPPORTS_CF_PROTECTION_BRANCH - Success

.
Now, significant errors arriving:

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

As a result - we are getting the following:

CMake Error at tools/gollvm/cmake/modules/AddGollvm.cmake:68 (message):
C compiler does not support -fsplit-stack
Call Stack (most recent call first):
tools/gollvm/CMakeLists.txt:22 (include)

-- starting libgo configuration.

This issue is a reason for a discussion:

-- Performing Test HAVE_ATOMIC_FUNCTIONS
-- Performing Test HAVE_ATOMIC_FUNCTIONS - Failed

.
Either these are not a BSD compatible functions - or Clang can't find those (hence that I have provided 3rd party path, to search for headers - FreeBSD's repo was cloned, into another folder):

-- Looking for clock_gettime
-- Looking for clock_gettime - not found
-- Looking for strnlen
-- Looking for strnlen - not found
-- Looking for dl_iterate_phdr
-- Looking for dl_iterate_phdr - not found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for getexecname
-- Looking for getexecname - not found
-- Looking for lstat
-- Looking for lstat - not found
-- Looking for readlink
-- Looking for readlink - not found
-- Looking for mmap
-- Looking for mmap - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for dup3
-- Looking for dup3 - not found
-- Looking for epoll_create1
-- Looking for epoll_create1 - not found
-- Looking for faccessat
-- Looking for faccessat - not found
-- Looking for fallocate
-- Looking for fallocate - not found
-- Looking for fchmodat
-- Looking for fchmodat - not found
-- Looking for fchownat
-- Looking for fchownat - not found
-- Looking for futimesat
-- Looking for futimesat - not found
-- Looking for inotify_add_watch
-- Looking for inotify_add_watch - not found
-- Looking for inotify_init
-- Looking for inotify_init - not found
-- Looking for inotify_init1
-- Looking for inotify_init1 - not found
-- Looking for inotify_rm_watch
-- Looking for inotify_rm_watch - not found
-- Looking for listxattr
-- Looking for listxattr - not found
-- Looking for mincore
-- Looking for mincore - not found
-- Looking for mkdirat
-- Looking for mkdirat - not found
-- Looking for openat
-- Looking for openat - not found
-- Looking for removexattr
-- Looking for removexattr - not found
-- Looking for renameat
-- Looking for renameat - not found
-- Looking for setxattr
-- Looking for setxattr - not found
-- Looking for splice
-- Looking for splice - not found
-- Looking for sync_file_range
-- Looking for sync_file_range - not found
-- Looking for syscall
-- Looking for syscall - not found
-- Looking for tee
-- Looking for tee - not found
-- Looking for unlinkat
-- Looking for unlinkat - not found
-- Looking for unsetenv
-- Looking for unsetenv - not found
-- Looking for unshare
-- Looking for unshare - not found
-- Looking for utimensat
-- Looking for utimensat - not found
-- Looking for wait4
-- Looking for wait4 - not found
-- Looking for open64
-- Looking for open64 - not found
-- Looking for mknodat
-- Looking for mknodat - not found
-- Looking for pipe2
-- Looking for pipe2 - not found
-- Looking for memmem
-- Looking for memmem - not found
-- Looking for inttypes.h
-- Looking for inttypes.h - not found
-- Looking for linux/ether.h
-- Looking for linux/ether.h - not found
-- Looking for linux/filter.h
-- Looking for linux/filter.h - not found
-- Looking for linux/fs.h
-- Looking for linux/fs.h - not found
-- Looking for linux/if_addr.h
-- Looking for linux/if_addr.h - not found
-- Looking for linux/if_ether.h
-- Looking for linux/if_ether.h - not found
-- Looking for linux/if_tun.h
-- Looking for linux/if_tun.h - not found
-- Looking for linux/netlink.h
-- Looking for linux/netlink.h - not found
-- Looking for linux/ptrace.h
-- Looking for linux/ptrace.h - not found
-- Looking for linux/reboot.h
-- Looking for linux/reboot.h - not found
-- Looking for linux/rtnetlink.h
-- Looking for linux/rtnetlink.h - not found
-- Looking for memory.h
-- Looking for memory.h - not found
-- Looking for net/if.h
-- Looking for net/if.h - not found
-- Looking for net/if_arp.h
-- Looking for net/if_arp.h - not found
-- Looking for net/route.h
-- Looking for net/route.h - not found
-- Looking for netinet/icmp6.h
-- Looking for netinet/icmp6.h - not found
-- Looking for netinet/if_ether.h
-- Looking for netinet/if_ether.h - not found
-- Looking for netinet/in_systm.h
-- Looking for netinet/in_systm.h - not found
-- Looking for netinet/ip.h
-- Looking for netinet/ip.h - not 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 - not found
-- Looking for port.h
-- Looking for port.h - not found
-- Looking for sched.h
-- Looking for sched.h - not found
-- Looking for semaphore.h
-- Looking for semaphore.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stdlib.h
-- Looking for stdlib.h - not found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - not found
-- Looking for sys/file.h
-- Looking for sys/file.h - not found
-- Looking for sys/inotify.h
-- Looking for sys/inotify.h - not found
-- Looking for sys/mount.h
-- Looking for sys/mount.h - not found
-- Looking for sys/prctl.h
-- Looking for sys/prctl.h - not found
-- Looking for sys/ptrace.h
-- Looking for sys/ptrace.h - not found
-- Looking for sys/select.h
-- Looking for sys/select.h - not found
-- Looking for sys/statfs.h
-- Looking for sys/statfs.h - not found
-- Looking for sys/syscall.h
-- Looking for sys/syscall.h - not found
-- Looking for sys/sysinfo.h
-- Looking for sys/sysinfo.h - not found
-- Looking for sys/timex.h
-- Looking for sys/timex.h - not found
-- Looking for sys/user.h
-- Looking for sys/user.h - not found
-- Looking for sys/utsname.h
-- Looking for sys/utsname.h - not found
-- Looking for sys/vfs.h
-- Looking for sys/vfs.h - not found
-- Looking for syscall.h
-- Looking for syscall.h - not found
-- Looking for utime.h
-- Looking for utime.h - not found
-- Looking for compress in z
-- Looking for compress in z - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of double
-- Check size of double - failed
-- Check size of long double
-- Check size of long double - failed
-- Check size of long double
-- Check size of long double - failed
-- Check size of void*
-- Check size of void* - failed
-- Looking for alloca.h
-- Looking for alloca.h - not found
-- Looking for alloca
-- Looking for alloca - not found
-- Looking for memcpy
-- Looking for memcpy - not found
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4 - Failed
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8
-- Performing Test HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8 - Failed
-- Performing Test HAVE_AS_X86_AES
-- Performing Test HAVE_AS_X86_AES - Failed

All that results into

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)

and

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)

.
As for the following

CMake Error at tools/gollvm/cmake/modules/AutoGenGo.cmake:389 (message):
*** struct epoll_event data.fd offset unknown
Call Stack (most recent call first):
tools/gollvm/libgo/CMakeLists.txt:323 (mkepoll)

I would suggest some relation here.

-- 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)
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_SUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WNO_SUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Success
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- success
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring incomplete, errors occurred!

See also "/home/oceanfish81/workarea/build_release/CMakeFiles/CMakeOutput.log".
See also "/home/oceanfish81/workarea/build_release/CMakeFiles/CMakeError.log".

Here is the link to this log, in case you would wish to reference it, among any other people.

My compressed build folder could be downloaded here .

@thanm thanm added this to the gollvm milestone Oct 30, 2020
@thanm
Copy link
Member

@thanm thanm commented Oct 30, 2020

It looks as though cmake is trying to detect whether "mmap" is present/usable, however when it tries to link a small program that uses mmap, it gets:

/usr/local/bin/ld.gold: error: CMakeFiles/cmTC_c70af.dir/CheckSymbolExists.c.o: could not convert call to '__morestack' to '__morestack_non_split'
CMakeFiles/cmTC_c70af.dir/CheckSymbolExists.c.o:CheckSymbolExists.c:function main: error: undefined reference to '__morestack'

Looks as though the compiler on this system accepts "-fsplit-stack", but the runtime library support is not there... this is not something currently handled in the cmake config setup.

@kostikbel
Copy link

@kostikbel kostikbel commented Oct 30, 2020

I think there is something broken at very base level in this environment. For instance, complains about strnlen() indicate that it is broken compilation environment, not that strnlen is missed (the function is there). Same for many other checks in the log. I think for start the detailed log with compiler output from the failing tests, and test snippets itself, should be examined.

If you provide these data, I can help with interpreting the causes.

The one case that obviously does not fall into this category is the check for epoll(2). FreeBSD does not have epoll, we provide kqueue. If you need epoll, there are compat shims in devel/libepoll-shim. It should be fine to have it as a dependency for gollvm.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 30, 2020

@kostikbel , thanks: appreciating your involvement.
Sure thing, I will collect all the log and arrange those in some easily readable form (to be able to analyze the summary of all issues, to track down related systematics).

@ianlancetaylor , where there any attempts to port libgo natively (on/to FreeBSD)?

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 30, 2020

@kostikbel , what is the best way to prepare/provide FreeBSD's headers?

@kostikbel
Copy link

@kostikbel kostikbel commented Oct 30, 2020

@kostikbel , what is the best way to prepare/provide FreeBSD's headers?

Prepare for what ? Provide in what sense ?

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 30, 2020

It looks as though cmake is trying to detect whether "mmap" is present/usable, however when it tries to link a small program that uses mmap, it gets:

/usr/local/bin/ld.gold: error: CMakeFiles/cmTC_c70af.dir/CheckSymbolExists.c.o: could not convert call to '__morestack' to '__morestack_non_split'
CMakeFiles/cmTC_c70af.dir/CheckSymbolExists.c.o:CheckSymbolExists.c:function main: error: undefined reference to '__morestack'

Looks as though the compiler on this system accepts "-fsplit-stack", but the runtime library support is not there... this is not something currently handled in the cmake config setup.

@mneumann, do you have any experience with this.
I saw that you are rather a Rust developer - however you seam to investigate LLVM related issues.
Would you add your 50 cents to this discussion?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 30, 2020

I doubt that libgo will work on FreeBSD out of the box today.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 30, 2020

Prepare for what ? Provide in what sense ?
CMake dows not know where to find the headers.
How should I ensure of their presence (specific packages installed)?
Are those provided with the rest of FreeBSD's kernel implementation - or it is OK just to have the headers themselves?
We are dealing with some userspace stuff...

@kostikbel
Copy link

@kostikbel kostikbel commented Oct 30, 2020

Prepare for what ? Provide in what sense ?
CMake dows not know where to find the headers.
How should I ensure of their presence (specific packages installed)?
Are those provided with the rest of FreeBSD's kernel implementation - or it is OK just to have the headers themselves?
We are dealing with some userspace stuff...

System headers are always installed in /usr/include. You get them after installing base.
If cmake cannot find them, system is broken (or more likely, the used compiler is broken).

If you are asking about non-base headers, coming from the ports/packages, and installed in /usr/local/include, of course you need to have corresponding package installed. But this is tautology.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Nov 4, 2020

I see this

error: undefined reference to '__morestack'
in my error log.
It might be related to gold itself.

I have wiped out my VM - and installed FreeBSD 13.0 x86_64 from stratch.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Nov 4, 2020

I am wrong: it is the same even with

$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_USE_LINKER=lld -DCMAKE_CXX_FLAGS=' -fuse-ld=lld ' -DCMAKE_C_FLAGS=' -fuse-ld=lld ' -DGOLLVM_DEFAULT_LINKER=lld -G Ninja ../llvm-project/llvm

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Nov 4, 2020

This

$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_USE_LINKER=lld -DCMAKE_CXX_FLAGS=' -I/usr/src/sys -I/usr/include -fuse-ld=lld ' -DCMAKE_C_FLAGS=' -I/usr/src/sys -I/usr/include -fuse-ld=lld ' -DGOLLVM_DEFAULT_LINKER=lld -G Ninja ../llvm-project/llvm

isn't helping.

@kostikbel
Copy link

@kostikbel kostikbel commented Nov 4, 2020

This error (undef __morestack) is due to use of -fsplit-stack, as explained above. FreeBSD does not have runtime support for it, configuration should not use the flag despite compiler itself accept it.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Jan 13, 2021

Looks like that is not the issue of libbacktrace, under any circumstances. Appears that some configuration params are not handled (epoll vs kqueue) - kqueue is not even specified, as an option, during CMake's generation stage.

Referencing epoll's usage:
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/config.h.in#53
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/config.h.in#279
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#640
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#641
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15262
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15536
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15688
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15689
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15690
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15693
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15696
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15700
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure#15720
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure.ac#583
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure.ac#603
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure.ac#663
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/configure.ac#683
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#670
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#672
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#732
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#753
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#1002
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.am#1287
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#469
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#473
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#924
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#925
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#1096
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#1171
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#2894
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#2915
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#2894
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/Makefile.in#2915
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mkrsysinfo.sh#25
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mkrsysinfo.sh#95
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mkrsysinfo.sh#121
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mksysinfo.sh#37
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mksysinfo.sh#266
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/mksysinfo.sh#281
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/sysinfo.c#56
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/sysinfo.c#354
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/sysinfo.c#356
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/sysinfo.c#483
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/sysinfo.c#487
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/os/file_unix.go#167
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/os/exec/exec_test.go#615
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/export_linux_test.go#15
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/export_linux_test.go#18
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/netpoll_epoll.go#15
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/netpoll_epoll.go#92
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/netpoll_epoll.go#136
...
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/go/runtime/netpoll_epoll.go#185
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/runtime/go-nosys.c#62
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/runtime/go-nosys.c#64
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/testsuite/Makefile.in#221
https://go.googlesource.com/gofrontend/+/refs/heads/master/libgo/testsuite/Makefile.in#225

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Jan 13, 2021

@benesch , could you validate this?

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Jan 13, 2021

CC'ing @Allenxuxu , since he has some end-user experience with both kqueue and epoll (within https://github.com/Allenxuxu/gev project ).

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Jan 13, 2021

@thanm, is this summary complete for patching CMake's config. file?

@thanm
Copy link
Member

@thanm thanm commented Jan 13, 2021

is this summary complete

You're in a better position to determine that than I am.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Jan 13, 2021

@tcberner , CC'ing to you - you seem to contribute into https://www.freshports.org/devel/cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants