How to build on macOS ARM?

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: How to build on macOS ARM?

Post by chennes »

I could use some help reviewing @oursland's PR, https://github.com/FreeCAD/FreeCAD/pull/9098 -- if anyone has time, could you please check it out on your system and give compiling and running from VS Code a try, and report back in that PR? Thanks!
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
oursland
Posts: 55
Joined: Sat Mar 11, 2023 9:33 pm

Re: How to build on macOS ARM?

Post by oursland »

@fpetzold I had the branch name incorrect, reflecting the older macOS-only version. The build instructions have been updated.

The current `conda-devenv` branch is suitable for Linux (x86_64), macOS, and Windows (dependencies-only), and the build and debug instructions are suitable for Linux and macOS.
JohnOCFII
Posts: 112
Joined: Sun Sep 20, 2020 5:46 pm
Location: Minnesota, USA

Re: How to build on macOS ARM?

Post by JohnOCFII »

I was able to successfully build and run FreeCAD following the instructions, including getting the debugger running from within VS Code. Also commented on the PR.

Code: Select all

OS: macOS 13.2
Word size of FreeCAD: 64-bit
Version: 0.21.0.32587 (Git)
Build type: Release
Branch: conda-devenv
Hash: 228ea5e11f6bef063a8469981f4f8244f12c3600
Python 3.11.0, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.2, OCC 7.6.3
Locale: English/United States (en_US)
fpetzold
Posts: 20
Joined: Tue Mar 28, 2023 1:48 pm

Re: How to build on macOS ARM?

Post by fpetzold »

I retried from scratch, but could not get it to build.

I used the exact same commit: 228ea5e11f6bef063a8469981f4f8244f12c3600


Error in compiling is:

Code: Select all

[build] [388/4124   9% :: 16.055] Linking CXX static library _deps/fmt-build/libfmt.a
[build] FAILED: _deps/fmt-build/libfmt.a 
[build] : && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E rm -f _deps/fmt-build/libfmt.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/ar qc _deps/fmt-build/libfmt.a  _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o _deps/fmt-build/CMakeFiles/fmt.dir/src/os.cc.o && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib _deps/fmt-build/libfmt.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E touch _deps/fmt-build/libfmt.a && :
[build] dyld[8971]: Library not loaded: '@rpath/libLLVM-14.dylib'
[build]   Referenced from: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/llvm-ar'
[build]   Reason: tried: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/usr/local/lib/libLLVM-14.dylib' (no such file), '/usr/lib/libLLVM-14.dylib' (no such file)
[build] /bin/sh: line 1:  8971 Abort trap: 6           /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib _deps/fmt-build/libfmt.a
[build] [388/4124   9% :: 16.057] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_draftlink.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_draftlink.py
[build] [388/4124   9% :: 16.058] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_label.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_label.py
[build] [388/4124   9% :: 16.058] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_layer.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_layer.py
[build] [388/4124   9% :: 16.062] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_dimension.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_dimension.py
[build] [388/4124   9% :: 16.063] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_point.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_point.py
[build] [388/4124   9% :: 16.064] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_rectangle.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_rectangle.py
[build] [388/4124   9% :: 16.067] Copying /Users/fpe/compile/FreeCAD/src/Mod/Draft/draftviewproviders/view_text.py to /Users/fpe/compile/FreeCAD/build/Mod/Draft/draftviewproviders/view_text.py
[build] [388/4124   9% :: 16.980] Building CXX object src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57Format.cpp.o
[build] [388/4124   9% :: 17.062] Building CXX object src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57XmlParser.cpp.o
[build] [388/4124   9% :: 17.207] Building CXX object src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/ReaderImpl.cpp.o
[build] [388/4124   9% :: 19.148] Building CXX object src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/WriterImpl.cpp.o
[build] ninja: build stopped: subcommand failed.
[proc] The command: /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake --build /Users/fpe/compile/FreeCAD/build --config Release --target all -- exited with code: 1
[build] Build finished with exit code 1
fpetzold
Posts: 20
Joined: Tue Mar 28, 2023 1:48 pm

Re: How to build on macOS ARM?

Post by fpetzold »

@oursland: I think it would also be useful to have instructions on building a release without VisualStudio Code.

I tried that as well, but it seems VS Code does additional magic that I don't understand.
oursland
Posts: 55
Joined: Sat Mar 11, 2023 9:33 pm

Re: How to build on macOS ARM?

Post by oursland »

@fpetzold the error you are seeing is most like due to a compiler misconfiguration, possibly because the conda environment may not be configured.

FreeCAD is a CMake build system project, so building should be relatively straightforward as long as the correct compilers are selected and the dependencies identified. Make sure to run conda activate freecad and double-check that the environment is selected with conda env list.

The CMake configuration command that is constructed by VSCode is:

Code: Select all

$PWD/.conda/freecad/bin/cmake \
    --no-warn-unused-cli \
    -DBUILD_WITH_CONDA:BOOL:STRING=ON \
    -DBUILD_DRAWING:STRING=ON \
    -DBUILD_FEM_NETGEN:BOOL:STRING=ON \
    -DFREECAD_USE_PYBIND11:BOOL:STRING=ON \
    -DFREECAD_USE_EXTERNAL_SMESH:BOOL:STRING=ON \
    -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
    -DCMAKE_BUILD_TYPE:STRING=Debug \
    -DCMAKE_C_COMPILER:FILEPATH=$PWD/.conda/freecad/bin/clang \
    -DCMAKE_CXX_COMPILER:FILEPATH=$PWD/.conda/freecad/bin/clang++ \
    -S$PWD -B$PWD/build -G Ninja
This command identifies the exact compilers to be used for the project.
fpetzold
Posts: 20
Joined: Tue Mar 28, 2023 1:48 pm

Re: How to build on macOS ARM?

Post by fpetzold »

Yes, it should, but it seems that it is not, for me.


As I have no reference to compare to for a working build, I paste my last steps below.

And, two days ago, with the old build instructions, I could at least complete compilation with VS Code. FreeCAD would not start, but I got closer than today.

Code: Select all

(freecad)fpe@callisto FreeCAD % conda env list
# conda environments:
#
freecad               *  /Users/fpe/compile/FreeCAD/.conda/freecad
base                     /opt/homebrew/Caskroom/mambaforge/base
(freecad)fpe@callisto FreeCAD % $PWD/.conda/freecad/bin/cmake \
    --no-warn-unused-cli \
    -DBUILD_WITH_CONDA:BOOL:STRING=ON \
    -DBUILD_DRAWING:STRING=ON \
    -DBUILD_FEM_NETGEN:BOOL:STRING=ON \
    -DFREECAD_USE_PYBIND11:BOOL:STRING=ON \
    -DFREECAD_USE_EXTERNAL_SMESH:BOOL:STRING=ON \
    -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
    -DCMAKE_BUILD_TYPE:STRING=Debug \
    -DCMAKE_C_COMPILER:FILEPATH=$PWD/.conda/freecad/bin/clang \
    -DCMAKE_CXX_COMPILER:FILEPATH=$PWD/.conda/freecad/bin/clang++ \
    -S$PWD -B$PWD/build -G Ninja
Not searching for unused variables given on the command line.
-- Compiler: Clang, version: 14.0.6
-- Force BOOST_PP_VARIADICS=1 for clang
-- prefix: /usr/local
-- bindir: bin
-- datadir: share
-- docdir: share/doc/FreeCAD
-- includedir: include
-- libdir: lib
-- cmake: 3.26.1
-- Compiling with Qt 5
-- Checking for connection to GitHub...
-- GitHub connection established for FetchContent
-- Module support is disabled.
-- Version: 9.1.0
-- Build type: Debug
-- CXX_STANDARD: 17
-- Required features: cxx_variadic_templates
-- fmt was downloaded using FetchContent into /Users/fpe/compile/FreeCAD/build/_deps/fmt-src
-- Found pybind11: /Users/fpe/compile/FreeCAD/.conda/freecad/include (found version "2.10.4")
-- PyCXX found:
--   Headers:  /Users/fpe/compile/FreeCAD/src
--   Sources:  /Users/fpe/compile/FreeCAD/src/CXX
--   Version:  7.1.7
-- -- Found OCE/OpenCASCADE version: 7.6.3
-- -- OCE/OpenCASCADE include directory: /Users/fpe/compile/FreeCAD/.conda/freecad/include/opencascade
-- -- OCE/OpenCASCADE shared libraries directory: /Users/fpe/compile/FreeCAD/.conda/freecad/lib
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework
CMake Deprecation Warning at .conda/freecad/lib/cmake/vtk-9.2/vtk-config.cmake:75 (message):
  The new name for the 'vtkCommonCore' component is 'CommonCore'
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake:29 (find_package)
  CMakeLists.txt:60 (SetupSalomeSMESH)


