0

I have come back to working on a school project after a short hiatus. However, I can't get it to build anymore. We were provided with the following cmake file:

cmake_minimum_required(VERSION 2.8)

PROJECT(astro)
SET(VTK_DIR /Users/hank/Hartree/VTK/install/lib/cmake/vtk-6.0)

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

add_executable(astro MACOSX_BUNDLE astro)

SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL")
if(VTK_LIBRARIES)
  target_link_libraries(astro ${VTK_LIBRARIES})
else()
  target_link_libraries(astro vtkHybrid)
endif()

After running cmake and trying to compile the project with make, I get the following error:

*** No rule to make target >'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Deve>loper/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework', >needed by 'astro.app/Contents/MacOS/astro'. Stop.

I think I updated my os and xcode during my break from the project, and that caused the issue. I don't know a whole lot about cmake or makefiles, but I think that somehow the path to openGL is getting messed up. Poking through my file system I have found the paths

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

and

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

and I have been able to find the OpenGL frameworks in those directories, but there is no MacOSX10.12.sdk directory.

I found the following similar questions here and here. However, I have not been using Qt, and when I run xcode-select -pit prints the correct path /Applications/Xcode.app/Contents/Developer

Any ideas how to fix this?

Kyle
  • 89
  • 1
  • 7

1 Answers1

0

I received exactly the same error when installing an application from source code. I solved this problem by duplicate the "MacOSX10.13.sdk" directory in

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

and rename it "MacOSX10.12.sdk".

I am not an expert in MacOSX or cmake, therefore my answer may not be the best solution and may even cause problems, but it does solve this problem for me. If anyone knows the correct way to do, I'd like to know it.

Here are what I tried:

At beginning, cmake can not find "CMAKE_OSX_SYSROOT" after configuration.

  1. I first changed the cmake settings to

    CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12 CMAKE_OSX_SYSROOT:STRING=macosx10.13

but this does not work. Same error.

  1. Then I updated my Mac to MacOSX 10.13 High Sierra. This time cmake can correctly set

    CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk

but still generates the same error. Therefore I believe the problem comes from the application source code.

  1. I googled how to install MacOSX10.12.sdk and find this post:SDKs. The easiest way may be finding the old sdk from TimeMachine. But I just bought my Mac and it doesn't have the old version sdk. Therefore I simply duplicate and rename the sdk to try, and it works. I think putting the sym link of the real MacOSX10.12.sdk in the folder will be the best solution to this problem.
Community
  • 1
  • 1
Susan_Y
  • 1
  • 3