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: Issues on Alpine linux. Tentative definition has type 'struct sigstack' that is never completed, in sysinfo.c #42308

Open
advancedwebdeveloper opened this issue Oct 31, 2020 · 19 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@advancedwebdeveloper
Copy link

Hello.

I was trying to check what is required to build gollvm on Alpine linux (it has musl instead of glibc).

Look like recently revealed set of minimal requirements allowed to build the configuration file (for Ninja).

heading to check whether Ninja would compile.
I wasn't able to find a pre-compiled Clang 11, for Alpine - but Clang 10 was available, which was pre-compiled against musl (C++ standard library has to rely on musl, instead of glibc - as I suppose).

Maybe I would recompile Clang 11, for Alpine distro - but not today.

Must admit that CMake worked much faster, compared to Ubuntu.

Comments would be much appreciated.

@dmitshur dmitshur added this to the gollvm milestone Oct 31, 2020
@advancedwebdeveloper
Copy link
Author

[1/1084] Building sysinfo.o
FAILED: tools/gollvm/libgo/sysinfo.o
cd /home/oceanfish81/workarea/build_release/tools/gollvm/libgo && /usr/bin/clang -g3 -c -fno-eliminate-unused-debug-types /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/sysinfo.c -o /home/oceanfish81/workarea/build_release/tools/gollvm/libgo/sysinfo.o -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/oceanfish81/workarea/build_release/tools/gollvm/libgo -I/home/oceanfish81/workarea/build_release/tools/gollvm/libgo/runtime
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/sysinfo.c:462:1: error: tentative definition has type 'struct sigstack' that is never completed
SREF(sigstack);
^
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/sysinfo.c:374:32: note: expanded from macro 'SREF'
#define SREF(stag) struct stag stag ## ref
^
:52:1: note: expanded from here
sigstackref
^
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/sysinfo.c:462:6: note: forward declaration of 'struct sigstack'
SREF(sigstack);
^
1 error generated.
ninja: build stopped: subcommand failed.

@advancedwebdeveloper advancedwebdeveloper changed the title gollvm: Issues on Alpine linux (CMake, mostly) gollvm: Issues on Alpine linux. Tentative definition has type 'struct sigstack' that is never completed, in sysinfo.c Nov 1, 2020
@advancedwebdeveloper
Copy link
Author

CC @thanm @ianlancetaylor @cherrymui

@advancedwebdeveloper
Copy link
Author

You can find my compressed build folder out here

@advancedwebdeveloper
Copy link
Author

Asked @rcombs , recently - and got a hint: that is about using sigaltstack ( description ) versus sigstack ( description ).

@advancedwebdeveloper
Copy link
Author

@ncopa , please advise something.

@advancedwebdeveloper
Copy link
Author

I have replaced the line - so now I am getting the following:

[1/1075] Building Go package 'runtime' (non-PIC)
FAILED: tools/gollvm/libgo/runtime.o
cd /home/oceanfish81/workarea/build_release/tools/gollvm/libgo && /usr/bin/cmake -E make_directory ./. && /home/oceanfish81/workarea/build_release/./bin/llvm-goc -c -o /home/oceanfish81/workarea/build_release/tools/gollvm/libgo/./runtime.o -fgo-pkgpath=runtime -fgo-c-header=runtime.inc.raw -fgo-compiling-runtime -I . /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/alg.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/atomic_pointer.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/cgo_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/cgocall.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/cgocheck.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/chan.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/compiler.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/cpuprof.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/cputicks.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/debug.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/debuglog.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/debuglog_off.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/env_posix.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/eqtype.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/error.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/extern.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/fastlog2.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/fastlog2table.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/ffi.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/float.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/hash64.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/heapdump.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/iface.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/lfstack.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/lfstack_64bit.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/lock_futex.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/lockrank.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/lockrank_off.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/malloc.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/map.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/map_fast32.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/map_fast64.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/map_faststr.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mbarrier.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mbitmap.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mcache.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mcentral.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mem_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mfinal.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mfixalloc.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgc.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgc_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgcmark.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgcscavenge.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgcsweep.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgcsweepbuf.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mgcwork.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mheap.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mpagealloc.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mpagealloc_64bit.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mpagecache.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mpallocbits.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mprof.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mranges.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/msan0.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/msize.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mspanset.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mstats.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/mwbbuf.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/nbpipe_pipe2.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/netpoll.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/netpoll_epoll.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/os_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/os_linux.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/os_linux_noauxv.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/panic.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/panic32.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/preempt.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/preempt_nonwindows.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/print.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/proc.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/profbuf.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/proflabel.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/race0.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/rdebug.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/relax_stub.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/runtime.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/runtime1.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/runtime2.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/rwmutex.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/select.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/sema.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_unix.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/sigqueue.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/sigqueue_note.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/sizeclasses.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/slice.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/string.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/stubs.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/stubs2.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/stubs3.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/stubs_linux.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/symtab.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/time.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/time_nofake.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/timestub.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/timestub2.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/trace.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/traceback_gccgo.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/type.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/typekind.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/utf8.go /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/write_err.go /home/oceanfish81/workarea/build_release/tools/gollvm/libgo/runtime_linknames.go /home/oceanfish81/workarea/build_release/tools/gollvm/libgo/runtime_sysinfo.go /home/oceanfish81/workarea/build_release/tools/gollvm/libgo/sigtab.go
/home/oceanfish81/workarea/build_release/tools/gollvm/libgo/sigtab.go:38:2: error: duplicate value for index 29
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_unix.go:810:3: error: range clause must have array, slice, string, map, or channel type
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_unix.go:1040:2: error: range clause must have array, slice, string, map, or channel type
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_unix.go:810:7: error: invalid type for range clause
/home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/signal_unix.go:1040:6: error: invalid type for range clause
ninja: build stopped: subcommand failed.

