Skip to content

Build Mac

Randall C. O'Reilly edited this page Mar 16, 2021 · 2 revisions

Build Mac

See Dependencies for list of all the external dependencies.

The standard Install Mac provides almost everything you need to also build the software from source -- start by doing this regular install. As of version 8.5 we have updated the emergent_install_mac_deps script to use the HomeBrew package management system for most of the dependencies -- if you haven't run that yet, it is recommended to get more automatic support for different OS versions etc.

Then follow these additional steps:

  • Install xcode -- it is a free download on the Mac AppStore: https://itunes.apple.com/us/app/xcode/id497799835?mt=12

  • Agree to the Xcode license, and then install the command-line tools and important include paths etc. Open a terminal window and execute these commands. You'll need to type "agree" after viewing the agreement that you didn't read.

$ sudo xcodebuild -license
$ xcode-select --install

You need to specify the path to QT5. Add the following line to your .bashrc or .bash_profile (or analogous) file in your home directory:

$ export QTDIR=/usr/local/Qt5.9.3/5.9.3/clang_64 

Open a new terminal window or source the .bashrc script and check that the command:

which svn 

returns /usr/local/bin/svn

and that

echo $QTDIR

returns /usr/local/Qt5.9.3/5.9.3/clang_64

If you're upgrading from earlier versions, it is recommended that you remove your entire emergent directory. Definitely at least include the 'clean' option to configure.

Download the source, wherever you want -- will make a cemer directory there:

$ git clone https://github.com/emer/cemer
$ cd cemer

In your new cemer directory do:

$ ./configure qt5 webkit clean # (or do --help to see all the options) -- we are using webkit instead of webengine now to avoid a bug in webengine on Qt 5.9.3
$ cd build
$ make
$ sudo make install

Alternative builds

  • Build-Mac-Xcode -- use the xcode gui development environment
  • Build-Mac-Homebrew -- uses the homebrew packaging system to handle all the dependency libraries (we are mostly doing this already now)

Troubleshooting

fatal error: QtCore/qsystemdetection.h file not found

If you get this error reinstall the Xcode command line tools

$ xcode-select --install
$ ./configure --qt5  --clean # (or do --help to see all the options)
$ cd build
$ make
$ sudo make install

then restart the build process from the emergent directory - using the "clean" option if you get apr and apu not found errors

-- No apr includes found, subversion support will be disabled 
-- No apu includes found, subversion support will be disabled 

The fix is usually to link the apr and apr-util includes, do this:

$ brew install apr (probably will say already installed)
$ brew link apr (you'll get a warning - follow instruction to edit PATH environment variable)

now the same for apr-util:

$ brew install apr-util
$ brew link apr-util (you'll get a warning - follow instruction to edit PATH environment variable)

now:

$ ./configure qt5 webkit clean # (or do --help to see all the options) -- we are using webkit instead of webengine now to avoid a bug in webengine on Qt 5.9.3
$ cd build
$ make
$ sudo make install

ODE link errors

I got these errors installing on a clean machine.

Undefined symbols for architecture x86_64:
  "_ccdFirstDirDefault", referenced from:
      ccdCollide(dxGeom*, dxGeom*, int, dContactGeom*, int, void*, void (*)(void const*, _ccd_vec3_t const*, _ccd_vec3_t*), void (*)(void const*, _ccd_vec3_t*), void*, void (*)(void const*, _ccd_vec3_t const*, _ccd_vec3_t*), void (*)(void const*, _ccd_vec3_t*)) in libode.a(collision_libccd.o)
...
ld: symbol(s) not found for architecture x86_64

The problem and fix (if you have previously run emergent on the machine) is described in this forum page https://github.com/robotology/icub-main/issues/514 -- basically it is trying to link to libccd but our cmake script is not detecting this fact because libode.a is typically compiled as a static library. Furthermore, we don't really want to install yet another bleeping library.

Got this again (10/2019) after doing a brew upgrade and finally just added a FindCCD.cmake script -- hopefully it doesn't screw up builds where it isn't found. If you get this, svn up to latest source and reconfigure and it should find libccd and everything should be ok..

emergent.app Bundle info

When you Install Mac it automatically installs an emergent.app bundle in /Applications. The source for this bundle is in install_mac_app/emergent.app. You can also go to that directory and type, open emergent.app to run the software. If you want to create new ".app" bundles to link to different versions of emergent, you can just copy this directory (e.g., cp -av emergent.app emergent_dbg.app) and go into the directory and change the symbolic link under Contents/MacOS/emergent and the Info.plist information. There are also .app bundles in the top level that link directly into the build and build_dbg directories, for running non-installed code as a bundle instead of just as a command-line app (this gives it proper gui menu focus etc): emergent_build.app and emergent_build_dbg.app.

ccmake and install errors

If a file that was present during the last time cmake configured itself is subsequently removed, you'll get this kind of install error:

CMake Error at prog_lib/cmake_install.cmake:31 (file):
  file INSTALL cannot find
  "/Users/oreilly/emergent/prog_lib/ObjectsEnv.prog".
Call Stack (most recent call first):
  cmake_install.cmake:105 (include)

To fix this, in your build directory, do:

$ ccmake ../

then hit c (configure) and then g (generate) then e (exit)

then build again.