使用 Homebrew 在 macOS Big Sur 11.5.1 上编译 FreeCAD,查找 XercesC 文件时出错

短剑

我一直在 macOS Big Sur 上编译 FC。构建因未找到某些 XercesC 库的错误而中断。但是这些库是安装的,CMake 准备过程甚至会找到路径。

我在https://forum.freecadweb.org/viewtopic.php?f=4&t=60663下的 FreeCAD 论坛中发布了这个问题,但没有找到任何帮助。如果 StackOverflow 上的任何人都可以验证此错误或更好地提供解决方案的提示,我将不胜感激。提前致谢。

系统信息:

构建过程的完整步骤:

# install freecad dependencies via homebrew
brew tap freecad/freecad
brew install eigen
brew install --only-dependencies freecad --with-packaging-utils

# Freecad source is located in folder freecad-source/
# setup the build folder and change into newly created folder
mkdir -p freecad-build
cd freecad-build

# export path to installed dependencies
export PREFIX_PATH="\
/usr/local/opt/qt5152/lib/cmake;\
/usr/local/opt/nglib/Contents/Resources;\
/usr/local/opt/[email protected]/lib/cmake;\
/usr/local/opt/[email protected]/lib/cmake;\
/usr/local/opt/med-file/share/cmake;\
/usr/local/opt/shiboken2/lib/cmake;\
/usr/local/opt/pyside2/lib/cmake;\
/usr/local/opt/[email protected];\
/usr/local/opt/[email protected]/lib/cmake;\
/usr/local/opt/[email protected]/lib/cmake"

# initiate build instructions
cmake \
  -DCMAKE_INSTALL_LIBDIR=lib \
  -DCMAKE_BUILD_TYPE="Release" \
  -DCMAKE_FIND_FRAMEWORK=LAST \
  -DCMAKE_VERBOSE_MAKEFILE=OFF \
  -Wno-dev \
  -DBUILD_TESTING=OFF \
  -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk \
  -DBUILD_QT5=ON \
  -DUSE_PYTHON3=1 \
  -DCMAKE_CXX_STANDARD=14 \
  -DBUILD_ENABLE_CXX_STD:STRING=C++14 \
  -DBUILD_FEM_NETGEN=1 \
  -DBUILD_FEM=1 \
  -DBUILD_FEM_NETGEN:BOOL=ON \
  -DBUILD_WEB=ON \
  -DFREECAD_USE_EXTERNAL_KDL=ON \
  -DPYTHON_EXECUTABLE=/usr/local/opt/python3.9/bin/python3 \
  -DPYTHON_INCLUDE_DIR=/usr/local/opt/python3.9/Frameworks/Python.framework/Headers \
  -DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
  -DFREECAD_CREATE_MAC_APP=1 \
  -DCMAKE_INSTALL_PREFIX="./.." \
  ../freecad-source

CMake 过程以以下摘要报告成功结束。注意这里,XercesC 可以在 -- XercesC: 3.2.3 [/usr/local/lib/libxerces-c.dylib] [/usr/local/include] 下正确找到:

-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiler: AppleClang, version: 12.0.5.12050022
-- Looking for GL/gl.h
-- Looking for GL/gl.h - not found
-- Looking for C++ include istream
-- Looking for C++ include istream - found
-- Looking for C++ include ostream
-- Looking for C++ include ostream - found
-- Looking for C++ include fstream
-- Looking for C++ include fstream - found
-- Looking for C++ include sstream
-- Looking for C++ include sstream - found
-- Looking for C++ include ios
-- Looking for C++ include ios - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Looking for C++ include iomanip
-- Looking for C++ include iomanip - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Check for STD namespace
-- Check for STD namespace - found
-- Force BOOST_PP_VARIADICS=1 for clang
-- prefix: /Users/dirkolbrich/Freecad
-- bindir: bin
-- datadir: share
-- docdir: share/doc/FreeCAD
-- includedir: include
-- libdir: lib
-- cmake: 3.21.1
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
=====================================================
Doxygen not found, will not build documentation.
=====================================================

