Wiki Directions for Mac Compile via Homebrew Not working

Having trouble installing or compiling FreeCAD? Get help here.
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Sun Aug 30, 2020 1:24 am

I've been playing with this for a couple of evenings and I can definitively say that using homebrew is going to take too much work and won't be a viable long term solution.

It's the typical macports/homebrew problem where they don't always check for package to package version conflicts the way Ubuntu or another tightly controlled packing system does.

In this case the first two things were:
1. Trying to get HDF5@1.10 to compile the MED format library. The FreeCAD build didn't seem to honor HDF5_DIR properly in cmake and was finding 1.12. Thus causing both 1.10 and 1.12 versions of HDF5 to be a transitive dep.

2. The PCL library version from homebrew doesn't work with the latest boost (1.73) from homebrew b/c of a deprecated header.

None of these issues are insurmountable, but without have better control of the homebrew taps dependencies are going to come and go and make a tangled mess.

Next I looked at the conda tooling... There're a couple of shell commands in the build tooling that I can't find the source for, such as "mangle_compiler" ... I looked through the feedstock repo and couldn't find it... maybe I missed where that gets sourced from.

A meta-build tool (conda-smithy) that generates directives for a packaging tool (conda) that then invokes a bunch of shell scripts which is tangled against YAML files to configure CI systems.

I just don't know where to start with that...

I'm trying the docker build now, since that seems to be the best approach. We'll see how it actually runs... again, I'm concerned that the graphics performance will be unusable.

My backup plan is to readjust the boost find CMake tooling in FreeCAD to set a max Boost Version (1.72? .. not sure what it would be) and try again. This seems wrong b/c its really a PCL (via homebrew) problem.

Seriously considering a Virtual Box VM with Ubuntu... GL Acceleration works fine there.
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Mon Aug 31, 2020 3:01 am

looo wrote:
Fri Aug 28, 2020 10:23 am
I gave instructions on how to build with conda several times. So I guess it's best to search in the forum. Also there is lot's of documentation for conda [1], conda-forge [2], conda-build[3]. Building FreeCAD is difficult. Conda tries to solve some things and actually it really works great for freecad (I guess we are doing the weekly builds for over a year now, 3 different os).
The downside is that people don't understand why there is a need for environments and how the whole process with conda-build works. I was lucky/unlucky to get introduced to conda the slow way. First, they used a much simpler setup, but it had problems. Then they switched to the current way of handling the builds which is more complicated but solves some of the issues. Understanding the issues one will understand the solution and so on.

Sorry for the rant, but if anyone wants to build with conda, please go ahead and get your hands dirty. If there are question please ask. And if you finally made it through go ahead and start documenting the necessary stuff. If I do the documentation on how to build with conda, this will not help a lot (at least this is the experience I made).

[1] https://docs.conda.io/en/latest/
[2] https://conda-forge.org/docs/
[3] https://docs.conda.io/projects/conda-build/en/latest/
I did try to get the conda tooling up and running on MacOS, but there are some rather unusual and opaque things that happen and so without having a good flow chart of how the build works it will take some time to get some reasonable developer tooling that could be used to setup a MacOS development environment where you can code-build-test quickly and cleanly using an isolated environment.

I completely understand why you need something like Conda with this. The dependency entanglement is just insane on Mac w/ homebrew. It's easier on Linux b/c Docker does the same thing as Conda... avoids "DLL Hell" as I've heard it called on Windows.

I'm happy to take another go at it, but it would really help if you had a one (or few) liner of the steps that the build uses and where those "feedstock" items are stored for each stage.

