View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012034CMakeCMakepublic2011-03-31 12:382011-11-11 10:45
ReporterMike Jackson 
Assigned ToDavid Cole 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSOS XOS Version10.5, 10.6
Product VersionCMake 2.8.4 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0012034: BundleUtilities can not fixup standalone executable on OS X
DescriptionUsing the BundleUtilities on OS X and trying to fixup a plain executable will fail because the executable is expected to be included in a .app package
Additional InformationOn Thu, Mar 31, 2011 at 8:29 AM, Michael Jackson <mike.jackson@bluequartz.net> wrote:
So things did majorly change between the two versions. My questions are now 1) How do I "fixup" an executable that is NOT an application bundle and 2) Do I now need to supply my own copy rules for things like Qt Frameworks, 3rd party, but non-system libraries?

> David Cole Replied
1) Now that we're strictly producing an error out when a file is not "inside" the bundle, fixing up a plain command line executable that is not inside a bundle structure on the Mac has been made "ill defined" (inadvertently...)

We do not have a test in the CMake test suite of calling fixup_bundle on such a creature. If we did, I would have caught this immediately when making that change.

As a possible workaround (not 100% certain it will work, but I think it should), "pretend" your app is in a bundle simply by naming its containing directory with a name ending in ".app". You could even fake it out by renaming the directory to have the ".app", calling fixup_bundle, and then renaming the dir back to its original name. This is a workaround (*cough* hack *cough*), and only suggested so you can use it immediately if it works for you...

In the meantime, this should be fixed to deal with this case on the Mac, since it does essentially the same thing on Windows and Linux, where there is no convention of a "bundle structure"...

We need a new test added that is shown to fail presently, and then a fix to make it pass, while still maintaining all our other existing fixup_bundle behavior.

2) You need to supply install rules for "dynamically loaded shared libraries" (like plugins) -- fixup_bundle will only copy in files that it determines are necessary based on otool -L output. It no longer copies in the "${libs}" list as it used to in CMake 2.8.3 and earlier.

(Which is why we added the error message to 2.8.4 -- to explicitly call attention to the fact that we inadvertently changed the behavior with one of the bug fixes we allowed in the 2.8.3 release...)
TagsNo tags attached.
Attached Filespatch file icon 0001-Add-tests-for-BundleUtilities-and-fix-bug-12034-for-.patch [^] (13,682 bytes) 2011-05-26 17:54 [Show Content]
patch file icon 0001-Fix-regex-used-to-extract-dependents-from-ldd-to-acc.patch [^] (984 bytes) 2011-05-27 18:50 [Show Content]
patch file icon 0001-Fix-BundleUtilities-test-when-using-xcode.patch [^] (931 bytes) 2011-05-27 19:07 [Show Content]

 Relationships

  Notes
(0026175)
Clinton Stimpson (developer)
2011-04-13 22:43

I've attached a patch for this.
(0026621)
David Cole (manager)
2011-05-26 11:02

The test fails for me today (on my Mac) when I apply this patch on top of today's 'master'... Does it work for you?

I get the following test failure output when running ctest -VV:

davidcole@qwghlm : CMake Mac-unix-Debug
$ ctest -j 4 -R BundleUtil -VV
UpdateCTestConfiguration from :/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/DartConfiguration.tcl
Parse Config file:/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/DartConfiguration.tcl
 Add coverage exclude regular expressions.
 Add coverage exclude: XCode
 Add coverage exclude: Kdevelop
 Add coverage exclude: /Source/(cm|kw)sys/
 Add coverage exclude: /CMakeFiles/CMakeTmp/
 Add coverage exclude: [A-Za-z]./[Qq]t/qt-.+-opensource-src
UpdateCTestConfiguration from :/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/DartConfiguration.tcl
Parse Config file:/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/DartConfiguration.tcl
Test project /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug
Constructing a list of tests
Guessing configuration NoConfig
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 60
    Start 60: BundleUtilities

