gollvm build failed

210 views
Skip to first unread message

T Odin

unread,
Jan 27, 2022, 5:38:18 AM1/27/22
to golang-nuts
I'm trying to build gollvm on FreeBSD 13 using the command as mentioned in gollvm source page.

cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm 

I observed that during configuration it fails for malloc 
Looking for malloc/malloc.h
Looking for malloc/malloc.h - not found


which ends up with subsequent build failures for all the dependencies libffi, libbacktrace with 

Support for mmap() is required -- setup failed.
Call Stack (most recent call first):
tools/gollvm/libgo/CMakeLists.txt:49 (setup_libffi)


I read from the FAQs that support for OS other than Linux wasn't supported. I'd like to clarify the changes required to be ported for compiling and supporting on other OS. 

Than McIntosh

unread,
Jan 27, 2022, 8:45:44 AM1/27/22
to T Odin, golang-nuts
Hello,

As I understand it FreeBSD doesn't have any concept of a build essentials package, so in theory /usr/include/malloc.h should always be installed. Are you saying that this file doesn't exist on your system?

Thanks, Than


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/238a962f-b12e-4ccb-b2d6-0bbd91fb0040n%40googlegroups.com.

T Odin

unread,
Feb 26, 2022, 2:55:47 AM2/26/22
to golang-nuts
Hi Than,

I see there is malloc.h present in that path.
But, cmake throws one more error even before the mmap issue:

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

Tried compiling the compile source specified in cmake file manually with fsplit-stack and workaround of fcf-protection=none. 
But, linker is unable to find the symbol __morestack:

ld: error: undefined symbol: __morestack

Can you please help if I'm missing out any configuration ?

Build environment:
clang 13.0.1 on FreeBSD 12.

Than McIntosh

unread,
Feb 28, 2022, 9:23:01 AM2/28/22
to T Odin, golang-nuts
Hello,

Normally the definition of __morestack is drawn from libgcc.a, so I would look to see what the story is with libgcc.a on your system.

Here are some things to try:

// Ask clang where it's picking up libgcc.a
$ clang --print-libgcc-file-name
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/libgcc.a
$

// Ask the linker to trace the symbol during linking
$ clang-11  himom.c -fsplit-stack -Wl,-y,__morestack
/usr/bin/ld: /tmp/himom-9cb8d3.o: reference to __morestack
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/11/libgcc.a(morestack.o): definition of __morestack
$

Thanks, Than


Reply all
Reply to author
Forward
0 new messages