-- Detected Homebrew install at /usr/local
-- Found Python3: /usr/local/bin/python3.9 (found version "3.9.6") found components: Interpreter Development Development.Module Development.Embed
-- Found XercesC: /usr/local/lib/libxerces-c.dylib (found version "3.2.3")
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libz.tbd (found version "1.2.11")

# lots of other setup stuff deleted for clarity
#
#

==============
Summary report
==============

-- Build type:          Release
-- Compiler:            /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ (12.0.5.12050022)
-- Flags:               -Wall -Wextra -Wpedantic -Wno-write-strings  -Wno-undefined-var-template
-- Standard:            Requires C++14
-- Python:              3.9.6 [/usr/local/bin/python3.9] [.cpython-39-darwin]
-- PCL:                 not enabled
-- pybind11:            not enabled
-- Boost:               1.75.0 (1.75.0)
-- XercesC:             3.2.3 [/usr/local/lib/libxerces-c.dylib] [/usr/local/include]
-- ZLIB:                1.2.11
-- PyCXX:               6.2.8 [/Users/dirkolbrich/Freecad/freecad-source/src]
-- OCC:                 7.5.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/local/opt/[email protected]/lib] [/usr/local/opt/[email protected]/include/opencascade]
-- SMESH:               build internal
--  MEDFile:            4.0.0 [/usr/local/lib/libmedC.dylib;/usr/local/lib/libmed.dylib] [/usr/local/include]
--  HDF5:               1.12.1
--  VTK:                8.2.0
-- NETGEN:              6.2.2101 (6.2.2101) [-DNO_PARALLEL_THREADS;-DOCCGEOMETRY;-DNETGEN_VERSION=395829] [] [/usr/local/opt/nglib/Contents/Resources/include/include;/usr/local/opt/nglib/Contents/Resources/include] [nglib] [/usr/local/opt/nglib/Contents/Resources/include/include;/usr/local/opt/nglib/Contents/Resources/include]
-- SWIG:                4.0.2
-- Eigen3               3.3.9
-- Qt5Core:             5.15.2
-- Qt5Network:          5.15.2
-- Qt5Xml:              5.15.2
-- Qt5XmlPatterns:      5.15.2
-- Qt5Widgets:          5.15.2
-- Qt5PrintSupport:     5.15.2
-- Qt5OpenGL:           5.15.2
-- Qt5Svg:              5.15.2
-- Qt5UiTools:          5.15.2
-- Qt5Concurrent:       5.15.2
-- Qt5WebEngineWidgets: 5.15.2
-- Shiboken2:           5.15.2 [/usr/local/opt/shiboken2/lib/cmake/Shiboken2-5.15.2] [/usr/local/opt/shiboken2/include/shiboken2;/usr/local/opt/python3.9/Frameworks/Python.framework/Headers]
-- PySide2:             5.15.2 [/usr/local/opt/pyside2/include/PySide2]
-- PySide2Tools:        [/usr/local/bin/uic] [/usr/local/bin/rcc]
-- Freetype:            2.11.0
-- OpenGL:              /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework
-- OpenGLU:             [/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework][/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework]
-- Coin3D:              4.0.0 [/usr/local/opt/[email protected]/lib/libCoin.dylib] [/usr/local/opt/[email protected]/include]
-- Pivy:                0.6.5
-- SPNAV:               [SPNAV_LIBRARY-NOTFOUND] [SPNAV_INCLUDE_DIR-NOTFOUND]
-- Matplotlib:          2.1.1
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             not found
=================================================
Now run 'cmake --build /Users/dirkolbrich/Freecad/freecad-build' to build FreeCAD
=================================================

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/dirkolbrich/Freecad/freecad-build

现在我通过以下步骤开始构建过程:

# set path to icu4c
# see https://forum.freecadweb.org/viewtopic.php?p=507588#p507588
export LIBRARY_PATH="/usr/local/opt/icu4c/lib"

#start the build according to the last line of the cmake summary report
cmake --build /Users/dirkolbrich/freecad/freecad-build/release

