2011-11-24 63 views
1

我一直在試圖讓Qt 4.7.3與最新的Botan v1.10.1庫一起工作。Qt不適用於Botan_v1.10.1庫

有一個用於Windows的Botan二進制文件,但似乎* .dll文件僅適用於MS Visual Studio。 所以我試着用mingw32編譯Botan,這樣我就可以得到Qt兼容的* .dll和* .a文件。

部分附加信息:
-Windows 7 64bit。
- 以32bit模式編譯。
-Qt是最新的一切,效果很好,安裝在32位模式。
-Botan對於x86 Windows爲v1.10.1。

我打開Qt命令提示符併發出以下命令。

configure.py --cc=gcc --cpu=x86 

該命令生成了一個Makefile。

然後我解僱了這個命令。

mingw32-make 

該命令在運行幾分鐘後會生成以下錯誤。

C:\Botan-1.10.1\src\utils\time.cpp: In function 'tm Botan::::do_gmtime(time_t)': C:\Botan-1.10.1\src\utils\time.cpp:55: error: 'gmtime_s' was not declared in this scope mingw32-make: * [build\lib\time.obj] Error 1

我打開C:\牡丹-1.10.1的\ src \ utils的\ time.cpp和改變了這種

#if defined(BOTAN_TARGET_OS_HAS_GMTIME_S) 
    gmtime_s(&tm, &time_val); // Windows 
#elif defined(BOTAN_TARGET_OS_HAS_GMTIME_R) 
    gmtime_r(&time_val, &tm); // Unix/SUSv2 
#else 
    std::tm* tm_p = std::gmtime(&time_val); 
    if (tm_p == 0) 
     throw Encoding_Error("time_t_to_tm could not convert"); 
    tm = *tm_p; 
#endif 

這個

/*#if defined(BOTAN_TARGET_OS_HAS_GMTIME_S) 
    gmtime_s(&tm, &time_val); // Windows 
#elif defined(BOTAN_TARGET_OS_HAS_GMTIME_R) 
    gmtime_r(&time_val, &tm); // Unix/SUSv2 
#else*/ 
    std::tm* tm_p = std::gmtime(&time_val); 
    if (tm_p == 0) 
     throw Encoding_Error("time_t_to_tm could not convert"); 
    tm = *tm_p; 
//#endif 

然後我跑MINGW32-MAK​​E再次。這次它編譯更多,並陷入這個錯誤。

C:\Botan-1.10.1>mingw32-make process_begin: CreateProcess(NULL, rm -f libbotan-1.10.a, ...) failed. make (e=2): The system cannot find the file specified. mingw32-make: * [libbotan-1.10.a] Error 2

我不能超越這個錯誤。任何幫助將不勝感激。

回答

1

您可以從Qt Creator源代碼樹中提取botan,並使用qmake和gcc構建它。

或者,使用MinGW-w64的gendef或MinGW.org等價物從DLL生成一個.def文件,並使用dlltool創建一個導入庫。

+0

謝謝,我對你提出的概念很陌生。關於第二個建議,我有一些問題。 (1)當你的意思是* .dll文件是指你的二進制安裝的Botan for Windows附帶的* .dll文件嗎? (2)從* .dll生成一個* .def文件,我可以依賴或依賴它? – L123

+0

(1)是的,我的意思是預構建的DLL。 (2)一般來說,是的,有一些角落的情況,但我懷疑你會用像Botan這樣的開源庫打這些。 – rubenvb

+0

Mingw-w64 gendef似乎不想在Windows上編譯。 – L123