在Windows 7下使用mingw-w64-x86_64 gcc工具链的cmake错误:“这个程序是在没有插件支持的情况下构建的”

时间:2021-06-01 01:51:29

I have a setup with Windows 7, MSYS2, Mingw-w64-x86_64 gcc toolchain, CMake, and I am trying to build the nanomsg library.

我有一个安装Windows 7, MSYS2, Mingw-w64-x86_64 gcc工具链,CMake,我正在尝试构建nanomsg库。

Here is what I obtain :

以下是我得到的:

$ cmake --debug-trycompile -DCMAKE_TOOLCHAIN_FILE=../toolchain_i686-pc-mingw32.cmake -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 -G "MinGW Makefiles" ../nanomsg

cmake美元——debug-trycompile -DCMAKE_TOOLCHAIN_FILE = . . / toolchain_i686-pc-mingw32。cmake -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 -G“MinGW makefile”./nanomsg。

debug trycompile on

-- The C compiler identification is GNU 4.8.2 -- Check for working C compiler: C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe -- Check for working C compiler: C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe -- broken CMake Error at C:/cmake-win32-x86/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe" is not able to compile a simple test program.

——C编译器标识是GNU 4.8.2——检查工作C编译器:C:/mingw64/bin/x86_64-w64-mingw32-gcc。exe——检查工作C编译器:C:/mingw64/bin/x86_64-w64-mingw32-gcc。exe——在C:/ CMake -win32-x86/共享/CMake -2.8/ cmaketestc编译器中出错的CMake错误。cmake:61(消息):C编译器C:/mingw64/bin/x86_64-w64-mingw32-gcc。exe不能编译一个简单的测试程序。

It fails with the following output:

它的输出如下:

Change Dir: C:/msys64/home/Laurent/Dev/nanomsg-build/CMakeFiles/CMakeTmp

改变Dir:C:/ msys64 / home / Laurent / Dev / nanomsg-build / CMakeFiles / CMakeTmp

Run Build Command:C:/mingw64/bin/mingw32-make.exe
"cmTryCompileExec910276652/fast"

运行构建命令:C:/ mingw64 / bin / mingw32-make。exe”cmTryCompileExec910276652 /快”

C:/mingw64/bin/mingw32-make.exe -f
CMakeFiles\cmTryCompileExec910276652.dir\build.make
CMakeFiles/cmTryCompileExec910276652.dir/build

C:/ mingw64 / bin / mingw32-make。exe - f CMakeFiles \ cmTryCompileExec910276652.dir \构建。使CMakeFiles / cmTryCompileExec910276652.dir /构建

mingw32-make.exe1: Entering directory
'C:/msys64/home/Laurent/Dev/nanomsg-build/CMakeFiles/CMakeTmp'

mingw32-make。exe1:进入目录C:/ msys64 / home / Laurent / Dev / nanomsg-build / CMakeFiles CMakeTmp”

C:\cmake-win32-x86\bin\cmake.exe -E cmake_progress_report
C:\msys64\home\Laurent\Dev\nanomsg-build\CMakeFiles\CMakeTmp\CMakeFiles 1

C:\ cmake-win32-x86 \ bin \ cmake。exe -E cmake_progress_report C:\msys64\ msys64\ \ \ \ \ \ \ \ \ * * * * * * * * * * * * * * * * * * * * * * * * *

Building C object
CMakeFiles/cmTryCompileExec910276652.dir/testCCompiler.c.obj

构建C对象CMakeFiles / cmTryCompileExec910276652.dir / testCCompiler.c.obj

C:\mingw64\bin\x86_64-w64-mingw32-gcc.exe -o
CMakeFiles\cmTryCompileExec910276652.dir\testCCompiler.c.obj -c
C:\msys64\home\Laurent\Dev\nanomsg-build\CMakeFiles\CMakeTmp\testCCompiler.c

C:\ mingw64 \ bin \ x86_64-w64-mingw32-gcc。exe - o CMakeFiles \ cmTryCompileExec910276652.dir \ testCCompiler.c。obj - C C:\ msys64 \家庭\ Laurent \开发\ nanomsg-build \ CMakeFiles \ CMakeTmp \ testCCompiler.c

Linking C executable cmTryCompileExec910276652.exe

连接C可执行cmTryCompileExec910276652.exe

C:\cmake-win32-x86\bin\cmake.exe -E cmake_link_script
CMakeFiles\cmTryCompileExec910276652.dir\link.txt --verbose=1

C:\ cmake-win32-x86 \ bin \ cmake。exe - e cmake_link_script CMakeFiles \ cmTryCompileExec910276652.dir \链接。txt - verbose = 1

C:\cmake-win32-x86\bin\cmake.exe -E remove -f
CMakeFiles\cmTryCompileExec910276652.dir/objects.a

C:\ cmake-win32-x86 \ bin \ cmake。exe -E删除-f cmakefile \cmTryCompileExec910276652.dir/objects.a。

x86_64-w64-mingw32-gcc-ar cr
CMakeFiles\cmTryCompileExec910276652.dir/objects.a
@CMakeFiles\cmTryCompileExec910276652.dir\objects1.rsp

x86_64-w64-mingw32-gcc-ar cr CMakeFiles \ cmTryCompileExec910276652.dir /对象。一个@CMakeFiles \ cmTryCompileExec910276652.dir \ objects1.rsp

sorry - this program has been built without plugin support

对不起——这个程序是在没有插件支持的情况下构建的。

CMakeFiles\cmTryCompileExec910276652.dir\build.make:91: recipe for target 'cmTryCompileExec910276652.exe' failed

CMakeFiles \ cmTryCompileExec910276652.dir \构建。制作:91:目标“cmTryCompileExec910276652”的配方。exe”失败

mingw32-make.exe1: * [cmTryCompileExec910276652.exe] Error 1

mingw32-make。(cmTryCompileExec910276652 exe1:*。exe]错误1

mingw32-make.exe1: Leaving directory
'C:/msys64/home/Laurent/Dev/nanomsg-build/CMakeFiles/CMakeTmp'

mingw32-make。exe1:离开目录C:/ msys64 / home / Laurent / Dev / nanomsg-build / CMakeFiles CMakeTmp”

Makefile:116: recipe for target 'cmTryCompileExec910276652/fast' failed

Makefile:116:目标“cmTryCompileExec910276652/fast”的配方失败。

mingw32-make.exe: * [cmTryCompileExec910276652/fast] Error 2

mingw32-make。exe: * [cmTryCompileExec910276652/快]错误2。

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:29 (project)

CMake不能正确地生成这个项目。调用堆栈(最近的调用):CMakeLists。txt:29(项目)

Here is my toolchain file:

这是我的工具链文件:

$ cat ../toolchain_i686-pc-mingw32.cmake
# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
# http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=8959
# http://*.com/questions/19754316/cross-compiling-opencv-with-mingw-using-cmakein-linux-for-windows

# this one is important
SET(CMAKE_SYSTEM_NAME Windows)
#this one not so much
#SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(PREFIX x86_64-w64-mingw32)
SET(CMAKE_MAKE_PROGRAM mingw32-make)
SET(CMAKE_C_COMPILER   ${PREFIX}-gcc)
SET(CMAKE_CXX_COMPILER ${PREFIX}-g++)
SET(CMAKE_AR ${PREFIX}-gcc-ar)
SET(CMAKE_NM ${PREFIX}-gcc-nm)
SET(CMAKE_RC_COMPILER  windres)

# specify the cross linker
SET(CMAKE_RANLIB ${PREFIX}-gcc-ranlib)

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/mingw64 /usr/${PREFIX})

# search for programs in the build host directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

It looks like it fails to build on an auto test because the toolchain misses plugin support.

看起来它没有在自动测试中建立,因为工具链会错过插件支持。

Here is my gcc version and options:

下面是我的gcc版本和选项:

$ /opt/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v
Using built-in specs.
COLLECT_GCC=C:\mingw64\bin\x86_64-w64-mingw32-gcc.exe
COLLECT_LTO_WRAPPER=C:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw482/x86_64-482-posix-seh-rt_v3-rev3/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --with-cloog=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-posix-seh-rev3, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw482/x86_64-482-posix-seh-rt_v3-rev3/mingw64/opt/include -I/c/mingw482/prerequisites/x86_64-zlib-static/include -I/c/mingw482/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw482/x86_64-482-posix-seh-rt_v3-rev3/mingw64/opt/include -I/c/mingw482/prerequisites/x86_64-zlib-static/include -I/c/mingw482/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw482/x86_64-482-posix-seh-rt_v3-rev3/mingw64/opt/lib -L/c/mingw482/prerequisites/x86_64-zlib-static/lib -L/c/mingw482/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 4.8.2 (x86_64-posix-seh-rev3, Built by MinGW-W64 project)
  1. Is it related to the "--enable-plugin" option (missing in my gcc) ?
  2. 它是否与“-enable-plugin”选项(在我的gcc中丢失)有关?
  3. Is there somewhere a toolchain build available with this option set ? I looked for it in MSYS2, Mingw-w64, rubenvb repositories, but it is not there. Or shall I build it myself ?
  4. 是否有某个工具链构建可用此选项集?我在MSYS2, Mingw-w64, rubenvb存储库中寻找它,但它不在那里。还是我自己造?
  5. Possibly nanomsg does not need it ? Does the autotest requires it because nanomsg needs it ? Or can I prevent this autotest from being run ? Or can I set something to avoid the need of the "--enable-plugins" option ?
  6. 可能nanomsg不需要它?autotest是否需要它,因为nanomsg需要它?或者我可以阻止这个自动测试运行吗?或者我可以设置一些东西以避免“——插件”选项的需要吗?

1 个解决方案

#1


2  

I think you are using the MSYS2 shell here, and not MSYS2 itself. If you were using an up to date MSYS2 then you'd be using the following mingw-w64 x86_64 GCC:

我认为你使用的是MSYS2 shell,而不是MSYS2本身。如果您使用的是最新的MSYS2,那么您将使用下面的mingw-w64 x86_64 GCC:

$ pacman -Ss mingw-w64-x86_64-gcc
mingw64/mingw-w64-x86_64-gcc 4.9.1-6

$ PATH=/mingw64/bin:$PATH gcc -v
Configured with: ... --enable-lto ...

--enable-lto implies --enable-plugins which is the default now and so doesn't appear in the list.

——enable-lto暗示——现在是默认的启用插件,所以不会出现在列表中。

To build nanomsg with MSYS2, install https://master-dl.sourceforge.net/project/msys2/Base/x86_64/msys2-x86_64-20141003.exe, untick "Run MSYS2 shell now" (you want a mingw-w64 shell instead). Run the mingw-w64 shell (Start->MSYS2 64Bit->MinGW-w64 Win64 Shell). From within that shell:

要用MSYS2构建nanomsg,请安装https://master-dl.sourceforge.net/project/msys2/Base/x86_64/msys2-x86_64-20141003.exe, untick“现在运行MSYS2 shell”(您需要一个mingw-w64 shell)。运行mingw-w64外壳(启动->MSYS2 64位-> mingw-w64 Win64外壳)。从内部壳:

$ pacman -S git make mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
$ git clone https://github.com/nanomsg/nanomsg.git
$ mkdir nanomsg-build
$ cd nanomsg-build
$ cmake --debug-trycompile -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 -G "MSYS Makefiles" ../nanomsg
$ make install

But if you are a developer, we'd appreciate the contribution of a PKGBUILD for nanomsg

但是,如果您是一个开发人员,我们将感谢PKGBUILD对nanomsg的贡献。

#1


2  

I think you are using the MSYS2 shell here, and not MSYS2 itself. If you were using an up to date MSYS2 then you'd be using the following mingw-w64 x86_64 GCC:

我认为你使用的是MSYS2 shell,而不是MSYS2本身。如果您使用的是最新的MSYS2,那么您将使用下面的mingw-w64 x86_64 GCC:

$ pacman -Ss mingw-w64-x86_64-gcc
mingw64/mingw-w64-x86_64-gcc 4.9.1-6

$ PATH=/mingw64/bin:$PATH gcc -v
Configured with: ... --enable-lto ...

--enable-lto implies --enable-plugins which is the default now and so doesn't appear in the list.

——enable-lto暗示——现在是默认的启用插件,所以不会出现在列表中。

To build nanomsg with MSYS2, install https://master-dl.sourceforge.net/project/msys2/Base/x86_64/msys2-x86_64-20141003.exe, untick "Run MSYS2 shell now" (you want a mingw-w64 shell instead). Run the mingw-w64 shell (Start->MSYS2 64Bit->MinGW-w64 Win64 Shell). From within that shell:

要用MSYS2构建nanomsg,请安装https://master-dl.sourceforge.net/project/msys2/Base/x86_64/msys2-x86_64-20141003.exe, untick“现在运行MSYS2 shell”(您需要一个mingw-w64 shell)。运行mingw-w64外壳(启动->MSYS2 64位-> mingw-w64 Win64外壳)。从内部壳:

$ pacman -S git make mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
$ git clone https://github.com/nanomsg/nanomsg.git
$ mkdir nanomsg-build
$ cd nanomsg-build
$ cmake --debug-trycompile -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 -G "MSYS Makefiles" ../nanomsg
$ make install

But if you are a developer, we'd appreciate the contribution of a PKGBUILD for nanomsg

但是,如果您是一个开发人员,我们将感谢PKGBUILD对nanomsg的贡献。