View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013765CMakeCMakepublic2012-11-30 15:022013-07-01 09:38
ReporterJean-Christophe Fillion-Robin 
Assigned ToBrad King 
PlatformOSOS Version
Product VersionCMake 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0013765: Failed to link against framework in /Library/Framework when CMAKE_OSX_* variables are set
DescriptionFailed to link against framework in /Library/Framework when CMAKE_OS_* variables are set

The problem occurs when using:
  - CMake
  - mac OSX 10.8
  - XCode Version 4.5.2 (4G2008a)
  - g++ --version i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

After installing qt 4.7.4: [^]

This small project allows to reproduce the problem.

$ git clone git:// [^]
$ mkdir CMakeWithQtFramework-build
$ cd CMakeWithQtFramework-build
$ cmake ../

$ make VERBOSE=1
Linking CXX executable foo
"/Volumes/Dashboards/Support/CMake" -E cmake_link_script CMakeFiles/foo.dir/link.txt --verbose=1
/usr/bin/c++ -arch x86_64 -isysroot /Applications/ -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/foo.dir/main.cpp.o -o foo -framework QtWebKit -framework QtXmlPatterns -framework QtGui -framework QtNetwork -framework QtCore
ld: framework not found QtWebKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [foo] Error 1
make[1]: *** [CMakeFiles/foo.dir/all] Error 2
make: *** [all] Error 2

By manually adding -F /Library/Frameworks to the build line, it succeed.

 /usr/bin/c++ -arch x86_64 -isysroot /Applications/ -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/foo.dir/main.cpp.o -o foo -framework QtWebKit -framework QtXmlPatterns -framework QtGui -framework QtNetwork -framework QtCore -F /Library/Frameworks/

I would assume that CMake should automatically add the "-F /Library/Frameworks/"
TagsNo tags attached.
Attached Files


Brad King (manager)
2012-11-30 15:18

You're asking the build to use a given SDK but that SDK does not provide the frameworks you're using. On older Mac versions e.g. 10.6 the SDKs had a symlink to make /Library/Frameworks available. CMake needs to account for the lack of this symlink in newer versions.
Jean-Christophe Fillion-Robin (reporter)
2012-11-30 15:38

As a workaround, to create the symlinks, should I use something like:

for file in `ls -1 /Library/Frameworks/`; do sudo ln -s /Library/Frameworks/$file /Applications/$file; done

.. or is there a simpler way ?
Brad King (manager)
2012-11-30 15:43

Re 0013765:0031789: I think adding "-F /Library/Frameworks" to CMAKE_EXE_LINKER_FLAGS, CMAKE_SHARED_LINKER_FLAGS, and CMAKE_MODULE_LINKER_FLAGS in your build tree is the simplest workaround. Don't hack your system files for this.
Jean-Christophe Fillion-Robin (reporter)
2012-11-30 15:53
edited on: 2012-12-03 09:22

Since I would like to be able to build Slicer with superbuild VTK, CTK (superbuilding itself PythonQt, QTTesting ...) .. it gonna be a painful process to ensure the flag is properly added in all the project relying on Qt. I would have to patch all these projects ...

The time being, I think I will simply create the symlinks ...

Brad King (manager)
2012-12-03 09:30

Re 0013765:0031791: If you create the symlinks then you should do something like

 mkdir /Applications/
 ln -s /Library/Frameworks /Applications/

instead. I think just that one link will be enough.
Jean-Christophe Fillion-Robin (reporter)
2012-12-03 17:52
edited on: 2012-12-05 12:12

Just tried the single symlink approach and it wasn't successful.

Using this approach works:

cd /Library/Frameworks

for file in Qt*; do sudo ln -s /Library/Frameworks/$file /Applications/$file; done

for file in Qt*; do sudo ln -s /Library/Frameworks/$file /Applications/$file; done

Also need to create link for phonon framework

Brad King (manager)
2012-12-04 08:12

Add "-Wl,-v" to the link line by hand to get verbose output about the framework search path in use.
Dimitri Merejkowsky (reporter)
2013-01-30 06:01

Maybe related : when using the following file:

cmake_minimum_required(VERSION 2.8.10)



find_library(OGRE_LIBRARIES NAMES Ogre)
find_library(QT_LIBRARIES NAMES QtCore)

add_executable(foo foo.cpp)
target_link_libraries(foo ${OGRE_LIBRARIES} ${QT_LIBRARIES})

and building, you can see the generated command line looks like:

