2011-11-24 68 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