[CMake] Xcode generator issues

Michael Jackson mike.jackson at bluequartz.net
Tue Sep 30 09:49:47 EDT 2008


The issue is that the build system for boost does NOT set an  
"install_name", a path embedded in the library that executables can  
use to find the library after linking. You have a few choices at this  
point.

1) Hack boost's build system to add in the correct "install_name"
2) Manually use "install_name_tool" to set the install name correctly  
(usually to the installation path)
3) set/export the DYLD_LIBRARY_PATH in your .bash_profile file to  
include the directory that the boost libraries are located in
4) Build the boost libraries as static libraries which fixes _all_ of  
the above issues.

If you plan to actually deploy your application to other people I  
would _highly_ recommend #4.

Fielder's Choice

Mike Jackson

On Sep 30, 2008, at 9:41 AM, C. B. Frederick wrote:

> I am trying to use boost to generate an xcode project file.  I have  
> boost properly installed in that I can use it manually, generate  
> Makefiles, and the relevant FindBoost variables are appropriately  
> set, both of which run fine.  The problem is that I get the error  
> and SIGTRAP:
>
> dyld: Library not loaded: libboost_thread-xgcc40-mt-1_36.dylib
>  Referenced from: {build location}
>  Reason: image not found
>
> Normally, I would drag the dylib to the project file, but I am not  
> sure how to do this with the generated projects.  Is this an issue  
> or am I missing something.  Example CMakeLists.txt and code below.
>
> Thanks,
> Brandon
> --
> cmake_minimum_required(VERSION 2.6)
> PROJECT(test)
> FIND_PACKAGE( Boost 1.36.0 COMPONENTS thread)
> link_directories ( ${Boost_LIBRARY_DIRS} )
> include_directories ( ${Boost_INCLUDE_DIRS} )
> add_executable(test src/test.cxx )
> TARGET_LINK_LIBRARIES ( test ${Boost_LIBRARIES})
> --
> #include <iostream>
> #include "boost/thread/thread.hpp"
> void helloworld() {
>    std::cout << "Hello World!" << std::endl;
> }
> int main( int argc, char **argv) {
> 	boost::thread thrd(&helloworld);
> 	thrd.join();
> 	return 0;
> }
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list