Building Fritzing for Mac (x86_64 and ARM64) - bobwolff68/fritzing-app GitHub Wiki

Three of the key prerequisite open source libraries Fritzing relies upon are Qt Creator, libgit2, and boost.

The building of libgit2 is facilitated by a helper script found in tools/macPrebuild.sh

To build this portion, from the fritzing-app/ folder, execute:

tools/macPrebuild.sh

This will yield ../libgit2/build/libgit2.a which is a static build in both x86_64 and ARM64 variants. It will also yield a folder ../boost_1_76_0/ which will be utilized during the build process.

For Qt in an x86_64 build, one can go to boost's website, download the installer, and install the pre-built version of 5.15.

In the case of Qt for Mac M1 ARM64, one must (currently) build the Qt library from open source. Please see https://github.com/bobwolff68/fritzing-app/wiki/Building-Qt-5.15-for-Mac-M1 for detailed instructions.

In the end, the goal is to utilize Qt's qmake to build appropriate Makefiles and then utilize make to build Fritzing. Note: Currently there is no "Universal build" possible on Qt and as such the Mac builds of Fritzing are also not universal binaries.

Build of Fritzing Makefiles for x86_64

Let's presume your home location of your Qt you installed is in: ~/Qt/5.15.2/. In this case, we'll want to invoke qmake from the installed location. This will create a Makefile.release which you'll build in a later step.

~/Qt/5.15.2/clang_64/bin/qmake phoenix.pro

Build of Fritzing Makefiles for ARM64 Mac M1

You'll need to hand edit the phoenix.pro file and look for QMAKE_APPLE_DEVICE_ARCHS=arm64. As is noted in the comments in the .pro file, you'll want to specify arm64 instead of x86_64. Be sure to comment out the x86_64 line now that you're using the arm64 version.

At this point, you need to run qmake from your hand-built version of Qt for Mac M1. Let's assume you've done your Qt M1 build in ~/dev/Qt-firstM1Port/ . This would imply the qt5build folder and associated output binaries are in: ~/dev/Qt-firstM1Port/qt5build/qtbase/bin/ To create your Makefiles:

~/dev/Qt-firstM1Port/qt5build/qtbase/bin/qmake phoenix.pro

Finally, let's build Fritzing-app

/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.Release

In the case of x86_64, the resultant files will be in ../release64 and ../debug64.

In the case of ARM64 Mac M1, the resultant files will be in ../releasearm64 and ../debugarm64 if you built in debug mode.

The final Fritzing.app/ folder is also found in those release/debug folders.

Alternative Qt Creator build via Qt Creator

It is perfectly fine to utilize Qt Creator to build Fritzing also. It was not done as part of these instructions since the user interface changes over time and can be problematic in getting a repeatable build for new users. The purpose of this document was primarily to ensure a repeatable ability to build for new developers. Once this is accomplished, moving to Qt Createor makes a lot of sense for many developers.

Running Frizting the FIRST TIME

Fritzing must initialize its parts database the first time it is run from a new build. And this can be done via the command line or via Qt Creator, but again is less problematic to be done from the command line.

Let's assume your final build of Fritzing is found in /Applications/Fritzing-M1.app/ and your git repo was cloned and built from ~/dev/fritzing-app/ and finally that fritzing-parts is found in ~/dev/fritzing-parts/. The command line needs to look like:

/Applications/Fritzing-M1.app/Contents/MacOS/Fritzing -f "~/dev/fritzing-app/" -parts "~/dev/fritzing-parts/" -db "~/dev/fritzing-parts/parts.db"

Running Fritzing AFTER the first parts-db initialization

We'll make the same location assumptions as in the initial first time run. To run Fritzing, execute the following:

/Applications/Fritzing-M1.app/Contents/MacOS/Fritzing -f "~/dev/fritzing-app/" -parts "~/dev/fritzing-parts/"