View Issue Details

IDProjectCategoryView StatusLast Update
0004681Slicer4Core: Building (CMake, Superbuild)public2019-09-24 17:52
Reporterpieper Assigned Tojcfr  
PriorityhighSeverityblockReproducibilityalways
Status assignedResolutionopen 
Product VersionSlicer 4.11.0 
Target VersionSlicer 4.11.0Fixed in Version 
Summary0004681: No /usr/include on macOS Mojave
Description

It seems that with macOS 10.14 and beyond, Apple is deprecating the use of /usr/include and instead puts the corresponding files in the os-version-specific SDK directories: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035623

(note that xcode-select --install does not fix this)

This breaks OpenSSL and Python with the errors shown in Additional Information below. Probably other things break too.

A workaround is setting the SDKROOT, like this, which allows the build to succeed:

SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk make -j20

We should find a way to send the correct SDKROOT to the SuperBuild dependencies, e.g. via cmake as a byproduct of setting the CMAKE_OSX_DEPLOYMENT_TARGET.

Additional Information

=======================================================================================
build error compiling OpenSSL

<pre>
[ 20%] Performing update step for 'zlib'
[ 20%] Performing configure step for 'zlib'
loading initial cache file /q5r/zlib-prefix/tmp/zlib-cache-Debug.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /q5r/zlib-build
[ 20%] Performing build step for 'zlib'
[100%] Built target zlib
[ 20%] Performing install step for 'zlib'
[100%] Built target zlib
Install the project...
-- Install configuration: "Debug"
-- Up-to-date: /q5r/zlib-install/lib/libzlib.a
-- Up-to-date: /q5r/zlib-install/include/zlib.h
-- Up-to-date: /q5r/zlib-install/include/zconf.h
-- Up-to-date: /q5r/zlib-install/include/zlib_mangle.h
-- Up-to-date: /q5r/zlib-install/include/zlibDllConfig.h
-- Up-to-date: /q5r/zlib-install/doc/zlib-1.2.3/Copyright.txt
[ 40%] Completed 'zlib'
[ 60%] Built target zlib
[ 60%] No configure step for 'OpenSSL'
[ 60%] Performing build step for 'OpenSSL'
making all in crypto...
In file included from cryptlib.c:117:
./cryptlib.h:62:11: fatal error: 'stdlib.h' file not found

include <stdlib.h>

      ^~~~~~~~~~

1 error generated.
make[5]: [cryptlib.o] Error 1
make[4]:
[build_crypto] Error 1
make[3]: [OpenSSL-prefix/src/OpenSSL-stamp/OpenSSL-build] Error 2
make[2]:
[CMakeFiles/OpenSSL.dir/all] Error 2
make[1]: [CMakeFiles/OpenSSL.dir/rule] Error 2
make:
[OpenSSL] Error 2
</pre>

=======================================================================================
later, after setting SDKROOT and compiling Python

<pre>
In file included from _configtest.c:1:
/q5r/python-install/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~
1 error generated.
Traceback (most recent call last):
File "setup.py", line 415, in <module>
setup_package()
File "setup.py", line 407, in setup_package
setup(metadata)
File "/q5r/NUMPY/numpy/distutils/core.py", line 171, in setup
return old_setup(
new_attr)
File "/q5r/python-install/lib/python2.7/site-packages/setuptools-40.8.0.post20190329-py2.7.egg/setuptools/init.py", line 145, in setup
return distutils.core.setup(*attrs)
File "/q5r/python-install/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/q5r/python-install/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/q5r/python-install/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/q5r/NUMPY/numpy/distutils/command/build.py", line 47, in run
old_build.run(self)
File "/q5r/python-install/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/q5r/python-install/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/q5r/python-install/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/q5r/NUMPY/numpy/distutils/command/build_src.py", line 148, in run
self.build_sources()
File "/q5r/NUMPY/numpy/distutils/command/build_src.py", line 165, in build_sources
self.build_extension_sources(ext)
File "/q5r/NUMPY/numpy/distutils/command/build_src.py", line 322, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/q5r/NUMPY/numpy/distutils/command/build_src.py", line 375, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 423, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 47, in check_types
out = check_types(
a, **kw)
File "numpy/core/setup.py", line 281, in check_types
"install {0}-dev|{0}-devel.".format(python))
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

CMake Error at /Users/pieper/slicer4/latest/Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:104 (message):
NUMPY: build step failed with exit code '1'.

Outputs also captured in /q5r/NUMPY_build_step_output.txt and
/q5r/NUMPY_build_step_error.txt.
</pre>

=======================================================================================

TagsNo tags attached.

Activities

pieper

pieper

2019-03-29 21:08

administrator   ~0016253

Reminder sent to: jcfr

@jcfr - would be happy to hear your thoughts on this.

pieper

pieper

2019-05-07 13:44

administrator   ~0016258

On a recent rebuild this error showed up in the Swig_build/config.log. Setting the SDK environment variable as reported above gets past this.

blowekamp

blowekamp

2019-07-01 16:03

developer   ~0016273

I encounter these error last week.

1) The "-isysroot" flag was not being used in any non-CMake external projects. The following patch addresses the issue: https://github.com/Slicer/Slicer/pull/1167
2) Even with "isysroot" being propagated in the Superbuild sub-project some of OpenSSL's subproject(?or targets?) don't seem to be getting the flag. I even tried setting the SDKROOT environment variable in the CMake configuration file for Non-CMake external projects.

To build Slicer I had to run:
$ SDKROOT=/Applications/XCode.app/Contents/.../Path/To/MacOSX/platform make -j 16

pieper

pieper

2019-07-01 16:19

administrator   ~0016274

Thanks for the note @blowekamp. Yes, setting the SDKROOT env variable is the only thing that works for me too.

blowekamp

blowekamp

2019-07-01 16:50

developer   ~0016275

With the above linked patch Slicer is very close to not needing the environment variable any more as PCRE, Python and SWIG not build find without the environment variable set.

pieper

pieper

2019-09-24 17:52

administrator   ~0016287

Note that this is still an issue with MacOSX 10.15 as well.

After updating the OS and Xcode, the command line to invoke is:

SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk make -j20

Issue History

Date Modified Username Field Change
2019-03-29 21:07 pieper New Issue
2019-03-29 21:07 pieper Status new => assigned
2019-03-29 21:07 pieper Assigned To => jcfr
2019-03-29 21:08 pieper Note Added: 0016253
2019-04-18 18:11 jcfr Additional Information Updated View Revisions
2019-04-18 18:11 jcfr Additional Information Updated View Revisions
2019-04-30 15:41 jcfr Target Version Slicer 4.10.2 => Slicer 4.11.0
2019-05-07 13:44 pieper Note Added: 0016258
2019-07-01 16:03 blowekamp Note Added: 0016273
2019-07-01 16:19 pieper Note Added: 0016274
2019-07-01 16:50 blowekamp Note Added: 0016275
2019-09-24 17:52 pieper Note Added: 0016287