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!
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

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

Post by Gift »

doia wrote: Wed Jul 06, 2022 3:42 pm 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.
The most libs deeps from python@3.10, but boost-python from 3.9. Because python ist not keg only, there is the trouble preprogrammed. We can solve it with your own boost-python formula.
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 »

Gift wrote: Wed Jul 06, 2022 7:13 pm The most libs deeps from python@3.10, but boost-python from 3.9. Because python ist not keg only, there is the trouble preprogrammed. We can solve it with your own boost-python formula.
Yeah, I have found a blueprint for that under https://github.com/ageeye/homebrew-free ... 01.78.0.rb

The weird thing is the Pivy and Pyside2 hickups if I use Python 3.9.
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 »

FreddyFreddy wrote: Wed Jul 06, 2022 4:52 pm 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.
You are right. Homebrew is not very reliable on using versioned formulaes. But Python is worse, that's a real Bas$$$$ when it comes to version dependency. I have the feeling, that most dependency errors during build stem from mismatching Python versions.
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

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

Post by Gift »

doia wrote: Thu Jul 07, 2022 10:29 am
FreddyFreddy wrote: Wed Jul 06, 2022 4:52 pm 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.
You are right. Homebrew is not very reliable on using versioned formulaes. But Python is worse, that's a real Bas$$$$ when it comes to version dependency. I have the feeling, that most dependency errors during build stem from mismatching Python versions.
After the QT issues are solved, we can look at the python dependencies.
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 »

Gift wrote: Fri Jul 08, 2022 7:29 am After the QT issues are solved, we can look at the python dependencies.
Very much needed. While digging into the Py_complex error I realized there are 3 different C++ to Python binding libraries in use:
- PyCXX, the complete source included as a subfolder, version defined as v6.2.8 -> current official version is 7.1.7, time to update? -> this addresses the deprecated Py_UNICODE API
- boost-python3 only used by WBs MeshPart and Path in their module CMakeLists
- pybind11, use of this library set in cmake to OFF by default, used as a replacement to boost-python3, only used by WBs MeshPart and Path
Post Reply