-- VTK components: CommonCore;CommonDataModel;FiltersVerdict;IOXML;FiltersCore;FiltersGeneral;IOLegacy;FiltersExtraction;FiltersSources;FiltersGeometry;hdf5;FiltersParallelDIY2;RenderingCore;InteractionStyle;RenderingFreeType;RenderingOpenGL2
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework  found components: OpenGL
-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
-- Could NOT find Netgen (missing: Netgen_DIR)
-- Cannot find NETGEN header files.
-- Cannot find NETGEN library.
-- Set up to compile with Qt 5.15.8
-- Could NOT find Spnav (missing: SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
-- Shiboken2Config: Using default python: .cpython-311-darwin
-- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/Users/fpe/compile/FreeCAD/.conda/freecad/include/python3.11'
-- SHIBOKEN_PYTHON_LIBRARIES computed to value: '-undefined dynamic_lookup'
-- libshiboken built for Release
-- PYTHON_CONFIG_SUFFIX: .cpython-311-darwin
-- libshiboken built for Release
-- PySide 5.15.8 Python module found at /Users/fpe/compile/FreeCAD/.conda/freecad/lib/python3.11/site-packages/PySide2.

-- Found Matplotlib: /Users/fpe/compile/FreeCAD/.conda/freecad/lib/python3.11/site-packages/matplotlib (found version "3.7.1")
-- Platform is 64-bit, set -D_OCC64
-- [E57] Revison ID: E57Format-2.2.1-arm64-darwin
-- [E57] Building static library
-- area module (for Path Workbench) will be installed to: lib
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- Performing Test _flag_found
-- Performing Test _flag_found - Success

   ==============
     System
   ==============

-- bindir:                      bin
-- BLAS:                        -undefined-
-- CMAKE_VERSION:               3.26.1
-- Compiler:                    /Users/fpe/compile/FreeCAD/.conda/freecad/bin/clang++ (14.0.6)
-- datadir:                     share
-- docdir:                      share/doc/FreeCAD
-- includedir:                  include
-- libdir:                      lib
-- prefix:                      /usr/local
-- Python:                      3.11.0 [/Users/fpe/compile/FreeCAD/.conda/freecad/bin/python3.11] Suffix: [.cpython-311-darwin]

   ==============
     Config
   ==============

-- BUILD_FEM:                   ON
-- BUILD_GUI:                   ON
-- BUILD_SMESH:                 ON
-- BUILD_START:                 ON
-- BUILD_TECHDRAW:              ON
-- BUILD_TEST:                  ON
-- BUILD_VR:                    OFF
-- BUILD_WEB:                   ON
-- CMAKE_BUILD_TYPE:            Debug
-- CMAKE_CXX_FLAGS:             -Wall -Wextra -Wpedantic -Wno-write-strings -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/fpe/compile/FreeCAD/.conda/freecad/include -Wno-undefined-var-template
-- CMAKE_CXX_STANDARD:          17
-- CMAKE_INSTALL_PREFIX:        /usr/local
-- CMAKE_PREFIX_PATH:           OFF
-- FREECAD_CREATE_MAC_APP:      OFF
-- FREECAD_LIBPACK_USE:         OFF
-- FREECAD_QT_VERSION:          Auto
-- FREECAD_USE_EXTERNAL_KDL:    OFF
-- FREECAD_USE_EXTERNAL_SMESH:  ON
-- FREECAD_USE_FREETYPE:        ON
-- FREECAD_USE_PYBIND11:        ON
-- PYTHON_EXECUTABLE:           /Users/fpe/compile/FreeCAD/.conda/freecad/bin/python3.11
-- PYTHON_LIBRARY:              /Users/fpe/compile/FreeCAD/.conda/freecad/lib/libpython3.11.dylib
-- USE_CUDA:                    -undefined-
-- USE_OPENCV:                  -undefined-

   ==============
     Libraries
   ==============

-- Boost:                       1.78.0
-- Coin3D:                      4.0.0 [/Users/fpe/compile/FreeCAD/.conda/freecad/lib/libCoin.dylib] [/Users/fpe/compile/FreeCAD/.conda/freecad/include]
-- Coin3D_DOC:                  not found
-- DesignerPlugin:              not built (BUILD_DESIGNER_PLUGIN is OFF)
-- Doxygen:                     1.9.6 Language: English
-- Eigen3:                      3.4.0
-- fmt:                         Sources downloaded to /Users/fpe/compile/FreeCAD/build/_deps/fmt-src
-- Freetype:                    2.12.1
-- Matplotlib:                  3.7.1 PathDirs: /Users/fpe/compile/FreeCAD/.conda/freecad/lib/python3.11/site-packages/matplotlib
-- NETGEN:                      not enabled
-- OCC:                         7.6.3 [/Users/fpe/compile/FreeCAD/.conda/freecad/lib] [/Users/fpe/compile/FreeCAD/.conda/freecad/include/opencascade]
-- OCC_Libs:                    [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat]
-- OpenGL_Lib:                  [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework]
-- OpenGLU_Incl:                [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework]
-- OpenGLU_Lib:                 [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework]
-- pivy:                        0.6.8
-- pybind11:                    2.10.4
-- PYCXX:                       7.1.7 Incl: /Users/fpe/compile/FreeCAD/src Src:/Users/fpe/compile/FreeCAD/src/CXX
-- PySide:                      5.15.8 [/Users/fpe/compile/FreeCAD/.conda/freecad/include/PySide2]
-- PySideTools:                 v: 2  uic: [/Users/fpe/compile/FreeCAD/.conda/freecad/bin/uic]  rcc: [/Users/fpe/compile/FreeCAD/.conda/freecad/bin/rcc]
-- QtConcurrent:                5.15.8
-- QtCore:                      5.15.8
-- QtNetwork:                   5.15.8
-- QtOpenGL:                    5.15.8
-- QtPrintSupport:              5.15.8
-- QtSvg:                       5.15.8
-- QtUiTools:                   5.15.8
-- QtWebEngineWidgets:          5.15.8
-- QtWidgets:                   5.15.8
-- QtXml:                       5.15.8
-- Rift:                        not enabled (BUILD_VR)
-- Shiboken:                    5.15.8 [/Users/fpe/compile/FreeCAD/.conda/freecad/include/shiboken2;/Users/fpe/compile/FreeCAD/.conda/freecad/include/python3.11]
-- SMESH:                       9.8.0.2
-- SPNAV:                       not found
-- SWIG:                        4.1.1
-- XercesC:                     3.2.4 [/Users/fpe/compile/FreeCAD/.conda/freecad/lib/libxerces-c.dylib] [/Users/fpe/compile/FreeCAD/.conda/freecad/include]
-- ZLIB:                        1.2.13

=================================================
Now run 'cmake --build /Users/fpe/compile/FreeCAD/build' to build FreeCAD
=================================================

-- Configuring done (12.0s)
-- Generating done (2.3s)
-- Build files have been written to: /Users/fpe/compile/FreeCAD/build
(freecad)fpe@callisto FreeCAD % cmake --build /Users/fpe/compile/FreeCAD/build
[18/3301] Linking CXX static library _deps/fmt-build/libfmtd.a
FAILED: _deps/fmt-build/libfmtd.a
: && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E rm -f _deps/fmt-build/libfmtd.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/ar qc _deps/fmt-build/libfmtd.a  _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o _deps/fmt-build/CMakeFiles/fmt.dir/src/os.cc.o && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib _deps/fmt-build/libfmtd.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E touch _deps/fmt-build/libfmtd.a && :
dyld[11478]: Library not loaded: '@rpath/libLLVM-14.dylib'
  Referenced from: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/llvm-ar'
  Reason: tried: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/usr/local/lib/libLLVM-14.dylib' (no such file), '/usr/lib/libLLVM-14.dylib' (no such file)
/bin/sh: line 1: 11478 Abort trap: 6           /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib _deps/fmt-build/libfmtd.a
[28/3301] Linking CXX static library src/3rdParty/libE57Format/libE57Format-d.a
FAILED: src/3rdParty/libE57Format/libE57Format-d.a
: && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E rm -f src/3rdParty/libE57Format/libE57Format-d.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/ar qc src/3rdParty/libE57Format/libE57Format-d.a  src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/E57Format_autogen/mocs_compilation.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/BlobNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/CheckedFile.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/Common.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/CompressedVectorNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/CompressedVectorReaderImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/CompressedVectorWriterImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/DecodeChannel.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/Decoder.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/Encoder.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/FloatNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/IntegerNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/NodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/Packet.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/ImageFileImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/ReaderImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/ScaledIntegerNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/SectionHeaders.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/SourceDestBufferImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/StringNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/StructureNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/VectorNodeImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/WriterImpl.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57Exception.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57Format.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57SimpleData.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57SimpleReader.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57SimpleWriter.cpp.o src/3rdParty/libE57Format/CMakeFiles/E57Format.dir/src/E57XmlParser.cpp.o && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib src/3rdParty/libE57Format/libE57Format-d.a && /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake -E touch src/3rdParty/libE57Format/libE57Format-d.a && :
dyld[11498]: Library not loaded: '@rpath/libLLVM-14.dylib'
  Referenced from: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/llvm-ar'
  Reason: tried: '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/Users/fpe/compile/FreeCAD/.conda/freecad/pkgs/llvm-tools-14.0.6-hf6e71e7_1/bin/../lib/libLLVM-14.dylib' (no such file), '/usr/local/lib/libLLVM-14.dylib' (no such file), '/usr/lib/libLLVM-14.dylib' (no such file)
/bin/sh: line 1: 11498 Abort trap: 6           /Users/fpe/compile/FreeCAD/.conda/freecad/bin/llvm-ranlib src/3rdParty/libE57Format/libE57Format-d.a
[29/3301] Generating version_check
git
/Users/fpe/compile/FreeCAD/build/src/Build/Version.h.out written
ninja: build stopped: subcommand failed.
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: How to build on macOS ARM?

Post by adrianinsaval »

oursland wrote: Wed Mar 29, 2023 10:28 am

Code: Select all

    -DBUILD_DRAWING:STRING=ON \
That one is deprecated so we shouldn't be building it by defualt
oursland
Posts: 55
Joined: Sat Mar 11, 2023 9:33 pm

Re: How to build on macOS ARM?

Post by oursland »

@adrianinsaval, I have just removed that from the default configuration.

@fpetzold /Users/fpe/compile/FreeCAD/.conda/freecad/lib/libllvm-14.dylib is the location of the library. For some reason this is not being picked up at configure and compile time.

Conda should be setting up a bunch of environment variables in your shell including the following:

Code: Select all

LDFLAGS='-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/fpe/compile/FreeCAD/.conda/freecad/lib -L/Users/fpe/compile/FreeCAD/.conda/freecad/lib'
I suspect this may not have been available at configure time.

Can you delete the build directory, double-check the environment variables are configured correctly by conda, then re-run the cmake command?
fpetzold
Posts: 20
Joined: Tue Mar 28, 2023 1:48 pm

Re: How to build on macOS ARM?

Post by fpetzold »

I retried from scratch again (4 times, actually):

Code: Select all

[build] [22/2340   0% :: 12.349] Building CXX object src/Base/CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o
[build] FAILED: src/Base/CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o 
[build] /Users/fpe/compile/FreeCAD/.conda/freecad/bin/clang++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PP_VARIADICS=1 -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFreeCADBase_EXPORTS -DGL_SILENCE_DEPRECATION -DHAVE_CONFIG_H -DHAVE_SWIG=1 -DPYCXX_6_2_COMPATIBILITY -DQT_CORE_LIB -DSALOME_USE_64BIT_IDS -D_OCC64 -I/Users/fpe/compile/FreeCAD/build/src/Base/FreeCADBase_autogen/include -I/Users/fpe/compile/FreeCAD/build -I/Users/fpe/compile/FreeCAD/build/src -I/Users/fpe/compile/FreeCAD/src -I/Users/fpe/compile/FreeCAD/build/src/Base -I/Users/fpe/compile/FreeCAD/src/Base -I/Users/fpe/compile/FreeCAD/.conda/freecad/include/python3.11 -I/Users/fpe/compile/FreeCAD/build/_deps/fmt-src/include -isystem /Users/fpe/compile/FreeCAD/.conda/freecad/include/qt -isystem /Users/fpe/compile/FreeCAD/.conda/freecad/include/qt/QtCore -isystem /Users/fpe/compile/FreeCAD/.conda/freecad/./mkspecs/macx-clang -Wall -Wextra -Wpedantic -Wno-write-strings -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/fpe/compile/FreeCAD/.conda/freecad/include -Wno-undefined-var-template -g -DFC_DEBUG -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -fPIC -MD -MT src/Base/CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o -MF src/Base/CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o.d -o src/Base/CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o -c /Users/fpe/compile/FreeCAD/src/Base/RotationPyImp.cpp
[build] In file included from /Users/fpe/compile/FreeCAD/src/Base/RotationPyImp.cpp:27:
[build] In file included from /Users/fpe/compile/FreeCAD/src/Base/Tools.h:36:
[build] In file included from /Users/fpe/compile/FreeCAD/src/boost_signals2.hpp:6:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/signals2.hpp:19:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/signals2/signal.hpp:18:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/function.hpp:30:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/function/detail/prologue.hpp:17:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/function/function_base.hpp:21:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/type_index.hpp:29:
[build] In file included from /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/type_index/stl_type_index.hpp:47:
[build] /Users/fpe/compile/FreeCAD/.conda/freecad/include/boost/container_hash/hash.hpp:132:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
[build]         struct hash_base : std::unary_function<T, std::size_t> {};
[build]                            ~~~~~^
[build] /Users/fpe/compile/FreeCAD/.conda/freecad/bin/../include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
[build] using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
[build] ^
[build] 1 error generated.
[build] [22/2340   0% :: 13.742] Building CXX object src/Base/CMakeFiles/FreeCADBase.dir/Reader.cpp.o
[build] ninja: build stopped: subcommand failed.
[proc] The command: /Users/fpe/compile/FreeCAD/.conda/freecad/bin/cmake --build /Users/fpe/compile/FreeCAD/build --config Debug --target all -- exited with code: 1
[build] Build finished with exit code 1
Post Reply