/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/foo.dir/foo.cpp.o -o foo -F/Users/dmerejkowsky/.local/share/qi/toolchains/mac64/ogre -F/Users/dmerejkowsky/.local/share/qi/toolchains/mac64/qt -framework Ogre -framework QtCore

Note the lack of -F/Users/dmerejkowsky/.local/share/qi/toolchains/mac64/qt

The problem did not occur in CMake 2.8.9, and I can reproduce this with CMake 2.8.10
Brad King (manager)
2013-01-30 09:09

Oops, I forgot to update this issue when I fixed it here:;a=commitdiff;h=cc676c3a [^]
Brad King (manager)
2013-01-30 09:11

Other recent commits should fix the behavior described in 0013765:0032177:;a=commitdiff;h=ba58d0c0 [^];a=commitdiff;h=f0d93854 [^];a=commitdiff;h=2bc22bda [^]
Jean-Christophe Fillion-Robin (reporter)
2013-02-15 12:01

From Steve Pieper - See [^]

On mac os 10.8 with xcode 4.6 and cmake version (the latest next branch as of today).

Trying to build a module results in the following kind of error:

[ 5%] Building CXX object Logic/CMakeFiles/vtkSlicerNewModuleModuleLogic.dir/vtkSlicerNewModuleLogic.cxx.o
Linking CXX shared library ../lib/Slicer-4.2/qt-loadable-modules/libvtkSlicerNewModuleModuleLogic.dylib
ld: framework not found QtScript
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/Slicer-4.2/qt-loadable-modules/libvtkSlicerNewModuleModuleLogic.dylib] Error 1
make[1]: *** [Logic/CMakeFiles/vtkSlicerNewModuleModuleLogic.dir/all] Error 2
make: *** [all] Error 2
Brad King (manager)
2013-02-15 12:51

Re 0013765:0032289: Can this be reproduced on a simple example project outside the Slicer superbuild?
Jean-Christophe Fillion-Robin (reporter)
2013-02-15 13:35

Here is a project: [^]

@Steve, Daniel: Can you reproduce the problem using this toy project ?
Steve Pieper (reporter)
2013-02-15 13:37

I had no problem building the simple example.

0000010 CMakeWithQtFramework-build (master>)$ cmake --version
cmake version

#11 CMakeWithQtFramework-build (master>)$ cmake ../CMakeWithQtFramework
-- Setting OSX_ARCHITECTURES to 'x86_64' as none was specified.
-- Setting OSX_DEPLOYMENT_TARGET to '10.8' as none was specified.
-- Setting OSX_SYSROOT to '/Applications/' as none was specified.
-- The C compiler identification is Clang 4.0.0
-- The CXX compiler identification is Clang 4.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/bin/qmake (found version "4.8.3")
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/CMakeWithQtFramework-build

0000012 CMakeWithQtFramework-build (master %>)$ make
Scanning dependencies of target foo
[100%] Building CXX object CMakeFiles/foo.dir/main.cpp.o
Linking CXX executable foo
[100%] Built target foo
Jean-Christophe Fillion-Robin (reporter)
2013-02-15 13:42

@Steve: Do you confirm that the QT_QMAKE_EXECUTABLE variable from the CMakeCache.txt points to Qt having Frameworks ? If it points to a Qt you built yourself, the problem wouldn't occur.
Steve Pieper (reporter)
2013-02-15 13:47

Both slicer and the CMakeWithQtFramework are using /usr/bin/qmake, which is:

0000019 NewModule-build (master %>)$ qmake --version
QMake version 2.01a
Using Qt version 4.8.3 in /Library/Frameworks

0000020 NewModule-build (master %>)$ which qmake
Jean-Christophe Fillion-Robin (reporter)
2013-02-15 14:01

In that case, it seems to be specific to Slicer. Could you provide remote access to Brad ?
Steve Pieper (reporter)
2013-02-15 14:10

I only have the issue with my laptop right now. Let me see if I can replicate it on a machine with a public IP where I can give him an account.

But I agree this is something specific to building slicer loadable modules.
Greg Sharp (reporter)
2013-02-15 15:25

The cmake nightly solved this problem for me.

OSX 10.7
xcode 4.6 (4H127)
cmake- (built from source)

However, I had infinite loop instead, linked here in case it is related. [^]
Jean-Christophe Fillion-Robin (reporter)
2013-02-17 11:41

@Greg: I did some experiment and CMake version "" is known to work. See [^]

On the other hand, I was able to reproduce the hang using version "cmake-".

I suggest we close this issue.
Brad King (manager)
2013-02-18 08:25

Re 0013765:0032318: Okay, this issue is fixed and 0013926 records a separate remaining issue.
Jean-Christophe Fillion-Robin (reporter)
2013-02-25 11:37

While it is possible to build Slicer without any trouble. There is issue to build Slicer extensions against Slicer build tree.

The experiment has been documented here: [^]

If needed, I could:
 1) Provide access to the machine with a build tree
 2) Provide the complete link command
Brad King (manager)
2013-02-25 11:58

This issue is resolved AFAICT. Please do not re-open it unless you have a minimal example project that reproduces it on more than one computer. Keep the discussion over in Slicer's issue until you've identified that it is really a CMake problem and narrowed it down to a minimal example. The details of narrowing the case from Slicer's build process to a small example are not of interest to this issue.
Robert Maynard (manager)
2013-07-01 09:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-11-30 15:02 Jean-Christophe Fillion-Robin New Issue
2012-11-30 15:18 Brad King Note Added: 0031786
2012-11-30 15:38 Jean-Christophe Fillion-Robin Note Added: 0031789
2012-11-30 15:43 Brad King Note Added: 0031790
2012-11-30 15:53 Jean-Christophe Fillion-Robin Note Added: 0031791
2012-12-03 09:22 Brad King Note Edited: 0031791
2012-12-03 09:23 Brad King Target Version => CMake 2.8.11
2012-12-03 09:23 Brad King Summary Failed to link against framework in /Library/Framework when CMAKE_OS_* variables are set => Failed to link against framework in /Library/Framework when CMAKE_OSX_* variables are set
2012-12-03 09:23 Brad King Description Updated
2012-12-03 09:30 Brad King Note Added: 0031817
2012-12-03 17:52 Jean-Christophe Fillion-Robin Note Added: 0031824
2012-12-03 17:53 Jean-Christophe Fillion-Robin Note Edited: 0031824
2012-12-04 08:12 Brad King Note Added: 0031826
2012-12-05 12:12 Jean-Christophe Fillion-Robin Note Edited: 0031824
2013-01-30 06:01 Dimitri Merejkowsky Note Added: 0032177
2013-01-30 09:09 Brad King Note Added: 0032178
2013-01-30 09:09 Brad King Assigned To => Brad King
2013-01-30 09:09 Brad King Status new => resolved
2013-01-30 09:09 Brad King Resolution open => fixed
2013-01-30 09:09 Brad King Fixed in Version => CMake 2.8.11
2013-01-30 09:11 Brad King Note Added: 0032179
2013-02-15 12:01 Jean-Christophe Fillion-Robin Note Added: 0032289
2013-02-15 12:01 Jean-Christophe Fillion-Robin Status resolved => feedback
2013-02-15 12:01 Jean-Christophe Fillion-Robin Resolution fixed => reopened
2013-02-15 12:51 Brad King Note Added: 0032290
2013-02-15 13:35 Jean-Christophe Fillion-Robin Note Added: 0032292
2013-02-15 13:35 Jean-Christophe Fillion-Robin Status feedback => assigned
2013-02-15 13:37 Steve Pieper Note Added: 0032293
2013-02-15 13:42 Jean-Christophe Fillion-Robin Note Added: 0032294
2013-02-15 13:47 Steve Pieper Note Added: 0032295
2013-02-15 14:01 Jean-Christophe Fillion-Robin Note Added: 0032296
2013-02-15 14:10 Steve Pieper Note Added: 0032297
2013-02-15 15:25 Greg Sharp Note Added: 0032298
2013-02-17 11:41 Jean-Christophe Fillion-Robin Note Added: 0032318
2013-02-18 08:25 Brad King Note Added: 0032322
2013-02-18 08:25 Brad King Status assigned => resolved
2013-02-18 08:25 Brad King Resolution reopened => fixed
2013-02-25 11:37 Jean-Christophe Fillion-Robin Note Added: 0032378
2013-02-25 11:37 Jean-Christophe Fillion-Robin Status resolved => feedback
2013-02-25 11:37 Jean-Christophe Fillion-Robin Resolution fixed => reopened
2013-02-25 11:58 Brad King Note Added: 0032379
2013-02-25 11:58 Brad King Status feedback => resolved
2013-02-25 11:58 Brad King Resolution reopened => fixed
2013-07-01 09:38 Robert Maynard Note Added: 0033434
2013-07-01 09:38 Robert Maynard Status resolved => closed

Copyright © 2000 - 2018 MantisBT Team