Page MenuHomePhabricator

Some tests fail on Mac since boost lib is not found
Closed, ResolvedPublic

Description

On Mac OS X some tests fail on MITK-MBI Dashboard. The reason for that is that a certain boost lib could not be loaded:

http://mbits/cdash/testDetails.php?test=2069001&build=114082

It is peculiar that there are also tests in MITK which fail due to that error (this is not the case on the MITK Dashboard).
I did a little bit research: The path which is passed to the linker is correct and the lib does exist (see attachment). However in the TestDrivers there is no path but just the name of the lib (screenshot attached).

Sascha suggested to set the cmake variable "link_directories" in the testing folder.

Path_in_testdriver.png (458×1 px, 176 KB)

Related Objects

StatusAssignedTask
ResolvedNone

Event Timeline

After some research we figured out the problem. On Mac OS X system each shared library usually has a install name which basically is the absolute path of the library. For some reason boost libs do not have the absolute path but just the name of the lib (in this case "libboost_thread.dylib")
According to the boost documentation for Mac OS X there are several ways to work around this issue:

  • Change the install name using the install_name tool on mac
  • Add the directory of the boost lib to the system path
  • Copy the boost lib to some place where the linker is looking for it (e.g. /usr/lib or the directory in which the executable lies)

After talking to sascha we decided that the best solution would be to change the boost install path simply to the folder of the mitkWorkbench executable.

Changing product since this concerns the MITK build system.

New remote branch pushed: bug-12005-boostThreadLib-cannot-be-found-on-mac

I had a look at the changes in your branch. I would actually prefer to change the install prefix for the boost libraries consistently on all platforms, i.e. not only of MacOS, to reduce platform specific differences.

Further, I would suggest to keep the original bjam --prefix argument and instead add the --libdir=${CMAKE_CURRENT_BINARY_DIR}/MITK-build/bin to the bjam invocation line. This should only place the Boost libraries into the MITK build tree and not the complete Boost install tree (headers etc.).

This means we propably have to add a line like

if(NOT MITK_USE_SYSTEM_Boost)

set(BOOST_LIBRARYDIR ${MITK_DIR}/bin)

endif()

to our CMake/PackageDepends/MITK_Boost_Config.cmake file before it calls find_package(Boost ...).

New remote branch pushed: bug-12005-bad-boostlib-install-name-on-mac

I finally figured it out! The solution is to use the install_name_tool of Mac OS X to change the lib_boost_thread install name.

[f23f71]: Merge branch 'bug-12005-bad-boostlib-install-name-on-mac'

Merged commits:

2013-03-19 23:21:03 Andreas Fetzer [032d59]
Fixing path to dylibs


2013-03-19 22:55:19 Andreas Fetzer [1db010]
Some final cleanup


2013-03-18 12:45:08 Andreas Fetzer [1ee541]
Fixed wrong cmake syntax which made the boost build fail on at least linux


2013-03-17 10:57:25 Andreas Fetzer [0f0386]
Adapted Boost.cmake file so that the previously created script is passed as install command for Mac OS X


2013-03-17 10:55:33 Andreas Fetzer [bf00e8]
Created cmake script which changes the install names of all existing boost shared libraries for mac using the install name tool


2013-03-15 00:07:39 Andreas Fetzer [30334e]
Fixed wrong install name of libboost_thread for Mac OS X. This is done by invoking the install_name_tool via cmake