D. Building GrblController for the Mac

Building Mac OSX 10.6 or greater (Intel 64 bit)

The easiest way to build is to have XCode installed on your Mac, then install from qt-project.org and build from the command line.

Presuming you have installed Qt 5.x from qt-project.org, here are the steps you need to take to build:

If using QtCreator IDE:

  1. If you have upgraded from 4.x, it is strongly recommended you clone the latest GrblHoming project as any existing project may have old configurations that can cause problems
  2. Open your project in Qt Creator (open GcodeSenderGUIthreads.pro).
  3. You will be offered a location for the compiled files; if they look good, click Configure Project
  4. Qt Creator will begin evaluating and parsing
  5. Ensure you are building via XCode compiler in your settings.
  6. Click the Build icon to build. Make sure things are ok at this point (normally you would just Run and it would automatically build for you)
  7. Click the Run icon to run (Note: In post-3.4.3 I changed the Q_WS_MACX to Q_OS_MACX, which means that if you are running Qt 5.x then 3.4.3 or earlier will not compile with the newer Qt environment.
From the command line:
  1. Now that you have confirmed proper compilation, build on the command line. Open terminal and cd to GrblHoming, then run the following (macx-clang is for XCode, macs-g++ is g++, but there are problems with g++): ~/Qt5.1.1/5.1.1/clang_64/bin/qmake -config release -spec macx-clang GCodeSenderGUIthreads.pro
  2. Followed by ‘make’
  3. And create an installer (if using g++, include -no-plugins): ~/Qt5.1.1/5.1.1/clang_64/bin/macdeployqt GrblController.app -dmg

Here is the original build instructions for Qt 4.x. Notice that the Nokia Qt generates a working dmg from g++. There may be a way to do this with the qt-project.org Qt, but I haven’t had success yet.

By default, Qt builds for 64 bit OSX, so the procedure is simple. Note: I have noticed problems when compiling via the Qt Project SDK, creating a dmg and then installing on the same Mac, the app crashes. Installing on another Mac works ok. It is not clear why this happens; it may also occur building with XCode or the Nokia SDK.

1. Go to the Nokia site and download the latest Qt SDK, or follow instructions above on installing and building the SDK from Qt Project.

2. If you already have installed Qt libraries from Qt Project, then you may need to uninstall them using the provided python uninstaller script in /Developer/Tools, i.e. open terminal to that folder and type sudo python <uninstallername>. Normally this isn’t needed if you are running from within the SDK’s folders.

3. Install the Qt SDK, which typically will install under the user’s home folder.

4. Put the GrblHoming project into a folder such as off your home folder (pull down off github). Remove any previously built apps or temporary files that exist in the folder.

5. In the SDK folder there is a Qt Creator. Start it.

6. Open the GrblHoming project’s .pro file as a project in Qt Creator

7. Pick the release build (the selector in the lower left)

8. Perform a Build All or Rebuild All. You shouldn’t get any errors during compiling or linking.

9. Run the compiled app (GrblController) to make sure it works

10. A GrblController.app file was also created in the release folder (one level up from GrblHoming). Open a command window to that folder. You can check to make sure it is including the correct libraries by running:

otool -L GrblController.app/Contents/MacOs/GrblController

11. Build the DMG installer file. Adjust this path as appropriate:

~/QtSDK/Desktop/Qt/4.8.1/gcc/bin/macdeployqt GrblController.app -no-plugins -dmg

12. Copy the created dmg file to another Mac running 64 bit OSX

On the second Mac:

13. Run the dmg file to install GrblController

14. Download and install 64 bit Mac OSX USB drivers:

http://www.ftdichip.com/Drivers/VCP.htm

15. Plug in your GrblShield Arduino (or equivalent) via USB

16. Run GrblController and pick the appropriate COM driver – you are now ready to start using GrblController

Building Mac OSX 10.6 or greater (Intel 64 bit for Core Duo) – Using QMake

Note: Qt Creator uses qmake behind the scenes, so the end results should be identical using the manual process here.

You should be able to do the following in the GrblHoming folder at the command prompt:

1. Give this command ~/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake -config release -spec macx-g++ GCodeSenderGUIthreads.pro

2. Do a make clean

3. Do a make

4. No errors should be generated, you should have a GrblController.app file in the folder

5. Give this command:  ~/QtSDK/Desktop/Qt/4.8.1/gcc/bin/macdeployqt GrblController.app -no-plugins -dmg

6. You can now install via the generated .dmg file.

Building for Mac OSX 10.5 (Intel 32 bit for Core Duo) on Mac OSX 10.6 or greater

These steps were performed on a newer Mac (Mountain Lion) to create a 32 bit installer for older 32 bit Intel Macs. The result was tested on a Macbook Intel Core Duo 32 bit running OSX 10.5. You will not need Qt Creator for these steps…

1. Go to Qt Project and click on link the Nokia ftp site and download the 4.7.3 carbon installer.

2. If you already have installed the Qt libraries from Qt Project, then you will need to uninstall them using the provided python uninstaller script in /Developer/Tools, i.e. open terminal to that folder and type sudo python <uninstallername>.

3. Install the 4.7.3 carbon libraries (qt-mac-carbon-opensource-4.7.3.dmg)

4. Run the following command to double-check if you have the correct framework installed:

lipo -info /Library/Frameworks/QtGui.framework/QtGui

It should report this:

Architectures in the fat file: /Library/Frameworks/QtGui.framework/QtGui are: i386 ppc

5. Put the GrblHoming project into a folder (pull down off github). Remove any previously built apps or temporary files. For example, if you previously built the 64 bit version, rename GrblController.dmg to GrblController64.dmg, remove the folder GrblController.app. Then do a make clean.

6. Edit the .pro file in GrblHoming and add the following near the top (don’t add “ppc” unless you have the needed libraries) and save (do this only for 32 bit builds, remove it if you want regular builds):

CONFIG -= x86_64 ppc64

CONFIG += x86

7. Manually compile your code by first running qmake as follows. We are specifying macx-g++ rather than xcode because some Xcode installs don’t support the generated xcode project file:

/Developer/Tools/Qt/qmake -config release -spec macx-g++ GCodeSenderGUIthreads.pro

8. Type make to compile the project into a .app file – you shouldn’t get any errors during compiling or linking. Warnings are ok.

9. Run the compiled app (GrblController) to make sure it works (the 32 bit app will run on 64 bit OSX)

10. In theory, a GrblController.app file was also created. You can check to make sure it is including the correct libraries by running:

otool -L GrblController.app/Contents/MacOs/GrblController

11. Build the DMG installer file

/Developer/Tools/Qt/macdeployqt GrblController.app -no-plugins -dmg

12. Copy the created dmg file to the 32 bit OSX Mac

On the 32 bit OSX Mac:

13. Run the dmg file to install GrblController

14. Download and install 32 bit Mac OSX USB drivers:

http://www.ftdichip.com/Drivers/VCP.htm

15. Plug in your GrblShield Arduino (or equivalent) via USB

16. Run GrblController and pick the appropriate COM driver – you are now ready to start using GrblController

2 thoughts on “D. Building GrblController for the Mac

  1. Any chance of a Mac build for 3.5?
    I have tried the Qt route, but I am getting an error when /i try:
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>