duanchun1881 2019-05-02 15:21
浏览 81

带有未定义的更多堆栈符号的crosstool-ng gccgo构建错误

I'm building gccgo with crosstool-ng 1.24.0. Got linker error when compiling the very simple main.go. Any idea how to solve this? Any pointer to a successful gogcc build even for a different popular target that can easily be verified?

The host is ubuntu 18.04 with gcc 7.3.0. The crosstool-ng target is x86_64-ubuntu16.04-linux-gnu which should create gcc 8.3.0 with glibc 2.23.

Here are the missing symbols:

undefined reference to `__morestack_block_signals'
undefined reference to `__generic_morestack'
undefined reference to `__morestack_unblock_signals'
undefined reference to `__morestack_block_signals'
undefined reference to `__generic_releasestack'
undefined reference to `__generic_findstack'
undefined reference to `__generic_morestack_set_initial_sp'
undefined reference to `__morestack_load_mmap'

More details of the build steps:

[1] Check out crosstool-ng. It's master is now on 1.24.0.

[2] Run these commands to build a plain c and c++ toolchain:

./bootstrap
./configure --enable-local
make
./ct-ng show-x86_64-ubuntu16.04-linux-gnu
./ct-ng x86_64-ubuntu16.04-linux-gnu
./ct-ng build

[3] Verify that the gcc works by compiling a hello-world program and run.

[4] Edit the script to enable go. The patch looks like:

diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
@@ -597,7 +597,7 @@ do_gcc_core_backend() {
-        --enable-languages="${lang_list}"              \
+        --enable-languages="${lang_list},go"              \
@@ -903,7 +903,7 @@ do_gcc_backend() {
-    extra_config+=("--enable-languages=${lang_list}")
+    extra_config+=("--enable-languages=${lang_list},go")

[5] Run ./ct-ng build again.

[6] Compile a very simple main.go:

// main.go
package main

import "fmt"
func main() {
    fmt.Printf("Ok, ok, this is exactly perfect!
")
}

Using command:

PATH=${HOME}/x-tools/x86_64-ubuntu16.04-linux-gnu/bin/:${PATH}
export PATH

x86_64-ubuntu16.04-linux-gnu-gccgo -o main main.go

Got these errors:

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/x-tools/x86_64-ubuntu16.04-linux-gnu/lib/gcc/x86_64-ubuntu16.04-linux-gnu/8.3.0/libgcc.a(morestack.o): 
in function `__morestack':

~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:504:
undefined reference to `__morestack_block_signals'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:512:
undefined reference to `__generic_morestack'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:531:
undefined reference to `__morestack_unblock_signals'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:556:
undefined reference to `__morestack_block_signals'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:562:
undefined reference to `__generic_releasestack'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:588:
undefined reference to `__morestack_unblock_signals'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:609:
undefined reference to `__generic_findstack'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/x-tools/x86_64-ubuntu16.04-linux-gnu/lib/gcc/x86_64-ubuntu16.04-linux-gnu/8.3.0/libgcc.a(morestack.o):
in function `__stack_split_initialize':

~/crosstool-ng/.build/x86_64-ubuntu16.04-linux-gnu/src/gcc/libgcc/config/i386/morestack.S:758:
undefined reference to `__generic_morestack_set_initial_sp'

~/x-tools/x86_64-ubuntu16.04-linux-gnu/lib/gcc/x86_64-ubuntu16.04-linux-gnu/8.3.0/../../../../x86_64-ubuntu16.04-linux-gnu/bin/ld:
~/x-tools/x86_64-ubuntu16.04-linux-gnu/lib/gcc/x86_64-ubuntu16.04-linux-gnu/8.3.0/libgcc.a(morestack.o):
(.ctors.65535+0x8):
undefined reference to `__morestack_load_mmap'

collect2: error: ld returned 1 exit status
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog