问题描述
我正在尝试遵循这些说明来编译BASIS(CMake使用MinGW-w64编译器在MSYS2上构建系统和软件实施标准).但是,ccmake ..
步骤失败:
I'm trying to follow these instructions to compile-install BASIS (CMake Build system And Software Implementation Standard) on MSYS2 using MinGW-w64 compilers. However, the ccmake ..
step fails:
我尝试按pacman -Ss ccmake
搜索MSYS2软件包,但没有结果.所以我认为我必须使用命令行cmake
代替:
I tried searching the MSYS2 packages by pacman -Ss ccmake
with no results. So I thought I have to use commandline cmake
instead:
cmake -DCMAKE_INSTALL_PREFIX:PATH=~/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON ..
失败者:
CMake Error at src/cmake/modules/ProjectTools.cmake:876 (message):
CMAKE_INSTALL_PREFIX must be an absolute path!
Call Stack (most recent call first):
src/cmake/modules/ProjectTools.cmake:2525 (basis_installtree_asserts)
src/cmake/modules/ProjectTools.cmake:2751 (basis_project_begin)
CMakeLists.txt:69 (basis_project_impl)
作为一种解决方法,我将~/local
更改为/home/<userName>/local
似乎可行.但是,我不知道MakeFile在哪里,原因是运行make .
时出现错误:
as a workaround I changed the ~/local
to /home/<userName>/local
which seem to be working. However, I don't know where the MakeFile(s) are, cause when running the make .
I get the error:
鉴于我在~/.bashrc
文件中有alias make='mingw32-make
.如果您能帮助我知道问题出在哪里以及如何解决,我将不胜感激.我已经安装了MSYS2-MinGW-w64软件包mingw64/mingw-w64-x86_64-cmake
.我的Windows版本是1909,MSYS_NT-10.0-18363是我的环境.
given that I have alias make='mingw32-make
in the ~/.bashrc
file. I would appreciate if you could help me know what is the problem and how I can solve it. I have the MSYS2-MinGW-w64 package mingw64/mingw-w64-x86_64-cmake
installed. My Windows is version 1909,and MSYS_NT-10.0-18363 is my environment.
P.S.1..现在,查看CMake的输出,我实际上发现了一个警告:
P.S.1. Looking at the CMake's output I now see that there is actually a warning:
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
这个项目有点讽刺,但是我不确定这是否是编译失败的原因.
which is a bit ironic for this project, but I am not sure if this is the reason why the compiling fails.
P.S.2..我安装了mingw64/mingw-w64-x86_64-cmake
软件包,但没有ccmake
工具.但是msys/cmake
可以.所以:
P.S.2. I had the mingw64/mingw-w64-x86_64-cmake
package installed, which doesn't have the ccmake
tool. But the msys/cmake
does. So:
-
pacman -R mingw-w64-x86_64-cmake
-
pacman -S msys/cmake
pacman -R mingw-w64-x86_64-cmake
pacman -S msys/cmake
现在ccmake
可用.
推荐答案
好的,我认为我通过使用MSVC编译器找到了一个临时解决方法:
OK, I think I found a temporary workaround by using the MSVC compilers:
-
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<userName>/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON .. -G "Visual Studio 15 2017 Win64"
-
cmake --build . --config release --target install
- 可执行文件为
~/local/Bin/basisproject.cmd
,文件扩展名奇怪,但似乎可以正常工作!
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<userName>/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON .. -G "Visual Studio 15 2017 Win64"
cmake --build . --config release --target install
- the executable is
~/local/Bin/basisproject.cmd
which has a bizzare file extention but seem to be working!
这篇关于使用MinGW-w64在MSYS2上编译BASIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!