Got error after successful build using CMake on Mac OSX High Sierra. Qt5 was installed using Qt Online Installer for macOS. The error message when running Dolphin.
This page contains changes which are not marked for translation.
Deutsch • English • Türkçe • español • français • italiano • polski • português • português do Brasil • română • svenska • čeština • русский
Next: Compile on Docker
There is an experimental FreeCAD Docker container that is being tested for FreeCAD development. Read more about it at Compile on Docker
Overview
This page describes how to compile the FreeCAD source code on MacOS X. For other platforms, see Compiling.
These instructions have been tested on macOS Catalina with standard XCode 11.6. It is known to work on macOS BigSur Beta with XCode 12.0 beta. If you plan to use XCode Beta, please be sure to download Command Line Tools add on through a dmg package to workaround some libz dependency issues.
This page serves as a quick start, and is not intended to be comprehensive with regard to describing all the available build options.
If you just want to evaluate the latest pre-release build of FreeCAD, you can download pre-built binaries from here.
Install Prerequisites![]()
The following software must be installed to support the build process.
Homebrew Package Manager
Homebrew is a command line based package manager for macOS. The Homebrew main page provides an installation command line that you simply paste into a terminal window.
CMake
CMake is a build tool that generates a build configuration based on variables you specify. You then issue the 'make' command to actually build that configuration. The command-line version of CMake is automatically installed as part of the Homebrew installation, above. If you prefer to use a GUI version of CMake, you can download it from here.
Install Dependencies
FreeCAD maintains a Homebrew 'tap' which installs the required formulas and dependencies. Issue the following brew commands in your terminal.
Notes:
Get the source
In the following instructions, the source and build folders are created side-by-side under
but you can use whatever folders you want.
The following command will clone the FreeCAD git repository into a directory called FreeCAD-git.
Create the build folder.
Run CMake
Next, we will run CMake to generate the build configuration. Several options must be passed to CMake. The following table describes the options and gives some background.
CMake Options
Note: Command line to generate CMAKE_PREFIX_PATH:
CMake GUI
Open the CMake app, and fill in the source and build folder fields. In this example, it would be /Users/username/FreeCAD/FreeCAD-git for the source, and /Users/username/FreeCAD/build for the build folder.
Next, click the Configure button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default Unix Makefiles. Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the Advanced checkbox to get all of the options.
Set options from the table above, then click Configure again and then Generate.
CMake command line
Enter the following in the terminal.
export PREFIX_PATH='/usr/local/opt/qt/lib/cmake/;/usr/local/Cellar/nglib/v6.2.2007/Contents/Resources;/usr/local/Cellar/[email protected]/8.2.0_1/lib/cmake/'
Run make
Finally, from a terminal run make to compile and link FreeCAD, and generate the app bundle.
The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.
See also Compiling - Speeding up.
If make finishes without any errors, you can now launch FreeCAD by double clicking the executable in the Finder.
Updating from GithubCmake Macos App Bundle Windows 10
FreeCAD development happens fast; every day or so there are bug fixes or new features. To get the latest changes, use git to update the source directory (see Source code management), then re-run the CMake and make steps above. It is not usually necessary to start with a clean build directory in this case, and subsequent compiles will generally go much faster than the first one.
Building with Qt4 and Python 2.7
FreeCAD has transitioned from Qt 4 to Qt 5 as well as homebrew. Qt 4 is no longer available as an option for new build on macOS following Qt 5 transition. Python 2.7 has been deprecated within homebrew and upcoming macOS and we do not support it anymore for macOS build either.
TroubleshootingSegfault on Qt5 launch
If Qt4 was previously installed via brew, and you then build with Qt5, you may get a EXC_BAD_ACCESS (SEGSEGV) exception when launching the new Qt5 build. The fix for this is to manually uninstall Qt4.
Fortran
'No CMAKE_Fortran_COMPILER could be found.' during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do 'brew install gcc' and try configuring again, giving cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!
OpenGL
See OpenGL on MacOS for OpenGL issues when Qt 4.8 and earlier are used on MacOS.
FreeType
When using CMake versions older than 3.1.0, it's necessary to set CMake variable FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2
Next: Compile on Docker
User documentation
Macos Install Cmake
Cmake Macos App Bundle Download
Retrieved from 'http://wiki.freecadweb.org/index.php?title=Compile_on_MacOS&oldid=790199'
Hi guys,
Cmake Macos App Bundle AppI've been searching and bashing my head on this for the last two weeks and would love some help. I'd even pay someone at this point (no joke) just to make progress and move back to the actual coding of my game again. This is my first post here too, so sorry if I miss some information. I'd be happy to copy and paste any more relevant code samples. Desperation aside, let me begin: Cmake Macos App Bundle AndroidProblem: I have a fairly simple game I'm starting and want to build an App file to distribute for testing etc. on another machine. My game is using CEGUI and only really seems to have trouble properly linking / bundling CEGUI in a way that can work on another computer. The game does run fine from where it builds to before attempting the bundle because it was finding CEGUI dylibs from '@executable_path/../Frameworks' and I copied all the dependencies that were built to a folder to match this in my project directory.How I built/installed CEGUI: I'm using OSX and cloned both the CEGUI and CEGUI-dependencies repositories and then switched to the 0.8.x branches. Inside the dependencies project, I created a new 'build' folder, cd to it, and run 'cmake ..'. After it finishes, I build it with just 'make'. Once dependencies are built, I go to cegui, make the 'build' folder, make a new symbolic link to cegui-dependencies/build/dependencies as 'dependencies' in the cegui directory, cd to my new build directory and 'cmake ..', 'make', and 'sudo make install'. This might be part of my problem, I know on other posts / docs that it was recommended not to install. But, I've chosen to install it because I don't know how else I am to get my project to find CEGUI at all. After a bit of searching, I did find a 'FindCEGUI.cmake' file that I put in with my other cmake scripts in my project. I found that this does seem to pick up my CEGUI dylibs from the install location just fine, so I feel good there. The problems started happening as I now wanted to learn how to make the bundle for OSX. I quickly discovered 'fixup_bundle' and with some trial and error I eventually got this to find my App file and go. I've added /usr/local/lib to my directories it searches for libraries and it ends up finding everything just fine. But, it won't find the CEGUI dependency dylibs (yet another problem!). So, with much more trial and error, I've set up some CMake to copy these over:
Code: Select all
SET(FRAMEWORKS You might notice that I'm actually copying to 'MacOS' instead of 'Resources' or really 'Frameworks' like the default setting is looking for. I had trouble with fixup_bundle ignoring my files I copied to Frameworks and just adding yet another copy to the executable location (MacOS). So, I rebuilt CEGUI with the option to change the install name to just '@executable_path' and now I don't have duplicate CEGUI libraries being pulled in at least. So, here's where my crazy problems all begin and the last week now has been mostly trying to figure out this dylib linking mess. I've gone with trying to copy just the minimum amount of dylibs (above script) one by one until it runs and it'll be great on my computer. But, somewhere something is still referencing a dylib installed at /usr/local/lib/cegui-0.8 again and I can't find it with otool -L on all the files either. So, this won't work well. Here's the type of error for this that I typically see:
Code: Select all
CEGUI::GenericException in function 'CEGUI::DynamicModule::DynamicModule(const I've also tried not copying any of the libraries over with that crazy scripts and just let fixup_bundle find it and I generally still get the same dynamicModule issue. I'll sometimes just get a plain Seg Fault when trying to run the executable directly via running it directly in console ./RpgClient.app/Contents/MacOs/RpgClient. Did I miss some best practices on including CEGUI in a project of your own that is using Cmake and plan on bundling? What can I do as some next steps to try? I'm currently trying a 3rd build of CEGUI with '@rpath' as the install_name and trying to figure out if I can somehow make CMake agree with that now. But, it's giving me issues with trying to use my binary install directory to look up my resources now instead of resources folder like before (using SDL_GetBasePath()) Here's just the essentials of the CEGUI.log from when it does run successfully. Which I can usually do by not running make install and then running the executable directly in console. Opening the App file breaks under most things I've tried still besides my first example of failure above. Which was the closest and most excited I was for having this 'work' until I tried another computer haha.
Code: Select all
07/10/2017 05:48:55 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |