Windows主机上的链接器步骤中,GCC Linaro交叉编译失败 [英] GCC Linaro cross compile fails on linker step on a Windows host

查看:107
本文介绍了Windows主机上的链接器步骤中,GCC Linaro交叉编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用GCC Linaro工具链7.4.1版在Windows主机上构建ARM应用程序(只是一个简单的主要功能).编译正常,创建了我的.o文件,但在链接步骤中出现以下错误(在不同的计算机上测试,结果相同)

I want to build an ARM application(just a simple main function) on Windows host using GCC Linaro toolchains version 7.4.1. Compilation is OK, my .o files are created but on linking step I get the following errors(tested on different computers and result is same)

错误从locale.o文件开始...但是/home/tcwg-builds/..目录与我的计算机路径无关...

Errors start from locale.o file... But that /home/tcwg-builds/.. directory is not related to my computer paths...

建筑目标:arm_cpp调用:跨G ++链接器arm-eabi-g ++ -o"arm_cpp" ./src/arm_cpp.o
c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib \ libstdc ++.a(locale.o):在函数 get_locale_cache_mutex'中:/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++98/locale.cc:36:未定义对 __ sync_synchronize'c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib \ libstdc ++.a(locale_init.o):在函数(匿名名称空间):: get_locale_mutex()'中:/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++98/locale_init.cc:66:未定义对 __ sync_synchronize'c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib \ libstdc ++.a(cxx11-ios_failure.o):在函数(匿名命名空间)中:: __ io_category_instance()':/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++11/cxx11-ios_failure.cc:73:对 __ sync_synchronize'collect2.exe:错误:ld返回1退出状态make:*** [arm_cpp]错误1全部制作"以退出代码2终止.构建可能不完整.

Building target: arm_cpp Invoking: Cross G++ Linker arm-eabi-g++ -o "arm_cpp" ./src/arm_cpp.o
c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib\libstdc++.a(locale.o): In function get_locale_cache_mutex': /home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++98/locale.cc:36: undefined reference to__sync_synchronize' c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib\libstdc++.a(locale_init.o): In function (anonymous namespace)::get_locale_mutex()': /home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++98/locale_init.cc:66: undefined reference to__sync_synchronize' c:/users/yunus/desktop/linarotoolchain/gcc_linaro_7/bin/../lib/gcc/arm-eabi/7.4.1/../../../../arm-eabi/lib\libstdc++.a(cxx11-ios_failure.o): In function (anonymous namespace)::__io_category_instance()': /home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libstdc++-v3/src/c++11/cxx11-ios_failure.cc:73: undefined reference to__sync_synchronize' collect2.exe: error: ld returned 1 exit status make: *** [arm_cpp] Error 1 "make all" terminated with exit code 2. Build might be incomplete.

推荐答案

好吧,我确实搜索了几天这个问题,但是现在我立即从此线程中找到答案:

Well, I really searched this problem for days but now I immeditely find the answer, from this thread: https://lists.linaro.org/pipermail/linaro-toolchain/2018-January/006356.html

据称:

发生此错误是因为arm-eabi编译器默认为旧版本架构的版本(v4或v5t).为添加-mcpu = cortex-a9实例应该避免该问题,因为编译器将能够内联生成同步原语.

This error happens because the arm-eabi compiler defaults to an old version of the architecture (v4 or v5t). Adding -mcpu=cortex-a9 for instance should avoid the problem because the compiler will be able to generate synchronization primitives inline.

使用此链接选项,我可以成功获取没有错误的结果图像

With this linking option I succesfully get result image without errors

这篇关于Windows主机上的链接器步骤中,GCC Linaro交叉编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