Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS arm build #108

Open
tcurdt opened this issue Apr 18, 2022 · 42 comments
Open

macOS arm build #108

tcurdt opened this issue Apr 18, 2022 · 42 comments

Comments

@tcurdt
Copy link

tcurdt commented Apr 18, 2022

Is there any chance for the 0.20 release to also include an official macOS arm build?

@luzpaz
Copy link
Collaborator

luzpaz commented Apr 18, 2022

CC @ipatch

@ipatch
Copy link

ipatch commented Apr 18, 2022

i was recently granted access to a m1 machine, but my time has been limited. and the time that i do have, i've been spending it working on getting a freecad build built on a big sur box and being able to distribute a FreeCAD.app bundle that will run on macos 10.13 to the latest version. this has proven more difficult than i had originally planned, but have made some recent headway.

presently i'm using a macos vm to build and distribute the macos FreeCAD.app mac app bundles hosted on the homebrew-freecad tap. since the builds are built on macos mojave they will run on any version of macos mojave and newer. if you have an m1 mac then you should 🤞 be able to run the FreeCAD.app bundle that i'm distributing via the homebrew-freecad tap via Rosetta 2. that is something i haven't tested myself yet. as i'm more interested (when i have available time) to build on big sur and make certain the release will run on macos high sierra (10.13) and newer.

i'm choosing to build on big sur because once i get a working build on big sur and it can run on macos high sierra and newer with the issues ironed out i'll attempt to circle back around and see if i can build a native arm build of FreeCAD.app using the same big sur vm.

the major limitations at this time i believe are that freecad doesn't support qt6 (that i'm aware of) i think there's a forum thread about that. and i don't qt5 supports apple aarch64 ie m1 procs. so using features like the start workbench won't work because they rely on qtwebengine which is dependent on qt5 which qt5 never fully supported m1 processors, maybe that has changed but i haven't fully looked in to. so to get all the bells and whistles with freecad one would need to either get qtwebengine v5 working with m1 or update the freecad src to work with qt v6.2 as i believe that is the version that supports all the features of m1 procs. or you can selectively disable certain features of freecad. if you look at the freecad formula in the homebrew freecad tap you'll see where there is an option to disable the qtwebengine during the build so you may be able to build a native m1 FreeCAD.app bundle. (not something i've tested).

i hope all this helps, and i wish i had unlimited amount of time to make this stuff happen unfortunately i don't so i try to get to things when i can.

@tcurdt
Copy link
Author

tcurdt commented Apr 18, 2022

This has proven more difficult than i had originally planned, but have made some recent headway.

Are the difficulties shared in a ticked somewhere?

If you have an m1 mac then you should 🤞 be able to run the FreeCAD.app bundle that i'm distributing via the homebrew-freecad tap via Rosetta 2.

I can confirm the weekly build at least working on Monterey via Rosetta 2.

the major limitations at this time i believe are that freecad doesn't support qt6 (that i'm aware of) i think there's a forum thread about that. and i don't qt5 supports apple aarch64 ie m1 procs.

I think I read there is a qt5 backport by now. Not sure to what extend this works though.

i hope all this helps, and i wish i had unlimited amount of time to make this stuff happen unfortunately i don't so i try to get things when i can.

Much appreciate sharing all the details.

@luzpaz
Copy link
Collaborator

luzpaz commented Apr 18, 2022

the major limitations at this time i believe are that freecad doesn't support qt6 (that i'm aware of) i think there's a forum thread about that.

Indeed. We're not there yet. Most likely we will go full speed ahead on Qt6 after v0.20 is released. Here's the forum thread: https://forum.freecadweb.org/viewtopic.php?f=10&t=65089

@looooo
Copy link
Contributor

looooo commented May 10, 2022

Conda-folge is also slowly getting closer to osx_arm support. qt is already available for osx-arm64. I am currently working on pyside2 to be updated to qt5.15 + osxarm64. Once we have pyside2 available for osx-arm64 I think it should be possible to update pivy too. After pivy is done it should be possible to compile freecad for osx_arm64. This is at least the roadmap for conda/conda-forge. Once this is done it should be possible to create a bundle for osx_arm64.

@looooo
Copy link
Contributor

looooo commented Jul 4, 2022

pyside2-osx-arm64: https://anaconda.org/freecad/pyside2/files?version=5.15.5
pivy-osx-arm64: https://anaconda.org/freecad/pivy/files

what's next?

@luzpaz
Copy link
Collaborator

luzpaz commented Jul 4, 2022

Is that it? Can it build then?

@looooo
Copy link
Contributor

looooo commented Jul 4, 2022

Not sure, I will try. Maybe we need to use occt 7.6 as I am not sure if there are osx-arm packages for Occt 7.5. If so we need to use the internal smesh and netgen x.y. Not sure what is a good combination... @donovaly

@luzpaz
Copy link
Collaborator

luzpaz commented Jul 4, 2022

@ipatch have you heard of any 3rd party deps needed (beside what looooo is postulating above) for ARM support ?

@ipatch
Copy link

ipatch commented Jul 4, 2022

unfortunately i would not know. i don't have access to a m1 (ARM) based mac. i had limited access to a box @chennes setup but the connection to it was spotty at best and i messaged him several times on gitter without a response.

@JohnOCFII
Copy link
Sponsor

@ipatch have you heard of any 3rd party deps needed (beside what looooo is postulating above) for ARM support ?

Forum user @Doia (who appears to be Github user @j-wiedemann) was able to successfully build FreeCAD 0.20 development versions for M1 Mac. I had used his info to successfully build on my M1 MacBook Pro as well, but for some reason it stopped working a couple of months ago. He might be able to offer advice.

@j-wiedemann
Copy link

Forum user @Doia (who appears to be Github user @j-wiedemann)

No, it is not true. I'm rockn on the forum.

@JohnOCFII
Copy link
Sponsor

No, it is not true. I'm rockn on the forum.

Oops. Sorry about that.

@chennes
Copy link
Member

chennes commented Jul 5, 2022

@ipatch Where did we leave off? (sorry, I don't check gitter very often)

@looooo
Copy link
Contributor

looooo commented Jul 5, 2022

is there an osx-arm64 package for 3dconnexion?

@looooo
Copy link
Contributor

looooo commented Jul 5, 2022

I was able to compile freecad for osx-arm64 via conda-packages. To install and test with conda:

conda create -n freecad_test freecad -c conda-forge -c freecad/label/dev
conda activate freecad_test
freecad

OCCT is now 7.6
smesh is not working as expected. Result in non working fem workbench.

lots of work to do :)

@dirkolbrich
Copy link

dirkolbrich commented Jul 6, 2022

@Doia here ;-)
My arm64 build pipeline broke as well. Using Python 3.9 gives me errors during cmake setup on Pivy and Pyside2, resulting in some weird /Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1026:18: error: unknown type name 'Py_complex'; did you mean '_Complex'? error during build.

Using Python 3.10 collides with the homebrew installed boost-python3 library, as this is looking for python 3.9 during cmake setup.

So, starting from zero setup.

@chennes
Copy link
Member

chennes commented Jul 6, 2022

@dirkolbrich For the record, I'm getting that same error on my current Intel builds as well.

@dirkolbrich
Copy link

linking @ageeye homebrew repo here as he managed to create a working arm64 build. Haven't digested the brew formulae yet.

https://github.com/ageeye/homebrew-freecad/releases/tag/M1_2022_07

@dirkolbrich
Copy link

Ok, using Python 3.10 (with an updated boost-python3 using Python 3.10) still leaves me with an error for Py_complex as mentioned above.

Here is the report from the cmake setup (all fine) and the error during build:

➜  freecad-build python3 --version
Python 3.10.5
➜  freecad-build cmake \
  -DCMAKE_BUILD_TYPE="Release" \
  -DBUILD_ENABLE_CXX_STD=C++17 \
  -Wno-dev \
  -DPYTHON_EXECUTABLE=/opt/homebrew/opt/python@3.10/bin \
  -DPYTHON_INCLUDE_DIR=/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Headers \
  -DPYTHON_LIBRARY=/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/libpython3.10.dylib \
  -DBUILD_FEM=OFF \
  -DBUILD_WEB=OFF \
  -DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
  -DCMAKE_INSTALL_PREFIX="./.." \
  ../freecad-source
-- Compiler: AppleClang, version: 13.1.6.13160021
-- 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.23.2
-- BUILD_MESH_PART requires BUILD_SMESH to be ON, but it is ""
-- BUILD_OPENSCAD requires BUILD_MESH_PART to be ON, but it is "OFF"
-- BUILD_START requires BUILD_WEB to be ON, but it is "OFF"
-- Detected Homebrew install at /opt/homebrew
-- PyCXX found:
--   Headers:  /Users/dirkolbrich/FreeCAD/freecad-source/src
--   Sources:  /Users/dirkolbrich/FreeCAD/freecad-source/src/CXX
--   Version:  6.2.8
-- -- Found OCE/OpenCASCADE version: 7.6.2
-- -- OCE/OpenCASCADE include directory: /opt/homebrew/include/opencascade
-- -- OCE/OpenCASCADE shared libraries directory: /opt/homebrew/lib
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake (found suitable version "1.79.0", minimum required is "1.55") found components: filesystem program_options regex system thread date_time
-- Coin3D libraries found
-- Found Spnav: /opt/homebrew/lib/libspnav.dylib
-- Shiboken2Config: Using default python: .abi3
-- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Headers'
-- SHIBOKEN_PYTHON_LIBRARIES computed to value: '-undefined dynamic_lookup'
-- libshiboken built for Release
-- ===============================================
PySide2 Python module found at /opt/homebrew/lib/python3.10/site-packages/PySide2.
===============================================

=====================================================
Matplotlib not found, Plot module won't be available.
=====================================================

-- Platform is 64-bit, set -D_OCC64
-- [E57] Revison ID: E57Format-2.2.1-arm64-darwin
-- [E57] Building static library
-- setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake (found version "1.79.0") found components: python310
-- found Boost: 1_79
-- boost-incude dirs are: /opt/homebrew/include
-- boost-python lib is:
-- boost_LIBRARY_DIRS is: /opt/homebrew/lib
-- Boost_LIBRARIES is: Boost::python
-- 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
--
==============
Summary report
==============

-- Build type:          Release
-- Compiler:            /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ (13.1.6.13160021)
-- Flags:               -Wall -Wextra -Wpedantic -Wno-write-strings  -Wno-undefined-var-template
-- Standard:            Requires C++17
-- Python:              3.10.5 [/opt/homebrew/Frameworks/Python.framework/Versions/3.10/bin/python3.10] [.abi3]
-- PCL:                 not enabled
-- pybind11:            not enabled
-- Boost:               1.79.0
-- XercesC:             3.2.3 [/opt/homebrew/lib/libxerces-c.dylib] [/opt/homebrew/include]
-- ZLIB:                1.2.11
-- PyCXX:               6.2.8 [/Users/dirkolbrich/FreeCAD/freecad-source/src]
-- OCC:                 7.6.2 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/opt/homebrew/lib] [/opt/homebrew/include/opencascade]
-- SMESH:               do not build
-- NETGEN:              not enabled
-- SWIG:                4.0.2
-- Eigen3               3.4.0
-- Qt5Core:             5.15.5
-- Qt5Network:          5.15.5
-- Qt5Xml:              5.15.5
-- Qt5XmlPatterns:      5.15.5
-- Qt5Widgets:          5.15.5
-- Qt5PrintSupport:     5.15.5
-- Qt5OpenGL:           5.15.5
-- Qt5Svg:              5.15.5
-- Qt5UiTools:          5.15.5
-- Qt5Concurrent:       5.15.5
-- Qt5WebKitWidgets:    not needed (BUILD_WEB)
-- Qt5WebEngineWidgets:    not needed (BUILD_WEB)
-- Designer plugin:     not built per user request (BUILD_DESIGNER_PLUGIN)
-- Shiboken2:           5.15.5 [/opt/homebrew/lib/cmake/Shiboken2-5.15.5] [/opt/homebrew/include/shiboken2;/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Headers]
-- PySide2:             5.15.5 [/opt/homebrew/include/PySide2]
-- PySide2Tools:        [/opt/homebrew/opt/qt@5/bin/uic] [/opt/homebrew/opt/qt@5/bin/rcc]
-- Freetype:            2.12.1
-- OpenGL:              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework
-- OpenGLU:             [/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework][/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework]
-- Coin3D:              4.0.0 [/opt/homebrew/lib/libCoin.dylib] [/opt/homebrew/include]
-- Pivy:                0.6.6
-- SPNAV:               [/opt/homebrew/lib/libspnav.dylib] [/opt/homebrew/include]
-- Matplotlib:          not found
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             1.9.4
-- Language:            English
-- Coin3D_DOC:          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

The build stops with the following error:

[  9%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/Application.cpp.o
In file included from /Users/dirkolbrich/FreeCAD/freecad-source/src/Gui/Application.cpp:43:
In file included from /Users/dirkolbrich/FreeCAD/freecad-build/src/App/DocumentObjectPy.h:7:
In file included from /Users/dirkolbrich/FreeCAD/freecad-build/src/App/ExtensionContainerPy.h:7:
In file included from /Users/dirkolbrich/FreeCAD/freecad-build/src/App/PropertyContainerPy.h:7:
In file included from /Users/dirkolbrich/FreeCAD/freecad-build/src/Base/PersistencePy.h:7:
In file included from /Users/dirkolbrich/FreeCAD/freecad-build/src/Base/BaseClassPy.h:7:
In file included from /Users/dirkolbrich/FreeCAD/freecad-source/src/Base/PyObjectBase.h:56:
In file included from /Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Objects.hxx:42:
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1026:18: error: unknown type name 'Py_complex'; did you mean '_Complex'?
        operator Py_complex() const
                 ^~~~~~~~~~
                 _Complex
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1026:18: warning: '_Complex' is a C99 extension [-Wc99-extensions]
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1026:18: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
        operator Py_complex() const
                 ^
                            double
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1031:35: error: unknown type name 'Py_complex'; did you mean '_Complex'?
        Complex &operator=( const Py_complex &v )
                                  ^~~~~~~~~~
                                  _Complex
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1031:35: warning: '_Complex' is a C99 extension [-Wc99-extensions]
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1031:35: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
        Complex &operator=( const Py_complex &v )
                                  ^
                                             double
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1028:20: error: use of undeclared identifier 'PyComplex_AsCComplex'
            return PyComplex_AsCComplex( ptr() );
                   ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1033:18: error: use of undeclared identifier 'PyComplex_FromCComplex'
            set( PyComplex_FromCComplex( v ), true );
                 ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1793:31: error: use of undeclared identifier 'Py_UNICODE'
    typedef std::basic_string<Py_UNICODE> unicodestring;
                              ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1794:12: error: unknown type name 'Py_UNICODE'
    extern Py_UNICODE unicode_null_string[1];
           ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1983:15: error: unknown type name 'Py_UNICODE'
        Char( Py_UNICODE v )
              ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2021:26: error: unknown type name 'Py_UNICODE'
        Char &operator=( Py_UNICODE v )
                         ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1990:79: error: unknown type name 'Py_UNICODE'
        : Object( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ),1 ), true )
                                                                              ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1990:94: error: member reference base type 'const Py::unicodestring' (aka 'const int') is not a structure or union
        : Object( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ),1 ), true )
                                                                                            ~^~~~~
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:1990:46: error: use of undeclared identifier 'PyUnicode_4BYTE_KIND'
        : Object( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ),1 ), true )
                                             ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2010:78: error: unknown type name 'Py_UNICODE'
            set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ), 1 ), true );
                                                                             ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2010:93: error: member reference base type 'const Py::unicodestring' (aka 'const int') is not a structure or union
            set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ), 1 ), true );
                                                                                           ~^~~~~
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2010:45: error: use of undeclared identifier 'PyUnicode_4BYTE_KIND'
            set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, const_cast<Py_UNICODE*>( v.data() ), 1 ), true );
                                            ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2016:13: error: unknown type name 'Py_UNICODE'
            Py_UNICODE v( v_ );
            ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2017:45: error: use of undeclared identifier 'PyUnicode_4BYTE_KIND'
            set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, &v, 1 ), true );
                                            ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2023:45: error: use of undeclared identifier 'PyUnicode_4BYTE_KIND'
            set( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, &v, 1 ), true );
                                            ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2116:23: error: unknown type name 'Py_UNICODE'
        String( const Py_UNICODE *s, int length )
                      ^
/Users/dirkolbrich/FreeCAD/freecad-source/src/CXX/Python3/Objects.hxx:2117:53: error: use of undeclared identifier 'PyUnicode_4BYTE_KIND'
        : SeqBase<Char>( PyUnicode_FromKindAndData( PyUnicode_4BYTE_KIND, s, length ), true )
                                                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
make[2]: *** [src/Gui/CMakeFiles/FreeCADGui.dir/Application.cpp.o] Error 1
make[1]: *** [src/Gui/CMakeFiles/FreeCADGui.dir/all] Error 2
make: *** [all] Error 2
sh -c 'cmake --build .'  66,67s user 21,18s system 577% cpu 15,212 total

Any ideas what the reason could be?


Side note: I updated boost-python3 to use python 3.10 by creating a local homebrew formulae:

  • create a stub formulae with a new name indicating the used python version
    brew create --set-name boost-python3@3.10
  • this should open Vim with a newly created stub formula, enter :qa to save this stub formula in Vim
  • you can find this newly create formula in the local homebrew source directory under /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/boost-python3@3.10.rb
  • open this formula file and delete all code
  • I forked the official homebrew-core formulae for boost-python3 and changed the dependency from python@3.9 to python@3.10, you can find the raw code here https://raw.githubusercontent.com/dirkolbrich/homebrew-core/boost-python3/Formula/boost-python3.rb
  • copy all code from this file and insert into the local boost-python3@3.10.rb file
  • install the newly build boost-python3@3.10
    brew install --build-from-source boost-python3@3.10
  • check if installed correctly
    brew info boost-python3@3.10

@dirkolbrich
Copy link

Found the corresponding forum thread: Mac build and python C API

@looooo
Copy link
Contributor

looooo commented Jul 12, 2022

osx-arm bundles are available :) please test. I still have to do the builds manually, but I am working on cross-compiling so we have a fully automated weekly build for osx-arm64
https://github.com/FreeCAD/FreeCAD-Bundle/releases/tag/weekly-builds

also the osx-bundle (and the AppImage) was updated to occt7.6 / qt5.15 (finally). There is no need for the software-gl switch to make the start-wb work. So feel free to test :)

@luzpaz
Copy link
Collaborator

luzpaz commented Jul 12, 2022

also the osx-bundle (and the AppImage) was updated to occt7.6

7.6 or 7.6.2 ?

@looooo
Copy link
Contributor

looooo commented Jul 13, 2022

also the osx-bundle (and the AppImage) was updated to occt7.6

7.6 or 7.6.2 ?

7.6.2

@luzpaz
Copy link
Collaborator

luzpaz commented Jan 14, 2023

@looooo can we close this ticket?

@looooo
Copy link
Contributor

looooo commented Jan 19, 2023

hmm conda osx-arm builds are still somewhat beta I guess. But I am not going to add a osx-arm64 bundle for freecad 0.20. I will try to do this for 0.21 or 0.1 or whatever the next version is named.

@looooo looooo closed this as completed Jan 19, 2023
@Enver-Yilmaz
Copy link

Hi,

I tried FreeCAD_weekly-builds-31483-2022-12-31-conda-macOS-arm-py311.dmg on M1 mac without Rosetta 2 installed and it failed to execute. Budle itself looks like native but execution failed with the 'You need to install rosetta' message.

@Enver-Yilmaz
Copy link