在完成之前不久的构建错误,错误是找不到 XercesC 库文件:

[ 91%] Building CXX object src/Mod/Measure/App/CMakeFiles/Measure.dir/AppMeasure.cpp.o
In file included from /Users/dirkolbrich/freecad/freecad-source/src/Mod/Measure/App/AppMeasure.cpp:32:
In file included from /Users/dirkolbrich/freecad/freecad-source/src/Mod/Measure/App/Measurement.h:29:
In file included from /Users/dirkolbrich/freecad/freecad-source/src/App/DocumentObject.h:28:
In file included from /Users/dirkolbrich/freecad/freecad-source/src/App/TransactionalObject.h:27:
In file included from /Users/dirkolbrich/freecad/freecad-source/src/App/ExtensionContainer.h:33:
/Users/dirkolbrich/freecad/freecad-source/src/Base/Reader.h:32:10: fatal error: 'xercesc/framework/XMLPScanToken.hpp' file not found
#include <xercesc/framework/XMLPScanToken.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/Mod/Measure/App/CMakeFiles/Measure.dir/AppMeasure.cpp.o] Error 1
make[1]: *** [src/Mod/Measure/App/CMakeFiles/Measure.dir/all] Error 2
make: *** [all] Error 2

/usr/local/include/xercesc/framework/XMLPScanToken.hpp根据汇总报告,未找到的文件存在于指定路径下并手动验证。

即使添加-DXERCESC_INCLUDE_DIR=/usr/include/xercesc到 cmake 命令也无济于事。

构建脚本中有一个错字。最终报告打印XercesC_INCLUDE_DIRS,但的CMakeLists.txt该子目录用途XERCESC_INCLUDE_DIR

我建议您修复拼写错误 (to XercesC_INCLUDE_DIRS)src/Mod/Measure/App/CMakeLists.txt并提交拉取请求。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Homebrew在MacOS Big Sur上失败

在macOS 11.0 Big Sur上安装Pyobjc时出错

如何在 MacOS 11 Big Sur 上安装 brew httpd?

Macbook Pro 2020 M1 - MacOS Big Sur - Homebrew 不工作

在MacOS Big Sur(M1芯片)上安装自制软件时收到警告

是否可以在最新的macOS Big Sur上使用Xcode 11.5?

在Big Sur上使用Perlbrew安装Perl时出错

在MacOS Big Sur上安装jupyterlab / jupyter笔记本时出错

使用MinGW安装XercesC时出错

macOS Big Sur 上的 PHP 文件读取错误

Homebrew不会安装在Big Sur(OS X 11.1)(M1)上

如何使用 Python 3.9.5 重命名 MacOS Big Sur 11.4 上的文件,而不是批处理或顺序,使用列表/CSV 文件?

macOS Big Sur Beta上的AndroidStudio崩溃

无法在 macOS Big Sur 上安装 pyarrow

在 MacOS Big Sur 上安装 Dagster

在 macOS Big Sur 上安装 PyOpenGL

在 macOS Big Sur 上的 git 控制目錄中使用 atom 編輯器重命名文件

是否可以在macOS Big Sur中运行Xcode11?

无法在 macOS Big Sur (Apple M1) 上保护 MariaDB 安装

GraalVM 在 macOS Big Sur (Apple m1) 上安装失败

无法在 Solaris 的最新编译器中使用带有新 c+11 标志的 xercesc

Build Failure:如何使用Pyenv在macOS Big Sur 11.0.1版上安装Python 3.8.3?

在 Big Sur 上使用 nix 构建 PostgreSQL 12 时出错:“stdio.h not found”

使用 Homebrew M1 本机安装 MySQL 时出错

在 MacOS Big Sur 上导出到 $JAVA_HOME 时出现权限错误

在macOS Sierra上使用apt时出错

无法在macOS Sierra上使用Homebrew安装PHP 7

gsed:使用Homebrew在macOS上找不到命令

如何使用Homebrew在macOS Mojave(10.14)上安装Valgrind?