【问题标题】:Tilera cross compilation - linking errorsTilera 交叉编译 - 链接错误
【发布时间】:2010-11-17 08:44:26
【问题描述】:

我正在尝试交叉编译 Tilera 的源代码,但在链接时出现以下错误。 所有这些错误都与 C++ STL(Standard Template Library) 有关。

STL库的链接过程有什么不同吗?

错误是:

gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap(unsigned int volatile* , unsigned int)':
91 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
92 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
93 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
94 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
95 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap_ptr(void* volatile*, v oid*)':
96 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :614: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
97 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a:/u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads .h:614: more undefined references to `stlp_std::_Atomic_swap_struct<0>::_S_swap_ lock' follow 

【问题讨论】:

    标签: c++ compiler-construction tiles


    【解决方案1】:

    我认为这会有所帮助。我之前尝试过使用 Tilera 进行编译,但遇到了类似的错误,“未定义的引用”。解决方案是将库包含在项目属性中。

    单击您的项目设置,转到路径和符号,在库下包括定义stlp_std::_Atomic_swap_struct&lt;0&gt;::_S_swap_lock 的库。

    还要注意 Tilera IDE (eclipse) 是愚蠢的。定义 Tile 库的路径将不起作用!只需输入库的名称即可。 (鉴于您正确设置了 IDE 变量)。如果您使用的是命令行,只需添加参数即可包含库
    -lMyLibrary

    这是一个例子:
    在库下有:

    tmc
    pthread
    

    我假设你是在 Linux 下开发

    【讨论】:

      【解决方案2】:

      “STL”只是 C++ 实现的一部分。它不应该专门链接,就像您不需要专门链接 mallocnew 一样。

      【讨论】:

        【解决方案3】:

        如果我编译一个使用 _S_swap_lock 的小程序,它对我有用:

        $ cat foo.cc
        #include <rope>
        int main(void)
        {
          std::crope r(100000, 'x');
          std::crope r2 = r + "abc";
        }
        $ tile-c++ foo.cc
        $ nm -C a.out | grep -i atomic
        0000000000059028 V stlp_std::_Atomic_swap_struct<1>::_S_swap_lock
        

        这是“”风格,用于 32 位原子,似乎很常用。我在 libsupc++.a 中看不到 风格。我怀疑您需要发布一些重现问题的代码。

        【讨论】:

        • 嗨 Chris,我们的 _threads.h 文件包含 2 个 _Atomic_swap_struct 的定义,所以可以和我们共享 _threads.h 文件。
        猜你喜欢
        • 1970-01-01
        • 2016-12-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-04-24
        • 2020-11-11
        • 2020-12-05
        • 2021-04-20
        相关资源
        最近更新 更多