e.x: conda-smithy (https://...) -> conda-??? -> someshell script -> CMake -> some shell script -> package all the stuff. -> Profit?!?!?!
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Mon Aug 31, 2020 3:05 am

While I figure out how to get a Mac dev environment/build running with Conda.

I did prove that FreeCAD is usable on an Ubuntu 20.04 VM Guest using the Docker build directions on a MacOS VirtualBox Host.

The GL acceleration mostly works, but overall the UI is sluggish. I wouldn't want to try a complex design that way. It wasn't the best. It ran...
User avatar
looo
Posts: 3465
Joined: Mon Nov 11, 2013 5:29 pm

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by looo » Mon Aug 31, 2020 9:15 pm

jmdzampieron wrote:
Mon Aug 31, 2020 3:01 am
e.x: conda-smithy (https://...) -> conda-??? -> someshell script -> CMake -> some shell script -> package all the stuff. -> Profit?!?!?!
conda build <recipe-dir> -m <build-matrix.yaml>
1. is looking for the newest compatible dependency-tree with pinnings coming from the build-matrix file (stored in .ci_support)
2. creates a build and a host env. The build env includes packages which are only used for the build (like cmake), the host-env includes all the packages which are needed for linking or headers or stuff like this
3. the build script (build.sh, bld.bat) is called which builds the library and installs it to the host-env
4. The package is created from the difference between the host-env before and after building the library.
5. hardcoded absolute-paths are replaced by some placeholders.

conda debug <recipe-dir> -m <build-matrix.yaml>
same as conda-build but stops after 2. and prints commands to activate the build-env on top of the host-env to allow manual running the build files which are renamed to: conda_build.sh

calling "conda smithy rerender" inside a feedstock you can update all the files necesarry for the ci stuff (mainly azure) and also update the local pinnings (<build-matrix.yaml>) by the global pinnings which are stored in the conda-forge-pinning feedstock.

conda create -n <env-name> dep1 dep2 dep3
creates a new environement with the newest compatible dependency tree.

conda activate <env_name>
activaes an environment.

I hope this helps
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Tue Sep 01, 2020 3:41 pm

Yes. That's actually very helpful.

I've been able to get a local build using the conda tooling to work. It spits out a tar.bz2 file, which is great, however, it also nukes the source code copy it makes (aka build tree), so it's not very helpful if you want to use conda to setup a development environment.

I'm going to adjust the tooling to have an `environment.yml` file for conda and try that.

Interested ideas on how to keep the CI recipe in sync with the `environment.yml` file that would presumably be in the source tree.

I'm pick up conda relatively quickly... there's just a lot there.

Many thanks for the help and I'm sure folks already recognized the amazing effort you did to get the feedstock packages build and into conda-forge for many of the FreeCAD dependencies but I'll say thanks again. It made building on OSX possible without a herculean amount of work.
User avatar
sgrogan
Posts: 6087
Joined: Wed Oct 22, 2014 5:02 pm

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by sgrogan » Tue Sep 01, 2020 4:36 pm

jmdzampieron wrote:
Tue Sep 01, 2020 3:41 pm
Interested ideas on how to keep the CI recipe in sync with the `environment.yml` file that would presumably be in the source tree.
Maybe this gives some clues? https://forum.freecadweb.org/viewtopic.php?f=10&t=39889
"fight the good fight"
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Wed Sep 02, 2020 12:54 pm

The short answer on how to keep the receipt in sync with the `environment.yml` files is that you don't. (maybe?)

One set is for the CI build and packaging and needs to differentiate host, compile and runtime deps and the `environment.yml` files include all of the above b/c you are setting up the code/build/test cycle.

I'm actually kind of liking Conda when Docker can't solve this problem. My big complaint right now is that the conda environment.yml files and the conda-build meta.yml are not consistent in format and semantics. Tools like that should be self-consistent and integrate well.

I've opened a PR to continue discussion.

It builds and runs on my Mac under OS X 10.15.x using the conda recipe that I pulled in from Looo's repo.

I'll try out Linux later today. It should be virtually the same build process for Linux and Mac now. I just need to test it and debug anything I missed on the Linux side.

I need to actually do some drafting today so I'll see if I run into any bugs. Some of the unit tests have some issues, but I didn't change any code and I did rebase against master a few minutes ago, so I'm not sure what's up there... a missing python package or something? Input from someone who knows the FreeCAD code appreciated in the PR.

PR is here: https://github.com/FreeCAD/FreeCAD/pull/3840
User avatar
sgrogan
Posts: 6087
Joined: Wed Oct 22, 2014 5:02 pm

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by sgrogan » Thu Sep 03, 2020 9:02 pm

jmdzampieron wrote:
Wed Sep 02, 2020 12:54 pm
I've opened a PR to continue discussion.
Great work thanks! Congrats on your PR being merged.

I don't know if your interested, but... https://forum.freecadweb.org/viewtopic. ... 20#p426433
If you are interested in trying to provide a .dmg from 1 of the pull request branches that would be great.
This might be of interest https://github.com/realthunder/FreeCADMakeImage

Even if your not interested in this, Thanks for the work you have done already :)
"fight the good fight"
jmdzampieron
Posts: 20
Joined: Wed Aug 26, 2020 1:44 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by jmdzampieron » Fri Sep 04, 2020 12:46 am

I put a note over in the other thread. I'm not sure I fully grasp the ask.

I'm on vacation this week and one of my projects is drafting some stuff for my house, so I kind of fell into this. I'm also trying to learn to _use_ FreeCAD as well as build it.

There's quite a lot here... I'm very used to the Autocad 2d way of doing things, so going 3d is proving interesting. Perpendicular to what axis exactly? How to do I align that window to the midpoint of that wall section? :)

My time will get much more limited once I'm back on a work schedule, but I hope to stay with this.

I do a fair bit of wood working and home improvement as a hobby and I like to draft it first so I see using FreeCAD to be a fairly ongoing, if not constant thing.
chrisb
Posts: 27898
Joined: Tue Mar 17, 2015 9:14 am

Re: Wiki Directions for Mac Compile via Homebrew Not working

Post by chrisb » Fri Sep 04, 2020 4:09 am

Thanks for your work on the Mac version. Of course you are welcome to ask for support concerning models so we can give something back. You can also just upload some files and ask for recommendations. I am not familiar with Arch and BIM, but I hopefully can help with some woodworking models.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests