0

我正在尝试从源代码构建 OpenCascade。我正在使用本指南: https ://github.com/tpaviot/oce/blob/master/BUILD.MINGWw64.md

1-5 的所有步骤,包括下载内容都已执行。现在我正在尝试使用 CMAKE 构建

*我使用“源代码在哪里”选项指向 oce 的目录(按照说明)。*我使用“在哪里构建二进制文件”选项,将我命名为“BUILD”的文件夹指向上述步骤中提到的目录内(按照说明)。*我按下“配置”并使用默认的本机编译器选择“MSYS Makefiles”。

这里开始了错误。我注意到 CMake 生成了一个文本文件,所以我进入并更改了 CMAKE MAKE 位置:CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin

我继续前进,但产生了新的错误。

那么我该如何前进呢?

然后指南说:“检查 OCE_USE_BUNDLE_SOURCE 检查 OCE_WITH_FREEIMAGE 检查 OCE_WITH_GL2PS 检查 OCE_VISUALISATION”

我在哪里设置这些?文本文件中没有这样的变量,我也不能在 CMAKE 上设置它们。

编辑:这些是我现在得到的错误:

The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_a5bfb/fast && 
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast && 
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast && Access is denied
    Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast && 
    

  

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


Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".

编辑 2:CMake 中有一些空选项:

在此处输入图像描述

编辑 3:在听从 Tsyvarev 的建议后,我将线路改为

CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin/make.exe

这些是我得到的错误:

 The C compiler identification is GNU 8.1.0
    The CXX compiler identification is GNU 8.1.0
    Detecting C compiler ABI info
    CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_51dc6/fast && 
    Detecting C compiler ABI info - failed
    Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
    CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast && 
    Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
    CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
      The C compiler
    
        "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"
    
      is not able to compile a simple test program.
    
      It fails with the following output:

    Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast && Access is denied
    Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast && 
    

  

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


Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".
4

1 回答 1

0

以下是我使用 Ninja 在 MSYS2 下从http://www.opencascade.com/content/latest-release构建 OpenCascade 7.4.0(静态+共享)的方法:

INSTALLPREFIX=/usr/local
mkdir -p build_static build_shared &&
 cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_LIBRARY_TYPE:STRING=Static -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_static &&
 cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_LIBRARY_TYPE:STRING=Shared -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_shared &&
 sed -i.bak -e "s/LINK_LIBRARIES *= *[^ ]*libTKTopAlgo\.dll\.a.*-lfreetype.*libTKernel\.dll\.a.*$/& -Wl,--as-needed -lz -lbz2 -lharfbuzz -lpng -lbrotlidec/" build_shared/build.ninja &&
 ninja -Cbuild_static install/strip &&
 ninja -Cbuild_shared install/strip &&
 echo Success
于 2020-08-13T10:48:53.090 回答