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
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 »

Yes, there seems to be an error, and I think I suspect where it comes from.

I tried the install myself with

Code: Select all

brew install freecad/freecad/freecad --build-from-source --HEAD --verbose
which resulted in an error you described as the process detects python3.10 for the python executable.

I --force removed python3.10 and made sure, only python3.9 is installed and linked:

Code: Select all

$ brew uninstall python@3.10
Error: Refusing to uninstall /opt/homebrew/Cellar/python@3.10/3.10.2
because it is required by certbot, coin3d, llvm, llvm@11, pyside2@5.15.2, pyside@2, shiboken2@5.15.2 and sphinx-doc, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies python@3.10
$ brew uninstall --ignore-dependencies python@3.10
Uninstalling /opt/homebrew/Cellar/python@3.10/3.10.2... (3,145 files, 57.2MB)
$ which python3 && python3 --version
/opt/homebrew/bin/python3
Python 3.9.10
$ ls -al /opt/homebrew/bin/python3
lrwxr-xr-x  1 dirkolbrich  admin  39 23 Mär 10:00 /opt/homebrew/bin/python3 -> ../Cellar/python@3.9/3.9.10/bin/python3
Trying again with brew install freecad/freecad/freecad --build-from-source --HEAD --verbose reinstalls python3.10, the llvm@11 dependency of the freecad formulae does that, but it does not link python3.10. The linked python3 --version stays at Python 3.9.10.

And the shiboken2@5.15.2 dependency itself also depends on llvm (which in turn depends on python3.10). Shiboken builds from source while specifying llvm as it compiler, thus setting python3.10 for its executable. But further down the line specifies the python3.9 libraries to use.

In conclusion: the current homebrew-freecad formulae is broken, as its dependencies and sub-dependencies all have mismatching reliance on different python versions. What a mess.

Meanwhile you can build FreeCAD directly from source. I succeed on an M1 machine with that. Can later try with an Intel machine if you need help.

---

Note: Do you have xcode-select? Please check with Xcode-select -v, otherwise please install with

Code: Select all

Xcode-select --install
Last edited by doia on Thu Jul 07, 2022 9:47 am, edited 1 time in total.
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 »

Thanks for testing. In the mean-time I have a fresh copy of Monterey in a new volume to eliminate over-time self-induced problems.
Yes, I have Xcode installed (full).
So far I have only run

Code: Select all

brew install freecad/freecad/freecad
as it seemed to be the simplest thing I could test.
I did notice

Code: Select all

==> Installing dependencies for freecad/freecad/freecad: ... python@3.9, boost-python3, python@3.10  ...
and

Code: Select all

==> Installing freecad/freecad/freecad dependency: python@3.10
==> Pouring python@3.10--3.10.2.monterey.bottle.tar.gz
==> /usr/local/Cellar/python@3.10/3.10.2/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.10/3.10.2/bin/python3 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/usr/loca
🍺  /usr/local/Cellar/python@3.10/3.10.2: 3,133 files, 56.4MB
which, after our discussions was unexpected.

Moved app bundle -> Applications. Side note: There is no mention of where the app has been placed. In the cellar folder was a surprise.

Anyways, I fired up FreeCAD and errors displayed

Code: Select all

03:55:31  During initialization the error "No module named 'PySide2'" occurred in /Applications/FreeCAD.app/Contents/Mod/Draft/InitGui.py
03:55:31  Please look into the log file for further information
03:55:33  During initialization the error "No module named 'PySide2'" occurred in /Applications/FreeCAD.app/Contents/Mod/Arch/InitGui.py
03:55:33  Please look into the log file for further information
03:55:33  During initialization the error "No module named 'PySide2'" occurred in /Applications/FreeCAD.app/Contents/Mod/AddonManager/InitGui.py
03:55:33  Please look into the log file for further information
03:55:33  During initialization the error "No module named 'PySide2'" occurred in /Applications/FreeCAD.app/Contents/Mod/Tux/InitGui.py
03:55:33  Please look into the log file for further information
03:55:35  Unknown command 'Std_AddonMgr'
03:55:35  Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/Applications/FreeCAD.app/Contents/Mod/Start/StartPage/StartPage.py", line 30, in <module>
    from . import TranslationTexts
  File "/Applications/FreeCAD.app/Contents/Mod/Start/StartPage/TranslationTexts.py", line 24, in <module>
    from PySide import QtGui
  File "/Applications/FreeCAD.app/Contents/MacOS/PySide/__init__.py", line 2, in <module>
    from PySide2 import __version__
