# Issue building Slicer with Qt installed using Homebrew: Symbol not found: \_\_cg\_jpeg\_resync\_to\_restart

**URL:** <https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486>\
**Category:** Development\
**Tags:** build\
**Created:** [November 18, 2017, 6:00pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486 "2017-11-18T18:00:08Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 18, 2017, 6:00pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/1 "2017-11-18T18:00:08Z")

</div>

Hi all,

I’m trying to build Slicer on my macOS Sierra 10.12.6 with this configuration:

```auto
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/local/Cellar/qt@4/4.8.7_2/bin/qmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF ../Slicer
make -j8

```

But I get a build error (last 10 lines):

```auto
[100%] Built target SimpleITK
[96%] Performing install step for 'SimpleITK'
-- SimpleITK: Removing 'install' log files
-- SimpleITK: SimpleITK_WORKING_DIR: /Users/fernando/git/Slicer-SuperBuild-Release/SimpleITK-build/SimpleITK-build/Wrapping/Python
-- SimpleITK: /Users/fernando/git/Slicer-SuperBuild-Release/python-install/bin/SlicerPython;Packaging/setup.py;install
-- SimpleITK: 'install' step successfully completed.
[97%] Completed 'SimpleITK'
[97%] Built target SimpleITK
make: *** [all] Error 2

```

Here’s the complete output: [https://www.dropbox.com/s/ankxbk4fx9n513w/build\_log.txt.gz?dl=0](https://www.dropbox.com/s/ankxbk4fx9n513w/build_log.txt.gz?dl=0)

Do you know what can be wrong? Please let me know if you need any other details about my system or the build.

Thanks,  
Fernando

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 18, 2017, 6:51pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/2 "2017-11-18T18:51:48Z")

</div>

Hi,

Thanks for the report.

Would it be possible to re-upload the complete log ? The provided link ends up with a 404 error.

Jc

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 18, 2017, 7:06pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/3 "2017-11-18T19:06:19Z")

</div>

Hi @jcfr,

Excuse me, I’ve edited my link. Can you try again?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 18, 2017, 7:40pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/4 "2017-11-18T19:40:53Z")

</div>

Looking at the log, we can see the following errors:

```auto
-- Looking for decorator header ctkVisualizationVTKWidgetsPythonQtDecorators.h
-- Looking for decorator header ctkVisualizationVTKWidgetsPythonQtDecorators.h - Found
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
-- Looking for decorator header ctkQtTestingPythonQtDecorators.h
-- Looking for decorator header ctkQtTestingPythonQtDecorators.h - Not found
-- Found PythonLibs: /Users/fernando/git/Slicer-SuperBuild-Release/python-install/lib/libpython2.7.dylib (found version "2.7.13")
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
CMake Warning at /usr/local/Cellar/cmake/3.9.6/share/cmake/Modules/FindDoxygen.cmake:396 (message):
  Unable to determine doxygen version: Child aborted
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.9.6/share/cmake/Modules/FindDoxygen.cmake:551 (_Doxygen_find_doxygen)
  Documentation/CMakeLists.txt:1 (find_package)

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
CMake Error at /usr/local/Cellar/cmake/3.9.6/share/cmake/Modules/FindDoxygen.cmake:630 (message):
  Unable to generate Doxyfile template: Child aborted
Call Stack (most recent call first):
  Documentation/CMakeLists.txt:1 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/fernando/git/Slicer-SuperBuild-Release/CTK-build/CTK-build/CMakeFiles/CMakeOutput.log".
See also "/Users/fernando/git/Slicer-SuperBuild-Release/CTK-build/CTK-build/CMakeFiles/CMakeError.log".

```

There are two issues:

- (1) Doxygen: Unable to generate Doxyfile template: Child aborted
- (2) Symbol not found: \_\_cg\_jpeg\_resync\_to\_restart

The issue (1) should be easy to address by fixing the install of Doxygen.

For the issue (2), it is discussed in [https://issues.slicer.org/view.php?id=3574](https://issues.slicer.org/view.php?id=3574) and was fixed.

The known workaround was to specify `-DSlicer_USE_SYSTEM_QT:BOOL=1`, then a fix was implemented in [r26193](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26193).

The problem is that the fix didn’t account for path starting with `/usr/local/Cellar`, this is now fixed in master.

See [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26646](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26646)

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 19, 2017, 2:04pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/5 "2017-11-19T14:04:19Z")

</div>

Thanks @jcfr for looking into this.

I did:

```auto
git -C ../Slicer pull
brew uninstall doxygen
brew install doxygen
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/local/Cellar/qt@4/4.8.7_2/bin/qmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF ../Slicer
make -j8

```

But the build was unsuccessful again. I couldn’t find “`doxygen`” or “`__cg_jpeg_resync_to_restart`” in log: [Dropbox link to log](https://www.dropbox.com/s/3yg6d4n97dw9stj/build_log.txt.gz?dl=0)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 19, 2017, 2:58pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/6 "2017-11-19T14:58:26Z")

</div>

Hi Fernando,

Look like you didn’t do a clean build. I suggest you first delete the build  
tree.

Hth  
Jc

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 19, 2017, 5:41pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/7 "2017-11-19T17:41:29Z")

</div>

Do you mean removing everything from my `Slicer-SuperBuild-Release` dir before configuring and building? I just tried that with no luck.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 19, 2017, 10:34pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/8 "2017-11-19T22:34:20Z")

</div>

Hi,

Look like there is no errors in the last log. What make you think it failed ? Is the log complete ?

Jc

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 20, 2017, 11:52am UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/9 "2017-11-20T11:52:46Z")

</div>

I think the export of my log was somehow wrong (I tried using `tee`). This time I just copied and pasted it: [https://www.dropbox.com/s/o0teidq8nvckanf/build\_log.txt.gz?dl=0](https://www.dropbox.com/s/o0teidq8nvckanf/build_log.txt.gz?dl=0)

The `doxygen` and `__cg_jpeg_resync_to_restart` errors are still present.

What can I do? Maybe install Doxygen and Qt4 in a different way?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 21, 2017, 7:43pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/10 "2017-11-21T19:43:48Z")

</div>

It would be helpful if could narrow down which project is failing.

Only typing `make` will now stop to the first project having issue.

It looks like there is still some clash between system and brew libraries.

Could you also:

- check what is the content of `python-install/bin/SlicerPythonLauncherSettings.ini` ?

- comment out CMake code trying to find and use Doxygen. Look like there is issues with the one shipped by brew.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 21, 2017, 8:12pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/11 "2017-11-21T20:12:17Z")

</div>

