# MacOS Sierra (10.12.6) dynamic linker errors

**URL:** <https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339>\
**Category:** Development\
**Created:** [March 16, 2018, 7:54pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339 "2018-03-16T19:54:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 16, 2018, 7:54pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/1 "2018-03-16T19:54:16Z")

</div>

Hey guys,

I’m running into some dynamic linker errors on startup with master built on 10.12.6:

```
dlopen(/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerCropVolumeModuleLogicPython.so, 2): no suitable image found. Did find:
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./vtkSlicerCropVolumeModuleLogicPython.so: malformed mach-o: load commands size (32872) > 32768
/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerCropVolumeModuleLogicPython.so: malformed mach-o: load commands size (32872) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerCropVolumeModuleLogicPython.so: malformed mach-o: load commands size (32872) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerCropVolumeModuleLogicPython.so: malformed mach-o: load commands size (32872) > 32768
dlopen(/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerSegmentationsModuleLogicPython.so, 2): Library not loaded: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerSegmentationsModuleLogicPythonD.dylib
  Referenced from: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./vtkSlicerSegmentationsModuleLogicPython.so
  Reason: no suitable image found. Did find:
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./libvtkSlicerSegmentationsModuleLogicPythonD.dylib: malformed mach-o: load commands size (33048) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerSegmentationsModuleLogicPythonD.dylib: malformed mach-o: load commands size (33048) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerSegmentationsModuleLogicPythonD.dylib: malformed mach-o: load commands size (33048) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerSegmentationsModuleLogicPythonD.dylib: malformed mach-o: load commands size (33048) > 32768
dlopen(/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerAnnotationsModuleMRMLDisplayableManagerPython.so, 2): Library not loaded: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerAnnotationsModuleMRMLDisplayableManagerPythonD.dylib
  Referenced from: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./vtkSlicerAnnotationsModuleMRMLDisplayableManagerPython.so
  Reason: no suitable image found. Did find:
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./libvtkSlicerAnnotationsModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33080) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerAnnotationsModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33080) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerAnnotationsModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33080) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerAnnotationsModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33080) > 32768
dlopen(/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerMarkupsModuleMRMLDisplayableManagerPython.so, 2): no suitable image found. Did find:
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./vtkSlicerMarkupsModuleMRMLDisplayableManagerPython.so: malformed mach-o: load commands size (32904) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerMarkupsModuleMRMLDisplayableManagerPython.so: malformed mach-o: load commands size (32904) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerMarkupsModuleMRMLDisplayableManagerPython.so: malformed mach-o: load commands size (32904) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerMarkupsModuleMRMLDisplayableManagerPython.so: malformed mach-o: load commands size (32904) > 32768
dlopen(/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/vtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPython.so, 2): Library not loaded: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPythonD.dylib
  Referenced from: /Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./vtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPython.so
  Reason: no suitable image found. Did find:
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./libvtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33024) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33024) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33024) > 32768
	/Users/hherhold/Development/slicer/build-qt5/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/libvtkSlicerVolumeRenderingModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (33024) > 32768

```

A while back (May 2017)? I saw a post talking a bit about this, and it sounded like it had something to do with the behavior of the linker being different in 10.12 vs 10.11, and either the symbol table didn’t look right or the pathnames to libraries are too long. (Not sure on either of these.)

Has anybody else run into this? It’s become a bit of a problem with local builds - things like logical operators in the Segmentation Editor fail because it can’t get the segmentations module logic when checking if bypass masking is set. (My guess is because it can’t load the .so that contains the logic, but I’m totally guessinng here.)

Any ideas?

Thanks in advance!!!

-Hollister

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 16, 2018, 8:04pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/2 "2018-03-16T20:04:22Z")

</div>

This was the post that talked about it:

> [@Nightly build TESTS failing for extensions with dependencies to other scriptable modules](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/39):
>
> This error /Users/christian/sources/cpp/Builds/Slicer/Release/Slicer-build/lib/Slicer-4.9/qt-loadable-modules/./libvtkSlicerMarkupsModuleMRMLDisplayableManagerPythonD.dylib: malformed mach-o: load commands size (32840) \> 32768 seems to be due to the limit on total size of all the load commands in the dynamic library in the MacOS loader. I guess using a shorter build directory path would solve the issue. For example, instead of /Users/christian/sources/cpp/Builds/Slicer/Release, you could try…

I’m doing a build right now with a shorter path - we will see if that fixes it?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 17, 2018, 11:53am UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/3 "2018-03-17T11:53:43Z")

</div>

OK, building in a directory tree with shorter initial pathnames seems to fix it. Annoying, but it works.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 17, 2018, 8:24pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/4 "2018-03-17T20:24:41Z")

</div>

Don’t worry, it’s not just a Mac thing. Long base directory path breaks the build on all operating systems.

---

<div class="post-metadata">

**Author:** ![mschumaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mschumaker/32/1395_2.png) [@mschumaker](https://discourse.slicer.org/u/mschumaker)\
**Post date:** [April 13, 2018, 4:37pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/5 "2018-04-13T16:37:44Z")

</div>

I just built Slicer for the first time, and I get the same errors when I run it. I built Slicer in the directory /Users/michaelschumaker/Packages. How short does the initial pathname need to be?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [April 13, 2018, 6:00pm UTC](https://discourse.slicer.org/t/macos-sierra-10-12-6-dynamic-linker-errors/2339/6 "2018-04-13T18:00:33Z")

</div>

FWIW, I use `/opt/bld/s5nj` and `/opt/bld/r/r5nj`.