Here is my compressed build folder.

Also mentioned

newSigstack bool // minit on C thread called sigaltstack
and https://github.com/golang/go/search?q=sigaltstack .
So there seams to be some support, for sigaltstack

@ericonr
Copy link

ericonr commented Nov 9, 2020

https://go.googlesource.com/gollvm/#wheretopostquestions recommends the mailing list instead of the issue tracker.

@advancedwebdeveloper
Copy link
Author

@thanm, I got this

[91/1825] Building CXX object lib/Target/CMakeFiles/LLVMTarget.dir/TargetLoweringObjectFile.cpp.o
ninja: job failed: /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/gollvm/passes -I/home/oceanfish81/llvm-project/llvm/tools/gollvm/passes -Iinclude -I/home/oceanfish81/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -g -fno-exceptions -fno-rtti -std=c++14 -MD -MT tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoNilChecks.cpp.o -MF tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoNilChecks.cpp.o.d -o tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoNilChecks.cpp.o -c /home/oceanfish81/llvm-project/llvm/tools/gollvm/passes/GoNilChecks.cpp
/home/oceanfish81/llvm-project/llvm/tools/gollvm/passes/GoNilChecks.cpp:361:68: error: no member named 'unknown' in 'llvm::LocationSize'
AA->alias(MemoryLocation(MMO1->getValue(), LocationSize::unknown(),
~~~~~~~~~~~~~~^
/home/oceanfish81/llvm-project/llvm/tools/gollvm/passes/GoNilChecks.cpp:363:68: error: no member named 'unknown' in 'llvm::LocationSize'
MemoryLocation(MMO2->getValue(), LocationSize::unknown(),
~~~~~~~~~~~~~~^

I was using

$ clang --version
Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c)
Target: x86_64-alpine-linux-musl
Thread model: posix

@advancedwebdeveloper
Copy link
Author

Now I have another problem:

build-server:~/workarea/release$ ninja gollvm
[1/1092] Generating /home/oceanfish81/workarea/release/tools/gollvm/libgo/gen-sysinfo.go
ninja: job failed: cd /home/oceanfish81/workarea/release/tools/gollvm/libgo && /home/oceanfish81/workarea/release/./bin/llvm-godumpspec --macrotmp=/home/oceanfish81/workarea/release/tools/gollvm/libgo/sysinfo.macros.txt --object=/home/oceanfish81/workarea/release/tools/gollvm/libgo/sysinfo.o --output=/home/oceanfish81/workarea/release/tools/gollvm/libgo/gen-sysinfo.go.tmp
error: failed to decompress '.debug_info', zlib is not available
error: failed to decompress '.debug_abbrev', zlib is not available
error: failed to decompress '.debug_line', zlib is not available
error: failed to decompress '.debug_str', zlib is not available
error: no DWARF compilation units found in /home/oceanfish81/workarea/release/tools/gollvm/libgo/sysinfo.o

@thanm
Copy link
Contributor

thanm commented Jan 11, 2021

zlib not available

This is an LLVM peculiarity -- in the LLVM cmake rules ( https://llvm.org/docs/CMake.html ) there is a control variable

 LLVM_ENABLE_ZLIB:BOOL
 Enable building with zlib to support compression/uncompression in LLVM tools. Defaults to ON.

Most likely what is happening is that your build system doesn't have zlib installed.

Try applying this patch and see if it helps:

diff --git a/cmake/modules/AutoGenGo.cmake b/cmake/modules/AutoGenGo.cmake
index 3e3ab83..b5e21ec 100644
--- a/cmake/modules/AutoGenGo.cmake
+++ b/cmake/modules/AutoGenGo.cmake
@@ -505,7 +505,7 @@ function(mkgensysinfo tmpfile outfile macrofile objfile godumpspec sysinfoc)
   # implement this functionality.
   add_custom_command(
     OUTPUT ${objfile}
-    COMMAND ${ccomp} "-g2" "-c" "-fno-eliminate-unused-debug-types"
+    COMMAND ${ccomp} "-g2" "-c" "-fno-eliminate-unused-debug-types" "-gz=none"
             ${sysinfoc} -o ${objfile} ${cflags}
     DEPENDS ${sysinfoc} ${ARG_DEPS}
     COMMENT "Building sysinfo.o "

@advancedwebdeveloper
Copy link
Author

Thanks, I will check.

Btw here is a compressed virtual drive image:
https://drive.google.com/file/d/1J3YMemta7jphbK5Pq_rqhmH2HfW5NkYb/view?usp=sharing
.

@ardhipoetra
Copy link

@advancedwebdeveloper Hello. I wonder if you can get gollvm compiled on top of alpine+musl?

@advancedwebdeveloper
Copy link
Author

I can't tell that it can't be compiled - it rather seems to have some custom issues, for some packages of libgo.
But I do not know whether there are any specific runtime issues - but predict that they would appear.

@ardhipoetra , are you interested to reproduce this (on the latest version of Alpine and by using the latest versions of gollvm, Clang) ?

@ardhipoetra
Copy link

ardhipoetra commented Mar 1, 2021

I almost able to compile gollvm with latest-ish llvm (from git) and clang (from alpine repo). However, the linking seems to be incorrect, though :

ninja: job failed: cd /root/wd/build/tools/gollvm/gotools && /root/wd/build/./bin/llvm-goc -o /root/wd/build/tools/gollvm/gotools/test2json test2json_.o -I /root/wd/build/tools/gollvm/libgo -L /root/wd/build/tools/gollvm/libgo /root/wd/build/tools/gollvm/libgo/libgotool.a
/usr/bin/ld.gold: error: cannot open crt1.o: No such file or directory
/usr/bin/ld.gold: error: cannot open crti.o: No such file or directory
/usr/bin/ld.gold: error: cannot open crtbegin.o: No such file or directory
/usr/bin/ld.gold: error: cannot open crtend.o: No such file or directory
/usr/bin/ld.gold: error: cannot open crtn.o: No such file or directory
/usr/bin/ld.gold: error: cannot find -lgcc
/usr/bin/ld.gold: error: cannot find -lgcc
/usr/bin/ld.gold: error: cannot find -lgcc
/usr/bin/ld.gold: error: cannot find -lgcc

@advancedwebdeveloper
Copy link
Author

Trying installing musl-dev package

@ardhipoetra
Copy link

It was definitely not because I didn't have musl-dev package. Apparently I need to set the target build correctly and did some hackish changes on the gollvm (and gofrontend).

Now it is compiled (gcc9 + alpine + musl), but cannot be executed, although ldd gives me all the linkage :

bash-5.1# ./go
bash: ./go: No such file or directory
bash-5.1# ldd ./go 
        /lib64/ld-linux-x86-64.so.2 (0x7fd921212000)
        libgo.so.13git => /root/wd/build/lib64/libgo.so.13git (0x7fd91f943000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fd91f929000)
        libc.musl-x86_64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fd921212000)
bash-5.1# 

@advancedwebdeveloper
Copy link
Author

You are somewhat ahead of me.
Could you create something like a github gist, containing all the commands and patches?

That would allow to reproduce this.
Btw you can prepare both Dokerfile and script for a VM - I shall try a VM related scenario, first.

@thanm , any ideas on the runtime issue?
@ardhipoetra , which version of Alpine Linux is used?

I sent you an invite, on Slack

@ericonr
Copy link

ericonr commented Apr 3, 2021

@ardhipoetra /lib64/ld-linux-x86-64.so.2 (0x7fd921212000) makes it seem like the resulting binary refers to glibc's dynamic linker, and not musl's. This might be a blind spot in musl's ldd, I believe it should have errored out.

You can try installing gcompat to make things move forward, but there is definitely something wrong with the build.

@advancedwebdeveloper
Copy link
Author

@ericonr, @ardhipoetra : I am still following.
I might try to reproduce on Aarch64 port of Alpine - but not sure what to do with the lack of support, for segmented stacks.
Also contigous stacks where present, for an ordinary compiler/linker support (not for gollvm) - but people claim that gccgo still uses segmented stacks.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants