macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by FreddyFreddy »

doia wrote: Thu Mar 31, 2022 2:02 pm -DCMAKE_BUILD_TYPE=Release: command not found[/mono]] suggest that there was some typo in the cmake command.
D'oh! (slaps forehead). You are spot-on! I'd changed the src dir to -S~/freecad/FreeCAD but forgot the trailing \

Then:

Code: Select all

-- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) 
=====================================================
SWIG not found, will not build SWIG binding for pivy.
=====================================================
swig was not in brew list but it does have an entry in homebrew-freecad . I might have jumped the gun a bit there as I had not checked the Cellar folder first, but I went right back through the freecad dependencies install and there was no mention of swig.
So

Code: Select all

brew install freecad/freecad/swig@4.0.2
brew link swig@4.0.2
and

Code: Select all

-- ===============================================
PySide2 Python module found at /usr/local/lib/python3.9/site-packages/PySide2.
===============================================
Is this a problem?
My understanding is that this is looking for a python module in python. If it doesn't find it it sets it for load at run-time(??)
Anyway its building with no obvious errors (yet) so I'll submit this now before this site trashes it on me.
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by FreddyFreddy »

doia wrote: Thu Mar 31, 2022 2:02 pm
Hooray! That worked. Thank you so much for your assistance.
Now to go back and figure out why past efforts failed.

I would be more than happy to assist any effort to document homebrew build. The current documentation is scattered all over the place and is simply wrong, incomplete, or outdated.

Again, thank you!
jmplonka
Posts: 138
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by jmplonka »

So, please, for a newbe on a MAC Studio: how can I get an FreeCAD.app from git-sources?
Until now I always end up in:

Code: Select all

CMake Error at /opt/homebrew/lib/cmake/Shiboken2-5.15.2/shiboken_helpers.cmake:468 (message):
  The detected Python minor version is not compatible with the Python minor
  version which was used when Shiboken was built.  Consider building shiboken
  with FORCE_LIMITED_API set to '1', so that only the Python major version
  matters.

  Built with: '3.9' Detected: '3.10'
Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/Shiboken2-5.15.2/Shiboken2Config.cpython-39-darwin.cmake:45 (shiboken_check_if_built_and_target_python_are_compatible)
  /opt/homebrew/lib/cmake/Shiboken2-5.15.2/Shiboken2Config.cmake:5 (include)
  cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake:13 (find_package)
  CMakeLists.txt:75 (SetupShibokenAndPyside)
Thans
Jens
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by Kunda1 »

jmplonka wrote: Tue Apr 19, 2022 11:34 am So, please, for a newbe on a MAC Studio: how can I get an FreeCAD.app from git-sources?
doia wrote: Mon Mar 21, 2022 12:31 pm As I said in another post, please post your setup and a reproducible list of steps you took to build/compile FC. We would like to help you, but "FreeCAD does not build" leaves a lot room for guesswork.
;)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
jmplonka
Posts: 138
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by jmplonka »

Kunda1 wrote: Tue Apr 19, 2022 12:10 pm ;)
So FreeCAD doesn't build natively on Mac Silicon right now? :o
User avatar
doia
Posts: 251
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by doia »

It does. You need to use Python 3.9
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by FreddyFreddy »

One more thing. After successfully running cmake, and cmake build, you need to run cmake install to get the app. Obvious when you know, but hardly ever mentioned in FreeCAD documentation.
JohnOCFII
Posts: 112
Joined: Sun Sep 20, 2020 5:46 pm
Location: Minnesota, USA

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by JohnOCFII »

doia wrote: Tue Apr 19, 2022 1:44 pm It does. You need to use Python 3.9
Greetings,

Not sure if you have a GitHub account, but there is discussion of how to get the Homebrew FreeCAD to build on Mac M1/Arm. I thought you might be able to help as I had successfully been able to build following your instructions a few months ago (although that stopped working a while back for me).

https://github.com/FreeCAD/FreeCAD-Bundle/issues/108

Thanks,

John
User avatar
doia
Posts: 251
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by doia »

My build pipeline on macOS arm46 is broken as well. I don't know the reason or fix yet.

Using my setup with Python 3.9 reports some errors during the cmake setup in regards to Pivy and Pyside2. Yet the setup finishes with OK:

Code: Select all

-- Coin3D libraries found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'pivy' has no attribute '__version__'
-- Could NOT find Spnav (missing: SPNAV_LIBRARY SPNAV_INCLUDE_DIR)
-- Shiboken2Config: Using default python: .abi3
-- Found PythonInterp: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found suitable version "3.9.13", minimum required is "3")
-- Found PythonLibs: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib (found suitable version "3.9.13", minimum required is "3")
-- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9'
-- SHIBOKEN_PYTHON_LIBRARIES computed to value: '-undefined dynamic_lookup'
-- libshiboken built for Release
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
================================
PySide2 Python module not found.
================================
This results in weird errors with Py_complex and Py_UNIcODE during build:

Code: Select all

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.
Using Python 3.10 results in an error on the Boost library:

Code: Select all

-- Could NOT find Boost: missing: python310 (found /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake (found version "1.79.0"))
-- Could NOT find Boost: missing: python3 (found /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake (found version "1.79.0"))
CMake Error at /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake:141 (find_package):
  Found package configuration file:

    /opt/homebrew/lib/cmake/boost_python-1.79.0/boost_python-config.cmake

  but it set boost_python_FOUND to FALSE so package "boost_python" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_python39-mt.dylib (3.9, Boost_PYTHON_VERSION=3.10)

  * libboost_python39-mt.a (3.9, Boost_PYTHON_VERSION=3.10)

  * libboost_python39.dylib (3.9, Boost_PYTHON_VERSION=3.10)

  * libboost_python39.a (3.9, Boost_PYTHON_VERSION=3.10)

Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake:262 (boost_find_component)
  /opt/homebrew/Cellar/cmake/3.23.2/share/cmake/Modules/FindBoost.cmake:594 (find_package)
  src/Mod/Path/libarea/CMakeLists.txt:26 (find_package)

-- Configuring incomplete, errors occurred!
Either way, I'm out of ideas.
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: macOS homebrew Error: freecad/freecad HEAD-d6a9a94 did not build

Post by FreddyFreddy »

It feels like there is something fundamentally wrong with the way versions are managed. Too many sudden breakages. Surely there must be a way to make each install version immutable and unique.
Post Reply