gpt4 book ai didi

D2 gdc 链接错误 - 对 `_D3std6stdint12__ModuleInfoZ` 的 undefined reference

转载 作者:行者123 更新时间:2023-12-04 16:01:17 26 4
gpt4 key购买 nike

我正在使用 https://bitbucket.org/goshawk/gdc/downloads/gcc-4.5.2-tdm-1-gdc-r575-20110723.zip使用 TDM GCC 4.5.2 在 -v2 模式下构建 DLL。在我做的一个模块中import std.stdint .所以我想我应该链接到 libgphobos2 来解决这个问题,但它给了我更多的错误:

c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `D4core6thread6Thread6__ctorMFZC4core6thread6Thread':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `thread_entryPoint@4':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:173: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:173: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:173: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `D4core6thread6Thread6__ctorMFZC4core6thread6Thread':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `thread_attachThis':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1957: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `D4core6thread6Thread6__ctorMFZC4core6thread6Thread':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `thread_attachByAddrB':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:2048: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `D4core6thread18thread_getTLSBlockFZAv':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:2632: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:2632: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:2632: undefined reference to `__emutls_v._tlsstart'
c:/mingw32/bin/../lib/gcc/mingw32/4.5.2/../../../libgphobos2.a(thread.o): In function `D4core6thread6Thread6__ctorMFZC4core6thread6Thread':
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsend'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'
C:\crossdev\gdc\v2\build\mingw32\libphobos/../../../gcc-4.5.2/libphobos/core/thread.d:1363: undefined reference to `__emutls_v._tlsstart'

这是一个错误还是我需要向 gdc 传递一些额外的标志?

最佳答案

我还在 -v2 模式下尝试使用来自 bitbucket 源的 GDC 来编译库,以尝试将某些 D 功能与 C++ 应用程序接口(interface)。

我发现缺少指向 _tlsstart 和 _tlsend 的链接也存在同样的问题。
部分解决方案是在库中包含一个“main”函数:

void main(){}

我正在使用 linux 上的静态库。我检查了生成的静态库:
nm libDexample.a

这表明上述简单的 main 向 libDexample.d 中插入了额外的符号(也最终出现在 c++ 可执行文件中):
_Dmain
_tlsend
_tlsstart

当然,如果在 D 应用程序中使用该库,这些符号会给出与多个定义相关的链接错误。因此,您可以定义一个单独的库,例如 libtls.d,其中包含:
extern(C) void make_it_link_please(){}
//inserts the _tlsstart and _tlsend stuff???????
void main()
{
}

在 C++ 应用程序而不是 D 应用程序的情况下与 libtls 链接。

关于D2 gdc 链接错误 - 对 `_D3std6stdint12__ModuleInfoZ` 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6904662/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com