I also tried FreeCAD_weekly-builds-31641-2023-01-22-conda-macOS-x86_64-py310.dmg. Despite its name, it is probably universal and failed to execute with no rosetta message too.

@sammcj
Copy link

sammcj commented Mar 22, 2023

Any updates to this? It's still an issue and the only decent performing build is that single arm build from December.

@fpunkt
Copy link

fpunkt commented Jul 16, 2023

This is still the case with the 2032-07-xx arm files and I still refuse to install Rosetta ..

What works for me is to start the FreeCAD binary from the terminal (for convenience with symbolic link..)

bin/freecad -> /Applications/FreeCAD-2023-07-10.app/Contents/Resources/bin/freecad

When starting the first time it takes a while and then MacOS refuses with "unknown developer" message. Open System settings (? guessing the name here since I don't use the English language setting) and allow the binary to be executed (somewhere in the security section, scroll down and there is the message opening FreeCAD was refused and it offers the "allow anyway" button)

Then next start from terminal works fine ... (well, not the nice FreeCAD icon but otherwise seems to work flawlessly for me)

@chennes
Copy link
Member

chennes commented Jul 17, 2023

We will definitely have a native 0.21 binary for ARM (right, @adrianinsaval ?), but we won't being going back and producing a 0.20 version. And it will probably be codesigned (by me, at first, due to it taking forever to get the appropriate legal accounts set up for the FPA). So hopefully a lot of these headaches will go away soon.

@adrianinsaval
Copy link
Member

We will definitely have a native 0.21 binary for ARM (right, @adrianinsaval ?)

Yep, we already have weekly builds for it.

@JohnOCFII
Copy link
Sponsor

We will definitely have a native 0.21 binary for ARM (right, @adrianinsaval ?)

Yep, we already have weekly builds for it.

The weekly Arm builds are working fine for me (We've had a few bumps, but last week or two have been fine, other than having just a generic icon, and that we can't rename the App). Not sure what the OP issue is. When I look in Activity Monitor FreeCAD shows up as an Arm App.

    - OS: macOS 13.4.1
    - Word size of FreeCAD: 64-bit
    - Version: 0.21.0.33576 (Git)
    - Build type: Release
    - Branch: master
    - Hash: 8e6fbd2886d3ad51b75232bd0019d92d496e80cb
    - Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
    - Locale: C/Default (C)

@kind-idea
Copy link

I am also running into the issue fpunkt described above with the weekly builds. When I double-click on the app icon, macOS still prompts me to install Rosetta. But if I run FreeCAD.app/Contents/MacOS/FreeCAD directly, it works fine without Rosetta.

@adrianinsaval
Copy link
Member

Are you using the latest arm bundle? The application is natively compiled and so is the bundle so I don't understand why it's asking you this

@looooo looooo reopened this Jul 23, 2023
@fpunkt
Copy link

fpunkt commented Jul 23, 2023

Yes, I'm using the latest weekly. There was one weekly ARM binary from about Jan 2022 (?) that could be started from the Finder without Rosetta installed.
After a some pause updated ARM builds appear again but cannot be started from Finder, although all binaries and libraries appear to be for ARM(*). Starting from terminal by typing Downloads/FreeCAD.app/Contents/MacOS/FreeCAD works after the binary has been "cleared/blessed" in System Settings.

(*) well, not all binaries - there are some Windows .exe files in the package that might be candidates for future cleanup.

cd /Volumes/FreeCAD_weekly-builds-33617-2023-07-20-conda-macOS-arm64-py310/
find . -type f -perm +111 | xargs file|grep -v 'shell script\|ASCII text\|Perl\|Python' | fgrep -v arm64
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/w64-arm.exe:                                                                                                          PE32+ executable (GUI) Aarch64, for MS Windows
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/w32.exe:                                                                                                              PE32 executable (GUI) Intel 80386, for MS Windows
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/t32.exe:                                                                                                              PE32 executable (console) Intel 80386, for MS Windows
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/w64.exe:                                                                                                              PE32+ executable (GUI) x86-64, for MS Windows
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/t64-arm.exe:                                                                                                          PE32+ executable (console) Aarch64, for MS Windows
./FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/pip/_vendor/distlib/t64.exe:                                                                                                              PE32+ executable (console) x86-64, for MS Windows

@JohnOCFII
Copy link
Sponsor

Yes, I'm using the latest weekly. There was one weekly ARM binary from about Jan 2022 (?) that could be started from the Finder without Rosetta installed.

I'm curious. I DO have Rosetta installed, but when I launch FreeCAD from the icon, it launches successfully, and Activity Viewer shows than a native Arm App is running. Curious if there is something else in the launch process that either tries to launch an Intel process, or looks for Rosetta -- something that succeeds on my machine, but fails on yours.

    - OS: macOS 13.4.1
    - Word size of FreeCAD: 64-bit
    - Version: 0.21.0.33576 (Git)
    - Build type: Release
    - Branch: master
    - Hash: 8e6fbd2886d3ad51b75232bd0019d92d496e80cb
    - Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
    - Locale: C/Default (C)

@light-idea
Copy link

The latest release 0.21.0 is still asking me to install Rosetta. I suspect it has something to do with the executable being a bash script (possibly related to https://apple.stackexchange.com/questions/452070/custom-macos-application-bundle-requires-rosetta-even-through-it-shouldnt), although I am not sure what a good solution might be.

@adrianinsaval
Copy link
Member

Would using zsh instead help?

@chennes
Copy link
Member

chennes commented Aug 22, 2023

Probably -- which script are we talking about here? zsh has been the default shell for quite a long time now.

@tcurdt
Copy link
Author

tcurdt commented Aug 23, 2023

The stackexchange post (at best) guesses it could be related to the shell script and then presents a work around.
It sure cannot hurt to try zsh - but I find this angle rather suspect. Bash is as much a universal binary as zsh is.
I'd be surprised if it is that - but never know 🤷‍♂️

On the first glance this also looks like it could be converted into posix style.

#!/bin/sh

HERE=$(dirname "$(dirname "$0")")
cat "$HERE/packages.txt"
export PREFIX="$HERE/Resources"
export LD_LIBRARY_PATH="$PREFIX/lib"
export PYTHONHOME="$PREFIX"
export FONTCONFIG_FILE="/etc/fonts/fonts.conf"
export FONTCONFIG_PATH="/etc/fonts"
export LANG="UTF-8"
export SSL_CERT_FILE="$PREFIX/ssl/cacert.pem"
export GIT_SSL_CAINFO="$PREFIX/ssl/cacert.pem"

product_version=$(sw_vers -productVersion)
if [ "$(echo "$product_version > 10.99" | bc)" -eq 1 ]; then
  export QT_MAC_WANTS_LAYER=1
fi

"$PREFIX/bin/freecad" "$@"

That should drop the bash vs zsh angle - but I am also just guessing here.

@light-idea
Copy link

light-idea commented Aug 26, 2023

I tried updating the script in one of the weekly builds to use sh/zsh (duplicating the app each time to clear cache), but macOS still asks for Rosetta.

Since the script just sets a few environment variables, you might be able to set them in Info.plist and use the real ARM executable:

...
	<key>LSEnvironment</key>
	<dict>
		<key>PREFIX</key>
		<string>@executable_path/../Resources</string>
		<key>DYLD_FALLBACK_LIBRARY_PATH</key>
		<string>@executable_path/../Resources/lib</string>
		<key>PYTHONHOME</key>
		<string>@executable_path/../Resources</string>
		<key>FONTCONFIG_FILE</key>
		<string>/etc/fonts/fonts.conf</string>
		<key>FONTCONFIG_PATH</key>
		<string>/etc/fonts</string>
		<key>LANG</key>
		<string>UTF-8</string>
		<key>SSL_CERT_FILE</key>
		<string>@executable_path/../Resources/ssl/cacert.pem</string>
		<key>GIT_SSL_CAINFO</key>
		<string>@executable_path/../Resources/ssl/cacert.pem</string>
		<key>QT_MAC_WANTS_LAYER</key>
		<string>1</string>
	</dict>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests