Opened 10 years ago

Closed 10 years ago

#44341 closed defect (invalid)

cmake can't find SDK when building openjpeg

Reported by: snowflake (Dave Evans) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: cmake Cc: cssdev
Port: openjpeg

Description

cmake is not finding the SDK when building openjpeg and other ports that also use cmake

My machine details:

OSX 10.8.5, Xcode 5.1.1 (5B1008), cmake 3.0.0_2

Xcode is installed from the App Store

I also have a couple of Xcodes installed as /Xcode-3.x.x

Here's the openjpeg error log:

DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_davidevans_macports_svn-repo_macports-trunk_dports_graphics_openjpeg/openjpeg/work/openjpeg-2.1.0" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_MODULE_PATH=/opt/local/share/cmake/modules -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8"'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_Users_davidevans_macports_svn-repo_macports-trunk_dports_graphics_openjpeg/openjpeg/work/openjpeg-2.1.0" && /opt/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/opt/local -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH=/opt/local/lib -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_MODULE_PATH=/opt/local/share/cmake/modules -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents//Developer/Toolchains/XcodeDefault.xctoolchain/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8" 
-- The C compiler identification is AppleClang 5.0.0.5000279
CMake Warning at /opt/local/share/cmake-3.0/Modules/Platform/Darwin.cmake:179 (message):
  Ignoring CMAKE_OSX_SYSROOT value:

   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

  because the directory does not exist.
Call Stack (most recent call first):
  /opt/local/share/cmake-3.0/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
  CMakeLists.txt:24 (project)


CMake Error at /opt/local/share/cmake-3.0/Modules/Platform/Darwin.cmake:211 (message):
  CMAKE_OSX_DEPLOYMENT_TARGET is '10.8' but CMAKE_OSX_SYSROOT:

   ""

  is not set to a MacOSX SDK with a recognized version.  Either set
  CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
  empty.
Call Stack (most recent call first):
  /opt/local/share/cmake-3.0/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
  CMakeLists.txt:24 (project)


-- Configuring incomplete, errors occurred!

The SDK is really at

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

I tried setting SDKROOT in my shell environment to the correct location, but it did not work.

Change History (3)

comment:1 in reply to:  description ; Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to dave.evans55@…:

The SDK is really at

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Indeed. The question is: where is that setting coming from? Who's specifying that CMAKE_OSX_SYSROOT and where? It builds fine for me on OS X 10.9.4 with Xcode 5.1.1.

The cmake 1.0 portgroup has these lines:

            if {[vercmp $xcodeversion 4.3] < 0} {
                set sdks_dir ${developer_dir}/SDKs
            } else {
                set sdks_dir ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
            }
            if {$macosx_deployment_target eq "10.4"} {
                set sdk ${sdks_dir}/MacOSX10.4u.sdk
            } else {
                set sdk ${sdks_dir}/MacOSX${macosx_deployment_target}.sdk
            }
            configure.args-append \
                -DCMAKE_OSX_SYSROOT="${sdk}" \
                -DCMAKE_OSX_DEPLOYMENT_TARGET="${macosx_deployment_target}"

That all looks fine, and suggests that ${developer_dir} has the wrong value for you.

developer_dir is automatically set by MacPorts base to the value returned by xcode-select -print-path. Try running that on the command line; if it does not say "/Applications/Xcode.app/Contents/Developer", then run sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer to fix it.

If that's not it: Have you overridden developer_dir in macports.conf? If so, comment that out and try again.

I tried setting SDKROOT in my shell environment to the correct location, but it did not work.

That's understandable, since MacPorts deliberately clears the environment so that they would not adversely affect builds.

comment:2 in reply to:  1 Changed 10 years ago by snowflake (Dave Evans)

Replying to ryandesign@…:

Replying to dave.evans55@…:

That all looks fine, and suggests that ${developer_dir} has the wrong value for you.

You are right - I had developer_dir set to an unusual value in macports.conf. I commented it out and now openjpeg builds.

developer_dir is automatically set by MacPorts base to the value returned by xcode-select -print-path. Try running that on the command line; if it does not say "/Applications/Xcode.app/Contents/Developer", then run sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer to fix it.

xcode_select was set correctly.

If that's not it: Have you overridden developer_dir in macports.conf? If so, comment that out and try again.

Done. It Now works.

The reason I had set developer_dir is lost in the mists of time. I must have done it to fix some other breakage.

Thank you for your kind assistance.

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed

Great! Glad you got it working.

Note: See TracTickets for help on using tickets.