<class 'ModuleNotFoundError'>: No module named 'PySide2'
03:55:35  No module named 'PySide2'
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: Wed Mar 23, 2022 10:52 am Meanwhile you can build FreeCAD directly from source. I succeed on an M1 machine with that. Can later try with an Intel machine if you need help.
{/quote]
Does your M1 build still work? I note the .19.4 release doesn't support Mac or Linux (too busy preparing .20).
If your build script does work on intel, or even if you haven't tested, would it be possible to share it? I'm getting nowhere fast.
Regards
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 »

OK, sorry for the late response. I took me a while to undust my old Intel machine. Here is a very basic build setup for Mac Intel, which does not uses the SMESH or FEM module and does not build an App bundle to keep it as simple as possible.

Code: Select all

# install xcode-select dev tools, needed by the home-brew python@3.9 bottle
xcode-select --install

# make sure git, cmake and python3 are installed
brew leaves
# the returns lines should contain these packages
cmake
git
python@3.9

# check python path and version
which python3 && python3 --version
# this should show the info
/usr/local/bin/python3
Python 3.9.12

# create a FreeCAD folder and clone the freecad source into a freecad-source folder
mkdir -p freecad && cd freecad
git clone https://github.com/FreeCAD/FreeCAD.git freecad-source

# create a build directory
mkdir -p freecad-build && cd freecad-build

# install the base dependencies as per the wiki
brew tap freecad/freecad
brew install eigen
brew install --only-dependencies freecad

# link packages which where installed keg-only
# brew link icu4c -> this somehow fails, as linking icu4c under Mac Intel is prohibited, Mac M1 is ok, we will set the path later
brew link pyside@2 tbb@2020

# export path to installed dependencies
export PREFIX_PATH="\
  /usr/local/opt/coin3d;\
  /usr/local/opt/hdf5;\
  /usr/local/opt/opencascade@7.5.3;\
  /usr/local/opt/qt@5;\
  /usr/local/opt/vtk@8.2;\
  /usr/local/opt/xerces-c"

# prepare cmake with a minimal setup
cmake \
  -DCMAKE_BUILD_TYPE="Release" \
  -DBUILD_ENABLE_CXX_STD=C++17 \
  -Wno-dev \
  -DPYTHON_EXECUTABLE=/usr/local/bin/python3 \
  -DPYTHON_INCLUDE_DIR=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 \
  -DPYTHON_LIBRARY=/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib \
  -DBUILD_SMESH=OFF \
  -DBUILD_FEM=OFF \
  -DCMAKE_PREFIX_PATH="$PREFIX_PATH" \
  -DCMAKE_INSTALL_PREFIX="./.." \
  ../freecad-source

# set path to icu4c library
export LIBRARY_PATH="/usr/local/opt/icu4c/lib"

# start the build using the cmake —build command, but pipe it through 'time' to measure build duration
# set the -j number according to your available cpu cores, which you can check with 'sysctl -n hw.logicalcpu'
time sh -c 'cmake --build . -j8'
The build should succeed and you can find the executable under freecad-build/bin/FreeCAD. On start this opens a separate Terminal window and the FC Gui should come up.
Last edited by doia on Thu Mar 31, 2022 2:05 pm, edited 1 time in total.
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: Wed Mar 30, 2022 10:24 am OK, sorry for the late response. I took me a while to undust my old Intel machine. Here is a very basic build setup for Mac Intel, which does not uses the SMESH or FEM module and does not build an App bundle to keep it as simple as possible.
Thanks!

I'm working through a post by ipatch https://github.com/FreeCAD/homebrew-fre ... git-master dated a few days ago. Its not working yet. Coin3D, PySide2 errors.

Next I'll go wipe that and try yours. If you fired it up, could I impinge on you to show the output? I think there are some things that might appear wrong, but don't matter?
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 »

Yeah, just post here for further help.

