2011-08-01 77 views
6

我使用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解決這個問題,但它給了我更多的錯誤:D2 gdc鏈接錯誤 - 未定義引用到`_D3std6stdint12__ModuleInfoZ`

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 `[email protected]': 
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' 

這是bug還是我需要通過一些額外的標誌來GDC?

回答

1

爲了編譯一個庫,我嘗試使用GDC從bitbucket源代碼編譯一個庫,嘗試將某些D功能與C++應用程序接口。

我發現了與_tlsstart和_tlsend缺少鏈接相同的問題。 的部分解決方案是包括在庫中的「主要」功能:

void main(){} 

我在Linux上使用靜態庫的工作。餘檢查與所得到的靜態庫:

nm libDexample.a 

這表明,在上述主瑣碎插入額外符號插入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一個鏈接。

相關問題