c++ - 在Windows上使用MinGW构建mysql-connector-c++-8.0.17-src

标签 c++ windows cmake mysql-connector mingw-w64

成功通过CMake(CMake-3.12.3)后,配置步骤如下:

cmake.exe ..\mysql-connector-c++-8.0.17-src -G "MinGW Makefiles" -DBUILD_STATIC=ON

我被困在:
cmake.exe --build . --config Debug

这给了我:
[  2%] Built target save_linker_opts
[  3%] Building CXX object uuid/src/CMakeFiles/uuid_gen.dir/uuid_gen.cc.obj
D:\Daten\LiDoSourcen\mysql-connector-c++-8.0.17-src\cdk\extra\uuid\src\uuid_gen.cc:46:26: error: conflicting declaration 'typedef CRITICAL_SECTION pthread_mutex_t'
   46 | typedef CRITICAL_SECTION pthread_mutex_t;
      |                          ^~~~~~~~~~~~~~~
In file included from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr-default.h:35,
                 from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr.h:148,
                 from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/ext/atomicity.h:35,
                 from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/bits/basic_string.h:39,
                 from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/string:55,
                 from D:/Daten/Portable/MinGw-msys64/mingw64/include/c++/9.2.0/stdexcept:39,
                 from D:\Daten\LiDoSourcen\mysql-connector-c++-8.0.17-src\cdk\extra\uuid\src\uuid_gen.cc:40:
D:/Daten/Portable/MinGw-msys64/mingw64/x86_64-w64-mingw32/include/pthread.h:271:18: note: previous declaration as 'typedef intptr_t pthread_mutex_t'
  271 | typedef intptr_t pthread_mutex_t;
      |                  ^~~~~~~~~~~~~~~

结果是。

我昨天更新了MinGW / msys2环境,因此我应该拥有最新版本的编译器。

我查看了两个位置,但找不到任何明显的#define或可用于正确编译的内容。

有任何提示或疑问吗?

最佳答案

我能够使用untrunc在Windows上构建mingw-w64
安装mingw-w64时,它会询问您首选的线程模型,您可以更改该模型。

Windows构建成功。在用cygwin安装所有软件包之后,我随后安装了NASMYASM并将其路径添加到环境变量PATH中。

然后我使用MinGW使用以下命令构建了libav-12.3:

./configure --enable-pthreads --enable-shared

然后使用cygwin运行make命令。

关于c++ - 在Windows上使用MinGW构建mysql-connector-c++-8.0.17-src,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58134331/

相关文章:

c++ - 为什么在eclipse CDT 编辑器中断点用反斜杠标记?

java - 如何在 Java 9 统一日志记录中使用带冒号的 Windows 文件名?

windows - 如何在 Windows 上执行校验和?

android - CMake 构建失败,因为找不到 STL 库

c++ - 如何部署具有所有依赖项的 C++ 项目?

c++ - 如何在 boost 日期时间中忽略周末和假期?

c++ - pthread_create() 和 pthread_join() 函数不能在同一循环中工作

CMake - 用于单个库的 BUILD_SHARED_LIBS

c# - I/O 操作的 .NET 基于事件的异步模式是否会阻塞底层线程?

c - GCC/SDL2 无限期挂起并停止响应