[Interest] Deploying on Mac permissions and automation

Sensei senseiwa at gmail.com
Mon Apr 7 14:43:11 CEST 2014


Dear all,

I am experimenting with MacOS X (Qt 4.8.5), and I am finding it quite 
unusual. The application is built by Xcode, and Qt comes from homebrew.

The first question: does macdeployqt need special permissions? If I run 
it as a standard user, I get errors, if I sudo it, everything is fine:


sensei:Debug% macdeployqt MyApp.app
ERROR: "error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: 
file: 
/Users/sensei/Documents/Projects/MyApp/MyApp/DerivedData/MyApp/Build/Products/Debug/MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore 
is not writable (Permission denied)
"
ERROR: ""
ERROR: "error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't open input file: 
MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore for 
writing (Permission denied)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't lseek to offset: 0 in file: 
MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore for 
writing (Bad file descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't write new headers in file: 
MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore (Bad 
file descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't close written on input file: 
MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore (Bad 
file descriptor)
"
ERROR: ""
ERROR: "error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: 
file: 
/Users/sensei/Documents/Projects/MyApp/MyApp/DerivedData/MyApp/Build/Products/Debug/MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui 
is not writable (Permission denied)
"
ERROR: ""
ERROR: "error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't open input file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui for 
writing (Permission denied)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't lseek to offset: 0 in file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui for 
writing (Bad file descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't write new headers in file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui (Bad file 
descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't close written on input file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui (Bad file 
descriptor)
"
ERROR: ""
ERROR: "error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't open input file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui for 
writing (Permission denied)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't lseek to offset: 0 in file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui for 
writing (Bad file descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't write new headers in file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui (Bad file 
descriptor)
error: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: 
can't close written on input file: 
MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui (Bad file 
descriptor)
"
ERROR: ""





However, with sudo it works:

sensei:Debug% sudo macdeployqt MyApp.app -verbose=3
Log: Using otool:
Log:  inspecting "MyApp.app/Contents/MacOS/MyApp"
Log: Adding framework:
Log: Framework name "QtCore.framework"
  Framework directory "/usr/local/lib/"
  Framework path "/usr/local/lib/QtCore.framework"
  Binary directory "Versions/4"
  Binary name "QtCore"
  Binary path "/Versions/4/QtCore"
  Version "4"
  Install name "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
  Deployed install name 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
  Source file Path "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
  Destination Directory (relative to bundle) 
"Contents/Frameworks/QtCore.framework/Versions/4"

Log: Adding framework:
Log: Framework name "QtGui.framework"
  Framework directory "/usr/local/lib/"
  Framework path "/usr/local/lib/QtGui.framework"
  Binary directory "Versions/4"
  Binary name "QtGui"
  Binary path "/Versions/4/QtGui"
  Version "4"
  Install name "/usr/local/lib/QtGui.framework/Versions/4/QtGui"
  Deployed install name 
"@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui"
  Source file Path "/usr/local/lib/QtGui.framework/Versions/4/QtGui"
  Destination Directory (relative to bundle) 
"Contents/Frameworks/QtGui.framework/Versions/4"

Log:
Log: Deploying Qt frameworks found inside: 
("MyApp.app/Contents/MacOS/MyApp")
Log: Using install_name_tool:
Log:  in "MyApp.app/Contents/MacOS/MyApp"
Log:  change reference "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
Log:  to 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
Log:  copied: "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
Log:  to "MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
Log: Using strip:
Log:  stripped 
"MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
Log: Using install_name_tool:
Log:  change identification in 
"MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
Log:  to 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
Log: Using otool:
Log:  inspecting 
"MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"
Log: Using install_name_tool:
Log:  in "MyApp.app/Contents/MacOS/MyApp"
Log:  change reference "/usr/local/lib/QtGui.framework/Versions/4/QtGui"
Log:  to "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui"
Log:  copied: "/usr/local/lib/QtGui.framework/Versions/4/QtGui"
Log:  to "MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
Log:  copied: 
"/usr/local/lib/QtGui.framework/Resources/qt_menu.nib/classes.nib"
Log:  to 
"MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/classes.nib" 

Log:  copied: 
"/usr/local/lib/QtGui.framework/Resources/qt_menu.nib/info.nib"
Log:  to 
"MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/info.nib" 

Log:  copied: 
"/usr/local/lib/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib"
Log:  to 
"MyApp.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib" 

Log: Using strip:
Log:  stripped 
"MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
Log: Using install_name_tool:
Log:  change identification in 
"MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
Log:  to "@executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui"
Log: Using otool:
Log:  inspecting 
"MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
Log: Adding framework:
Log: Framework name "QtCore.framework"
  Framework directory "/usr/local/Cellar/qt/4.8.5/lib/"
  Framework path "/usr/local/Cellar/qt/4.8.5/lib/QtCore.framework"
  Binary directory "Versions/4"
  Binary name "QtCore"
  Binary path "/Versions/4/QtCore"
  Version "4"
  Install name 
"/usr/local/Cellar/qt/4.8.5/lib/QtCore.framework/Versions/4/QtCore"
  Deployed install name 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
  Source file Path 
"/usr/local/Cellar/qt/4.8.5/lib/QtCore.framework/Versions/4/QtCore"
  Destination Directory (relative to bundle) 
"Contents/Frameworks/QtCore.framework/Versions/4"

Log: Using install_name_tool:
Log:  in "MyApp.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui"
Log:  change reference 
"/usr/local/Cellar/qt/4.8.5/lib/QtCore.framework/Versions/4/QtCore"
Log:  to 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
Log:
Log: Deploying plugins from "/usr/local/plugins"
Log: Created configuration file: "MyApp.app/Contents/Resources/qt.conf"
Log: This file sets the plugin search path to "MyApp.app/Contents/PlugIns"
sensei:Debug%






Second question, related to the above: why isn't install_name_tool 
working? Starting the application on a vanilla computer I get the 
ominous error "Library not loaded: /usr/local/Cellar...", which is 
referenced from QtGui inside my app bundle.

In the above log, I see that QtCore is tentatively installed with a 
relative path:


Log: Deploying Qt frameworks found inside: 
("MyApp.app/Contents/MacOS/MyApp")
Log: Using install_name_tool:
Log:  in "MyApp.app/Contents/MacOS/MyApp"
Log:  change reference "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
Log:  to 
"@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore"
Log:  copied: "/usr/local/lib/QtCore.framework/Versions/4/QtCore"
Log:  to "MyApp.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore"



So, actually I'd expected not to have the error.

Am I doing something wrong? Am I misreading the log?



Thanks!



More information about the Interest mailing list