macos packaging using homebrew

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
User avatar
ipatch
Posts: 112
Joined: Wed Apr 08, 2020 3:40 pm
Location: dfw
Contact:

macos packaging using homebrew

Post by ipatch »

i've been using macos homebrew and several different versions of the OS to build and test freecad from git master for a little while now. i've uploaded a few DGM releases of the FreeCAD.app bundle to the homebrew-freecad tap hosted on github.

---

https://github.com/FreeCAD/homebrew-fre ... -26155.dmg

---

i've been trying my best to make sure most if not all things are working. that release seems to have more things working and included than the prior release or two that i have posted.

however something i have noticed is the addon manager appears to not work ie. i'm experiencing some runtime related issues using the addon manager. take a quick look at my app bundle, comparing and contrasting to the conda released bundles i see the conda releases are including a GitPython module that my bundle seems to be missing.

Code: Select all

cd /Applications/freecads/FreeCAD-0.20-26155-git.app/Contents/Resources
fd -t f 'gitpython'
compared to

Code: Select all

/Applications/freecads/FreeCAD.conda.0.20.26155.app/Contents/Resources
fd -t f 'gitpython'
conda-meta/gitpython-3.1.24-pyhd8ed1ab_0.json
---

i'm building freecad from git source and have most if not all dependencies installed via macos homebrew some from the provided tap others from upstream homebrew-core.

---

my cmake args look like the below

Code: Select all

cmake  \
-DHOMEBREW_PREFIX=$bp \
-DPYTHON_EXECUTABLE="$bp/bin/python3" \
-DPYTHON_INCLUDE_DIR=\
$bp/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 \
-DBUILD_SMESH=1 \
-DBUILD_FEM_NETGEN=ON \
-DCMAKE_PREFIX_PATH=\
"$bp/Cellar/vtk@8.2/8.2.0_7/lib/cmake;\
$bp/Cellar/qt@5/5.15.2_1/lib/cmake;\
$bp/Cellar/pyside@2/5.15.2_1/lib/cmake;\
$bp/Cellar/hdf5@1.10/1.10.7_1/lib;\
$bp/Cellar/nglib@6.2.2104/6.2.2104_1/Contents/Resources/CMake;" \
-DCMAKE_INSTALL_PREFIX="/opt/beta/freecad/amd64/release" \
-DFREECAD_CREATE_MAC_APP=1 \
-DCMAKE_BUILD_TYPE=Release \
-DINSTALL_TO_SITEPACKAGES=1 \
../freecad-src/
$bp is an environment variable i've set to my provided homebrew prefix as i use this macosvm for different use cases and this particular build user has macos homebrew setup in their respected $HOME directory.

---

doing a internet searches i came across a forum thread where the cmake args for the conda build were posted as the below

Code: Select all

cmake -G "Ninja" \
-D BUID_WITH_CONDA:BOOL=ON \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX:FILEPATH=$PREFIX \
-D CMAKE_PREFIX_PATH:FILEPATH=$PREFIX \
-D CMAKE_LIBRARY_PATH:FILEPATH=$PREFIX/lib \
-D CMAKE_INSTALL_LIBDIR:FILEPATH=$PREFIX/lib \
-D CMAKE_INCLUDE_PATH:FILEPATH=$PREFIX/include \
-D BUILD_QT5:BOOL=ON \
-D FREECAD_USE_OCC_VARIANT="Official Version" \
-D OCC_INCLUDE_DIR:FILEPATH=$PREFIX/include \
-D USE_BOOST_PYTHON:BOOL=OFF \
-D FREECAD_USE_PYBIND11:BOOL=ON \
-D BUILD_ENABLE_CXX11:BOOL=ON \
-D SMESH_INCLUDE_DIR:FILEPATH=$PREFIX/include/smesh \
-D FREECAD_USE_EXTERNAL_SMESH=ON \
-D BUILD_FLAT_MESH:BOOL=ON \
-D BUILD_WITH_CONDA:BOOL=ON \
-D PYTHON_EXECUTABLE:FILEPATH=$PREFIX/bin/python \
-D BUILD_FEM_NETGEN:BOOL=ON \
-D BUILD_PLOT:BOOL=OFF \
-D BUILD_SHIP:BOOL=OFF \
-D OCCT_CMAKE_FALLBACK:BOOL=OFF \
-D FREECAD_USE_QT_DIALOG:BOOL=ON \
-D BUILD_DYNAMIC_LINK_PYTHON:BOOL=OFF \
-D Boost_NO_BOOST_CMAKE:BOOL=ON \
-D FREECAD_USE_PCL:BOOL=ON \
-D INSTALL_TO_SITEPACKAGES:BOOL=ON \
${CMAKE_PLATFORM_FLAGS[@]} \
..
i don't remember the exact forum post i copied those from, but any help on how i can get the addon manager properly working would be AWESOME. i have little to know experience debugging python runtime issues, so any help would be greatly appreciated.

i'll link to a screenshot below showing what i presently seeing in regards to the addon manager.

Image
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

Hello IPatch,

the git libs are pure python code. So it is possible to install it as resource in the python formula:

Code: Select all

  resource "gitpython" do
    url "https://files.pythonhosted.org/packages/34/cc/aaa7a0d066ac9e94fbffa5fcf0738f5742dd7095bdde950bd582fca01f5a/GitPython-3.1.24.tar.gz"
    sha256 "df83fdf5e684fef7c6ee2c02fc68a5ceb7e7e759d08b694088d0cacb4eba59e5"
  end
  
  resource "gitdb" do
    url "https://files.pythonhosted.org/packages/fc/44/64e02ef96f20b347385f0e9c03098659cb5a1285d36c3d17c56e534d80cf/gitdb-4.0.9.tar.gz"
    sha256 "bac2fd45c0a1c9cf619e63a90d62bdc63892ef92387424b855792a6cabe789aa"
  end
Maybe the bundler have to add git. Or is git standard installed on MacOS?

Regards Benjamin
User avatar
ipatch
Posts: 112
Joined: Wed Apr 08, 2020 3:40 pm
Location: dfw
Contact:

Re: macos packaging using homebrew

Post by ipatch »

Gift

thanks for the suggestion, however i'm not installing freecad via

Code: Select all

brew install freecad/freecad/freecad
but rather installing the deps ie. vtk,occ,python@3.9,coin3d,...etc... via homebrew

so i'm doing a

Code: Select all

git clone https://github.com/freecad/freecad freecad-src
then creating a build directory and the same level as the freecad-src and then running,

Code: Select all

cmake ../freecad-src
make
make install
forgive if you already understand that, or if i'm misunderstading what it is your conveying.

all that said, would there be a particular dependency that i could add those resources too so when i bundle freecad via make install they get included into the `FreeCAD.app` bundle and hopefully thus providing the utilities / resources required to get the AddOn Manager working as intended.


---

UPDATE, reread what you typed, you state i should include those resources in the python formula. hmmm.
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

Sorry, it is not so simple. Please check this commit.
User avatar
ipatch
Posts: 112
Joined: Wed Apr 08, 2020 3:40 pm
Location: dfw
Contact:

Re: macos packaging using homebrew

Post by ipatch »

Gift,

before you added that commit, were you running into the same issue that i described above were the addon manager was/is not displaying a list of available workbenches?
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

ipatch wrote: Fri Nov 05, 2021 5:27 pm Gift,

before you added that commit, were you running into the same issue that i described above were the addon manager was/is not displaying a list of available workbenches?
No. It works fine.
Attachments
AddonManager.png
AddonManager.png (205.46 KiB) Viewed 4891 times
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

ipatch wrote: Fri Nov 05, 2021 5:27 pm Gift,

before you added that commit, were you running into the same issue that i described above were the addon manager was/is not displaying a list of available workbenches?
Please test this:

Code: Select all

import addonmanager_utilities as utils
u = utils.urlopen("https://raw.githubusercontent.com/FreeCAD/FreeCAD-addons/master/addonflags.json")
print(u.read())
User avatar
ipatch
Posts: 112
Joined: Wed Apr 08, 2020 3:40 pm
Location: dfw
Contact:

Re: macos packaging using homebrew

Post by ipatch »

Gift wrote: Sun Nov 07, 2021 5:58 pm
ipatch wrote: Fri Nov 05, 2021 5:27 pm Gift,

before you added that commit, were you running into the same issue that i described above were the addon manager was/is not displaying a list of available workbenches?
Please test this:

Code: Select all

import addonmanager_utilities as utils
u = utils.urlopen("https://raw.githubusercontent.com/FreeCAD/FreeCAD-addons/master/addonflags.json")
print(u.read())
---

this is what i'm seeing with your suggested commands,

Code: Select all

>>> import addonmanager_utilities as utils
>>> u = utils.urlopen("https://raw.githubusercontent.com/FreeCAD/FreeCAD-addons/master/addonflags.json")
>>> print(u.read())
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'read'
>>> 
i'm using this release i published a while back,

https://github.com/FreeCAD/homebrew-fre ... -26155.dmg
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

ipatch wrote: Sun Nov 07, 2021 8:27 pm
this is what i'm seeing with your suggested commands,

Code: Select all

>>> import addonmanager_utilities as utils
>>> u = utils.urlopen("https://raw.githubusercontent.com/FreeCAD/FreeCAD-addons/master/addonflags.json")
>>> print(u.read())
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'read'
>>> 
i'm using this release i published a while back,

https://github.com/FreeCAD/homebrew-fre ... -26155.dmg
Can you remove the exception in the source code for better error message? See here.

edit:

Code: Select all

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>
With your dmg I get the same issue.
Last edited by Gift on Sun Nov 07, 2021 9:19 pm, edited 1 time in total.
User avatar
Gift
Posts: 769
Joined: Tue Aug 18, 2015 10:08 am
Location: Germany, Sauerland

Re: macos packaging using homebrew

Post by Gift »

Post Reply