60: Test command: /Users/davidcole/Dashboards/My\ Tests/CMake\ Mac-unix-Debug/bin/ctest "--build-and-test" "/Users/davidcole/Dashboards/My Tests/CMake/Tests/BundleUtilities" "/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities" "--build-generator" "Unix Makefiles" "--build-makeprogram" "/usr/bin/make" "--build-project" "BundleUtilities"
60: Test timeout computed to be: 1500
60: Internal cmake changing into directory: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities
60: ======== CMake output ======
60: The C compiler identification is GNU
60: The CXX compiler identification is GNU
60: Checking whether C compiler has -isysroot
60: Checking whether C compiler has -isysroot - yes
60: Checking whether C compiler supports OSX deployment target flag
60: Checking whether C compiler supports OSX deployment target flag - yes
60: Check for working C compiler: /usr/bin/gcc
60: Configuring
60: Check for working C compiler: /usr/bin/gcc -- works
60: Detecting C compiler ABI info
60: Configuring
60: Detecting C compiler ABI info - done
60: Checking whether CXX compiler has -isysroot
60: Checking whether CXX compiler has -isysroot - yes
60: Checking whether CXX compiler supports OSX deployment target flag
60: Checking whether CXX compiler supports OSX deployment target flag - yes
60: Check for working CXX compiler: /usr/bin/c++
60: Configuring
60: Check for working CXX compiler: /usr/bin/c++ -- works
60: Detecting CXX compiler ABI info
60: Configuring
60: Detecting CXX compiler ABI info - done
60: Configuring
60: Configuring done
60: Generating
60: Generating done
60: Build files have been written to: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities
60: ======== End CMake output ======
60: Change Dir: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities
60:
60: Run Clean Command:/usr/bin/make "clean"
60:
60: Run Build Command:/usr/bin/make
60: Scanning dependencies of target framework
60: [ 16%] Building CXX object CMakeFiles/framework.dir/framework.cpp.o
60: Linking CXX shared library framework.framework/Versions/A/framework
60: [ 16%] Built target framework
60: Scanning dependencies of target shared2
60: [ 33%] Building CXX object CMakeFiles/shared2.dir/shared2.cpp.o
60: Linking CXX shared library libshared2.dylib
60: [ 33%] Built target shared2
60: Scanning dependencies of target module
60: [ 50%] Building CXX object CMakeFiles/module.dir/module.cpp.o
60: Linking CXX shared module module.so
60: [ 50%] Built target module
60: Scanning dependencies of target shared
60: [ 66%] Building CXX object CMakeFiles/shared.dir/shared.cpp.o
60: Linking CXX shared library libshared.dylib
60: [ 66%] Built target shared
60: Scanning dependencies of target testbundleutils1
60: [ 83%] Building CXX object CMakeFiles/testbundleutils1.dir/testbundleutils.cpp.o
60: Linking CXX executable testbundleutils1.app/Contents/MacOS/testbundleutils1
60: [ 83%] Built target testbundleutils1
60: Scanning dependencies of target testbundleutils1_test
60: INPUT = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testbundleutils1.app/Contents/MacOS/testbundleutils1
60: MODULE = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/module.so
60: INPUTDIR = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities
60: OUTPUTDIR = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1
60: OUTPUT = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1
60: OUTPUTMODULE = /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/module.so
60: -- fixup_bundle
60: -- app='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1'
60: -- libs='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/module.so'
60: -- dirs='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities'
60: -- fixup_bundle: preparing...
60: -- warning: gp_resolved_file_type non-absolute file 'libshared2.dylib' returning type 'other' -- possibly incorrect
60: warning: target 'libshared2.dylib' is not absolute...
60: -- warning: gp_resolved_file_type expects absolute full path for first arg original_file
60: -- warning: gp_resolved_file_type expects absolute full path for first arg original_file
60: -- warning: gp_resolved_file_type non-absolute file 'libshared.dylib' returning type 'other' -- possibly incorrect
60: --
60: warning: cannot resolve item 'framework'
60:
60: possible problems:
60: need more directories?
60: need to use InstallRequiredSystemLibraries?
60: run in install tree instead of build tree?
60:
60: -- warning: gp_resolved_file_type non-absolute file 'framework' returning type 'other' -- possibly incorrect
60: --
60: warning: cannot resolve item 'framework'
60:
60: possible problems:
60: need more directories?
60: need to use InstallRequiredSystemLibraries?
60: run in install tree instead of build tree?
60:
60: warning: target 'libshared.dylib' is not absolute...
60: -- warning: gp_resolved_file_type expects absolute full path for first arg original_file
60: -- warning: gp_resolved_file_type expects absolute full path for first arg original_file
60: warning: target 'framework' is not absolute...
60: warning: target 'framework' does not exist...
60: /usr/bin/otool: can't open file: framework (No such file or directory)
60: otool: can't open file: framework (No such file or directory)
60: --
60: warning: cannot resolve item 'framework'
60:
60: possible problems:
60: need more directories?
60: need to use InstallRequiredSystemLibraries?
60: run in install tree instead of build tree?
60:
60: -- fixup_bundle: copying...
60: -- 1/10: *NOT* copying '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/module.so'
60: -- 2/10: copying 'libshared2.dylib'
60: -- 3/10: *NOT* copying '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1'
60: -- 4/10: copying 'framework'
60: Error copying file "framework" to "/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework".
60: -- 5/10: copying 'libshared.dylib'
60: -- fixup_bundle: fixing...
60: -- 6/10: fixing up '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/module.so'
60: -- warning: gp_resolved_file_type non-absolute file 'libshared2.dylib' returning type 'other' -- possibly incorrect
60: -- 7/10: fixing up '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/libshared2.dylib'
60: -- 8/10: fixing up '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1'
60: -- warning: gp_resolved_file_type non-absolute file 'libshared.dylib' returning type 'other' -- possibly incorrect
60: --
60: warning: cannot resolve item 'framework'
60:
60: possible problems:
60: need more directories?
60: need to use InstallRequiredSystemLibraries?
60: run in install tree instead of build tree?
60:
60: -- warning: gp_resolved_file_type non-absolute file 'framework' returning type 'other' -- possibly incorrect
60: -- 9/10: fixing up '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework'
60: warning: target '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework' does not exist...
60: /usr/bin/otool: can't open file: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework (No such file or directory)
60: otool: can't open file: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework (No such file or directory)
60: install_name_tool: can't open file: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework (No such file or directory)
60: -- 10/10: fixing up '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/libshared.dylib'
60: -- fixup_bundle: cleaning up...
60: -- fixup_bundle: verifying...
60: -- ===========================================================================
60: -- Analyzing app='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1'
60: -- bundle='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app'
60: -- executable='/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1'
60: -- valid='1'
60: -- executable file 1: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1
60: -- warning: embedded item does not exist '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/framework'
60: --
60: warning: cannot resolve item '@executable_path/framework'
60:
60: possible problems:
60: need more directories?
60: need to use InstallRequiredSystemLibraries?
60: run in install tree instead of build tree?
60:
60: warning: target '@executable_path/framework' is not absolute...
60: warning: target '@executable_path/framework' does not exist...
60: /usr/bin/otool: can't open file: @executable_path/framework (No such file or directory)
60: otool: can't open file: @executable_path/framework (No such file or directory)
60: -- verified='1'
60: -- info='Verified 1 executable files in '/Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app''
60: --
60: -- verified='1'
60: -- info=''
60: --
60: -- fixup_bundle: done
60: dyld: Library not loaded: @executable_path/framework
60: Referenced from: /Users/davidcole/Dashboards/My Tests/CMake Mac-unix-Debug/Tests/BundleUtilities/testdir1/testbundleutils1.app/Contents/MacOS/testbundleutils1
60: Reason: image not found
60: CMake Error at /Users/davidcole/Dashboards/My Tests/CMake/Tests/BundleUtilities/bundleutils.cmake:43 (message):
60: failed to execute test program
60:
60:
60: make[2]: *** [CMakeFiles/testbundleutils1_test] Error 1
60: make[1]: *** [CMakeFiles/testbundleutils1_test.dir/all] Error 2
60: make: *** [all] Error 2
1/1 Test #60: BundleUtilities ..................***Failed 2.82 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 2.94 sec

The following tests FAILED:
     60 - BundleUtilities (Failed)
Errors while running CTest
(0026622)
Clinton Stimpson (developer)
2011-05-26 13:11

It fails for me. Maybe I didn't keep my stuff straight for the 3 different platforms I was making this patch for.
(0026623)
David Cole (manager)
2011-05-26 13:21

Does it work for you on Windows and/or Linux? (I haven't tried yet...)
(0026624)
Clinton Stimpson (developer)
2011-05-26 13:25

It did... I'll double check and fix the failure on mac and give you a new patch.
(0026626)
Clinton Stimpson (developer)
2011-05-26 14:37

The problem is this part which I added near the end of my testing (and forgot to re-test on Mac).

# make sure rpaths are not helping BundleUtilities or the executables
set_target_properties(shared shared2 module framework PROPERTIES
                      SKIP_BUILD_RPATH 1)

I can put an if(NOT APPLE) around it, but I'd like to avoid that.
It looks like things falls apart when it shouldn't.

The first issue I see is in GetPrerequisites.cmake gp_resolve_item() where it does a
  # Is it already resolved?
  #
  if(EXISTS "${resolved_item}")
    set(resolved 1)
  endif(EXISTS "${resolved_item}")

If the working directory is the same as the directory containing that file, it says its resolved even if its not an absolute path and isn't resolved.

I can fix that by changing it to this:
  # Is it already resolved?
  #
  if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
    set(resolved 1)
  endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")


The second problem is the install id is wrong for the framework library when it is compiled without rpaths:
$ otool -L framework.framework/framework
framework.framework/framework:
        framework (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version
        ....

It should instead be something like this:
framework.framework/framework:
        framework.framework/framework (compatibility version 0.0.0, current version 0.0.0)


Then it looks like one more problem in BundleUtilities.cmake's fixup_bundle_item().

So what do you think? The second problem appears to be a bug elsewhere in cmake.
(0026627)
David Cole (manager)
2011-05-26 15:06

I think we should figure it all out before we push this to 'next'. :-)

The "IS_ABSOLUTE" chunk looks good to me.

The install id of a framework should be the full path to itself, by default. At least that's what Xcode produces when you build a framework via the IDE with no CMake involvement. So... if CMake is producing a non-full path there, then we should figure out why and fix that bug before we do this.

Or, alternatively, we could eliminate (or comment out until later) the framework portion of this test so that we can get the functionality into 2.8.5 and add framework support later.
(0026628)
Clinton Stimpson (developer)
2011-05-26 17:56

Ok, the patch has been updated... and the framework is a normal shared library until we fix more issues.

I checked it on Windows, Linux and Mac.
(0026640)
David Cole (manager)
2011-05-27 15:57

One more question on this before I push to stage and merge to 'next' :

In the get_dotapp_dir function, the final (unexpected) "else" clause says:

  set(dotapp_dir "${s}")

Should that be, instead:

  if(IS_DIRECTORY "${s}")
    set(dotapp_dir "${s}")
  else()
    get_filename_component(dotapp_dir "${s}" PATH)
  endif()

Or should it be an error condition to call this function with a non-executable file or directory as its argument...?

??
(0026641)
David Cole (manager)
2011-05-27 16:20

I pushed it to 'next' anyway, to make sure it gets dashboard coverage this weekend...

If we want to add one more little patch to handle the unexpected/error condition, we can do that next week.
(0026642)
Clinton Stimpson (developer)
2011-05-27 18:30

I don't see how we would normally hit that case where it is a directory, but not a .app.
(0026643)
Clinton Stimpson (developer)
2011-05-27 18:50

I've attached a patch to fix a dashboard failure.
(0026644)
Clinton Stimpson (developer)
2011-05-27 19:07

I've added another patch to fix a dashboard failure when using xcode.
(0026670)
David Cole (manager)
2011-06-05 14:21

Fix includes this commit and several of its parent commits...

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51e16c05f7c4e70d8bbf97a13243b1f1cfffa2d7 [^]
(0027758)
David Cole (manager)
2011-11-11 10:45

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

 Issue History
Date Modified Username Field Change
2011-03-31 12:38 Mike Jackson New Issue
2011-04-13 22:42 Clinton Stimpson File Added: 0001-Add-tests-for-BundleUtilities-and-fix-bug-12034-for-.patch
2011-04-13 22:43 Clinton Stimpson Note Added: 0026175
2011-04-14 14:41 David Cole Assigned To => David Cole
2011-04-14 14:41 David Cole Status new => assigned
2011-04-14 14:41 David Cole Target Version => CMake 2.8.5
2011-05-26 11:02 David Cole Note Added: 0026621
2011-05-26 13:11 Clinton Stimpson Note Added: 0026622
2011-05-26 13:21 David Cole Note Added: 0026623
2011-05-26 13:25 Clinton Stimpson Note Added: 0026624
2011-05-26 14:37 Clinton Stimpson Note Added: 0026626
2011-05-26 15:06 David Cole Note Added: 0026627
2011-05-26 17:53 Clinton Stimpson File Deleted: 0001-Add-tests-for-BundleUtilities-and-fix-bug-12034-for-.patch
2011-05-26 17:54 Clinton Stimpson File Added: 0001-Add-tests-for-BundleUtilities-and-fix-bug-12034-for-.patch
2011-05-26 17:56 Clinton Stimpson Note Added: 0026628
2011-05-27 15:57 David Cole Note Added: 0026640
2011-05-27 16:20 David Cole Note Added: 0026641
2011-05-27 18:30 Clinton Stimpson Note Added: 0026642
2011-05-27 18:50 Clinton Stimpson File Added: 0001-Fix-regex-used-to-extract-dependents-from-ldd-to-acc.patch
2011-05-27 18:50 Clinton Stimpson Note Added: 0026643
2011-05-27 19:07 Clinton Stimpson File Added: 0001-Fix-BundleUtilities-test-when-using-xcode.patch
2011-05-27 19:07 Clinton Stimpson Note Added: 0026644
2011-06-05 14:21 David Cole Note Added: 0026670
2011-06-05 14:21 David Cole Status assigned => resolved
2011-06-05 14:21 David Cole Fixed in Version => CMake 2.8.5
2011-06-05 14:21 David Cole Resolution open => fixed
2011-11-11 10:45 David Cole Note Added: 0027758
2011-11-11 10:45 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team