I just saw the post by @ipatch you mentioned, but [edited] it is very confusing to me. I don‘t understand all of the magic he does yet and could not reproduce the script. Maybe I missed some of the steps.
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: Wed Mar 30, 2022 6:17 pm Yeah, just post here for further help.
Cool. Just preparing a new Monterey volume. In the mean-time, is there a reason why the path to icu4c is set after the make cmd? I guess I'm getting picky - want to document this all as precisely as possible when it finally works.
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 »

No reason at all. AFAIK you could also put it before the cmake command.

On macOS Monterey Intel, the command brew link icu4c does not work, as macOS provides some part of this library. You would need brew link icu4c --force to link the homebrew package. Yet I haven't tried the linking of this package, instead provided the path as described. Not providing the path results in an error during cmake --build .

I just checked on macOS Monterey M1, there icu4c was not linked as well. But somehow there is no error during cmake --build. I do not (yet) know the reason why.
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: Wed Mar 30, 2022 6:17 pm Yeah, just post here for further help.
OK, moved to your suggestions, clean Monterey volume.

Code: Select all

CMake Deprecation Warning at CMakeLists.txt:8 (cmake_policy):
  The OLD behavior for policy CMP0072 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- The C compiler identification is Clang 13.0.1
-- The CXX compiler identification is Clang 13.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - 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: /usr/local/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiler: Clang, version: 13.0.1
-- 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: /usr/local
-- bindir: bin
-- datadir: share
-- docdir: share/doc/FreeCAD
-- includedir: include
-- libdir: lib
-- cmake: 3.23.0
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.9.3") found components: doxygen missing components: dot
-- Detected Homebrew install at /usr/local
CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:77 (message):
  Failed to determine PYTHON_INCLUDE_DIR
Call Stack (most recent call first):
  CMakeLists.txt:45 (SetupPython)


CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:89 (string):
  string sub-command STRIP requires two arguments.
Call Stack (most recent call first):
  CMakeLists.txt:45 (SetupPython)


CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:91 (message):
  Failed to determine PYTHON_LIBRARY
Call Stack (most recent call first):
  CMakeLists.txt:45 (SetupPython)


CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:100 (string):
  string sub-command STRIP requires two arguments.
Call Stack (most recent call first):
  CMakeLists.txt:45 (SetupPython)


CMake Error at cMake/FreeCAD_Helpers/SetupPython.cmake:102 (message):
  Failed to determine PYTHON_LIBRARY
Call Stack (most recent call first):
  CMakeLists.txt:45 (SetupPython)


-- Found Python3: /usr/local/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.12") 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/MacOSX12.3.sdk/usr/lib/libz.tbd (found version "1.2.11") 
-- PyCXX found:
--   Headers:  /Users/bernie/freecad/FreeCAD/src
--   Sources:  /Users/bernie/freecad/FreeCAD/src/CXX
--   Version:  6.2.8
CMake Warning (dev) at /usr/local/Cellar/cmake/3.23.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (OCC) does
  not match the name of the calling package (OpenCasCade).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cMake/FindOpenCasCade.cmake:120 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:51 (SetupOpenCasCade)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find OCC (missing: OCC_INCLUDE_DIR) 
CMake Error at cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:6 (message):
  ================================================================

  Neither OpenCASCADE Community Edition nor OpenCASCADE was found!

  ================================================================

Call Stack (most recent call first):
  CMakeLists.txt:51 (SetupOpenCasCade)


-- Configuring incomplete, errors occurred!
See also "/Users/bernie/freecad/build/CMakeFiles/CMakeOutput.log".
See also "/Users/bernie/freecad/build/CMakeFiles/CMakeError.log".
./makefc_3: line 56: -DCMAKE_BUILD_TYPE=Release: command not found
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 »

Did you specify the paths with export PREFIX_PATH= ...? Can you post your complete workflow from folder setup, package installs with homebrew and cmake command?

The [export PREFIX_PATH=" \] and [cmake \] commands must be entered/copied as complete block into the terminal prompt.

The error messages [string sub-command STRIP requires two arguments.], [Use -Wno-dev to suppress it.] and [./makefc_3: line 56: -DCMAKE_BUILD_TYPE=Release: command not found] suggest that there was some typo in the cmake command and it is not interpreted as a complete block with all argument, but instead line after line.
Post Reply