Our project depends on 53 different open soure packages, all downloaded and built by a nice 900 line shell script. (Build systems are so standardized that usually it's just one line to download, build, and install a random open source project, yay!) Yesterday I had the pleasure of coaxing it into building fat libraries on MacOSX. This went amazingly well, but when building OpenCV, I ran into a problem with cmake. I'm using cmake 2.8.11.2, probably from homebrew.
The symptom was /usr/bin/ar cr ../lib/libIlmImf.a CMakeFiles/IlmImf.dir/Half/half.cpp.o CMakeFiles/IlmImf.dir/Iex/IexBaseExc.cpp.o ... /usr/bin/ranlib ../lib/libIlmImf.a /usr/bin/ranlib: for architecture: i386 file: ../lib/libIlmImf.a(IlmThread.cpp.o) has no symbols ... /usr/local/Cellar/cmake/2.8.11.2/bin/cmake -E cmake_progress_report /Users/dank/src/yobuild-builder/unified/btmp/OpenCV-2.4.3/CMakeFiles 1 2 3 4 5 6 7 [ 31%] Built target IlmImf make: *** [all] Error 2 It seems that, on the mac, when building universal static libraries, one ought not use ar; instead, one is supposed to use apple's libtool (completely different from gnu libtool, which on the mac is called glibtool to avoid clashing). Replacing "/usr/bin/ar cr ../lib/libIlmImf.a" with "libtool -o ../lib/libIlmImf.a" seems to solve the problem. I was able to coax cmake into doing this with : --- OpenCV-2.4.3/CMakeLists.txt.old 2013-09-25 18:33:24.000000000 -0700 +++ OpenCV-2.4.3/CMakeLists.txt 2013-09-25 18:35:34.000000000 -0700 @@ -60,6 +60,11 @@ project(OpenCV CXX C) +if(APPLE) + SET(CMAKE_CXX_ARCHIVE_CREATE "/usr/bin/libtool -v -o <TARGET> <LINK_FLAGS> <OBJECTS>") + SET(CMAKE_C_ARCHIVE_CREATE "/usr/bin/libtool -v -o <TARGET> <LINK_FLAGS> <OBJECTS>") +endif() Is this a chink in cmake's support for universal libraries on MacOSX? -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