> [@jcfr](#):
>
> Only typing make will now stop to the first project having issue.

What do you mean? Can I narrow the search if I run `make` again in from the same folder?

> [@jcfr](#):
>
> comment out CMake code

I wouldn’t know where to start commenting CMake code, I don’t know almost anything about it. Would it help if I install Doxygen in a different way?

> [@jcfr](#):
>
> what is the content of python-install/bin/SlicerPythonLauncherSettings.ini ?

```auto
 Slicer-SuperBuild-Release  cat python-install/bin/SlicerPythonLauncherSettings.ini
[General]
launcherNoSplashScreen=true
launcherSplashImagePath=
launcherSplashScreenHideDelayMs=
additionalLauncherHelpShortArgument=
additionalLauncherHelpLongArgument=
additionalLauncherNoSplashArguments=
additionalPathVariables=PYTHONPATH

[Application]
path=<APPLAUNCHER_DIR>//python
arguments=
name=SlicerPython
revision=
organizationDomain=
organizationName=

[ExtraApplicationToLaunch]

[LibraryPaths]
1\path=/Users/fernando/git/Slicer-SuperBuild-Release/python-install/lib
2\path=/Users/fernando/git/Slicer-SuperBuild-Release/OpenSSL
size=2

[Paths]
1\path=<APPLAUNCHER_DIR>
size=1

[EnvironmentVariables]
PYTHONHOME=/Users/fernando/git/Slicer-SuperBuild-Release/python-install
PYTHONNOUSERSITE=1
SSL_CERT_FILE=<APPLAUNCHER_DIR>/../../Slicer-build/share/Slicer-4.9/Slicer.crt

[PYTHONPATH]
1\path=/Users/fernando/git/Slicer-SuperBuild-Release/python-install/lib/python2.7
2\path=/Users/fernando/git/Slicer-SuperBuild-Release/python-install/lib/python2.7/lib-dynload
3\path=/Users/fernando/git/Slicer-SuperBuild-Release/python-install/lib/python2.7/site-packages
size=3

```

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 21, 2017, 8:21pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/12 "2017-11-21T20:21:50Z")

</div>

> [@jcfr](#):
>
> Only typing make will now stop to the first project having issue.

I just ran `make -j8`, here’s the output: [https://gist.github.com/fepegar/a6a2e7b4395fb081b5ac24c3a94e7619](https://gist.github.com/fepegar/a6a2e7b4395fb081b5ac24c3a94e7619)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 21, 2017, 8:33pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/13 "2017-11-21T20:33:47Z")

</div>

### Launcher settings

> python-install/bin/SlicerPythonLauncherSettings.ini

Everything looks fine, there is no system paths listed.

### Doxygen

> [@Fernando](#):
>
> Doxygen in a different way

I have no idea, I am not familiar with brew.

Slicer [r26653](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26653) introduces the option `Slicer_BUILD_DOCUMENTATION`, consider updating your source checkout and configuring with `-DSlicer_BUILD_DOCUMENTATION:BOOL=OFF`

## Single process make to find out cause of failure

> [@Fernando](#):
>
> What do you mean? Can I narrow the search if I run make again in from the same folder?

By simply running `make` I meant that you should run a single process `make`.

From the top level directory, try:

```bash
cd Slicer-SuperBuild
make

```

instead of

```bash
cd Slicer-SuperBuild
make -j<number>

```

Doing so ensure the build process fails at the first error.

When you know which target is faulty, it is useful to do:

```auto
make NameOfTarget/fast VERBOSE=1

```

this will give a lot more details

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 21, 2017, 10:30pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/14 "2017-11-21T22:30:56Z")

</div>

When I run `make`, the last lines of the output are:

```auto
[13%] Performing build step for 'python'
[0%] Built target extension_array
[1%] Built target extension_audioop
[1%] Built target extension_bisect
[2%] Built target extension_cmath
[2%] Built target extension_codecs_cn
[3%] Built target extension_codecs_hk
[4%] Built target extension_codecs_iso2022
[5%] Built target extension_codecs_jp
[5%] Built target extension_codecs_kr
[6%] Built target extension_codecs_tw
[7%] Built target extension_cPickle
[8%] Built target extension_cStringIO
[9%] Built target extension_csv
[9%] Built target extension_ctypes_test
[9%] Built target extension_functools
[10%] Built target extension_future_builtins
[10%] Built target extension_heapq
[11%] Built target extension_hotshot
[12%] Built target extension_itertools
[13%] Built target extension_json
[13%] Built target extension_locale
[14%] Built target extension_lsprof
[15%] Built target extension_math
[16%] Built target extension_mmap
[17%] Built target extension_multibytecodec
[18%] Built target extension_operator
[19%] Built target extension_parser
[19%] Built target extension_random
[20%] Built target extension_strop
[20%] Built target extension_struct
[21%] Built target extension_testcapi
[21%] Built target extension_unicodedata
[22%] Built target extension_fcntl
[23%] Built target extension_grp
[24%] Built target extension_resource
[25%] Built target extension_syslog
[26%] Built target extension_termios
make[5]: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/SystemConfiguration.framework', needed by `lib/python2.7/lib-dynload/_scproxy.so'. Stop.
make[4]: *** [CMakeBuild/extensions/extension_scproxy/CMakeFiles/extension_scproxy.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [python-prefix/src/python-stamp/python-build] Error 2
make[1]: *** [CMakeFiles/python.dir/all] Error 2
make: *** [all] Error 2

```

So I ran `make python/fast VERBOSE=1` and got this: [https://gist.github.com/fepegar/a6a2e7b4395fb081b5ac24c3a94e7619](https://gist.github.com/fepegar/a6a2e7b4395fb081b5ac24c3a94e7619)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 22, 2017, 12:38am UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/15 "2017-11-22T00:38:21Z")

</div>

Thanks for the details.

Since I am travelling until Sunday, unless someone else help you out. I  
will have a look next week.

---

<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:** [November 22, 2017, 3:24am UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/16 "2017-11-22T03:24:16Z")

</div>

> [@Fernando](#):
>
> `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/SystemConfiguration.framework’

Does this path exist? Note that the SDK and the OS version can be different, and Apple updater may have automatically moved you up to 10.13 SDK (this happened to me, things broke, and I manually rolled back – haven’t dared to try again yet).

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [November 22, 2017, 9:57am UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/17 "2017-11-22T09:57:30Z")

</div>

Hi @ihnorton,

I think that has happened to me as well. How did you roll back?

---

<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:** [November 22, 2017, 10:39am UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/18 "2017-11-22T10:39:39Z")

</div>

I think the issue I hit has been fixed because I know some other Mac users  
have upgraded — I didn’t want the hours of rebuilding. So try setting the  
sdk target to 10.13 first. I don’t have the rollback steps I used at hand,  
but will try to find again.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 27, 2017, 2:12pm UTC](https://discourse.slicer.org/t/issue-building-slicer-with-qt-installed-using-homebrew-symbol-not-found-cg-jpeg-resync-to-restart/1486/19 "2017-11-27T14:12:32Z")

</div>

@ihnorton Thanks for your input

@Fernando Was the issue finally resolved ?
