1

我一直在尝试让 Qt 4.7.3 与最新的 Botan v1.10.1 库一起使用。

有一个适用于 Windows 的 Botan 二进制文件,但似乎 *.dll 文件仅适用于 MS Visual Studio。所以我尝试用 mingw32 编译 Botan,这样我就可以获得与 Qt 兼容的 *.dll 和 *.a 文件。

一些额外信息:
-Windows 7 64 位。
- 尝试在 32 位模式下编译。
-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:在函数'tm Botan::::do_gmtime(time_t)'中:C:\Botan-1.10.1\src\utils\time.cpp:55 : 错误: 'gmtime_s' 未在此范围内声明 mingw32-make: * [build\lib\time.obj] 错误 1

我打开 C:\Botan-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-make。这次它编译了更多并陷入了这个错误。

C:\Botan-1.10.1>mingw32-make process_begin: CreateProcess(NULL, rm -f libbotan-1.10.a, ...) 失败。make (e=2): 系统找不到指定的文件。mingw32-make: * [libbotan-1.10.a] 错误 2

我无法超越这个错误。任何帮助将不胜感激。

4

1 回答 1

1

您可以从 Qt Creator 源代码树中提取 botan 并使用 qmake 和您的 gcc 来构建它。

或者,使用 MinGW-w64 的 gendef 或 MinGW.org 等效项从 DLL 生成 .def 文件,并使用 dlltool 创建导入库。

于 2011-11-24T18:59:34.880 回答