200 PTS - Mac OS X Keyhotee Packaging Script [PAID]

Started by bytemaster, January 04, 2014, 03:41:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bytemaster

Due to the recent fall in the PTS value I am increasing this bounty to 200 PTS.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

dacer


dacer

Quote from: toast on January 07, 2014, 03:59:33 AM
DACer do you have Xcode or the command-line tools?
Yes I do have Xcode 5.02 and commandline-tool installed. Unfortunately I have no input for your other questions.
Good luck with the bounty, toast:)

bytemaster

Quote from: toast on January 07, 2014, 03:59:33 AM
DACer do you have Xcode or the command-line tools?
Is it normal for macs to ship without a compiled libstdc++? o.O

I think the new plan of action is to make a script to:

use otool -L to get a list of dependencies for each binary
copy the dependencies into Keyhotee.app/Contents/Framework
use install_name_tool to update the dependency location
recurse for each dependency

does that sound right?

Here are some tips I can offer, when preparing ProtoShares-Qt for release I worked on this script:
cp -rf /opt/local/lib/libminiupnpc.8.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libssl.1.0.0.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libcrypto.1.0.0.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libz.1.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/db48/libdb_cxx-4.8.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libboost_filesystem-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libboost_program_options-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libboost_thread-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -rf /opt/local/lib/libboost_chrono-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/
cp -r /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets ./ProtoShares-Qt.app/Contents/MacOS/
cp -r /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui ./ProtoShares-Qt.app/Contents/MacOS/
cp -r /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore ./ProtoShares-Qt.app/Contents/MacOS/
cp -r /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork ./ProtoShares-Qt.app/Contents/MacOS/
exit
install_name_tool -change /opt/local/lib/libminiupnpc.8.dylib @executable_path/libminiupnpc.8.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libssl.1.0.0.dylib @executable_path/libssl.1.0.0.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libcrypto.1.0.0.dylib @executable_path/libcrypto.1.0.0.dylib ./ProtoShares-Qt.app/Contents/MacOS/libssl.1.0.0.dylib
install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/libz.1.dylib ./ProtoShares-Qt.app/Contents/MacOS/libssl.1.0.0.dylib
install_name_tool -change /opt/local/lib/db48/libdb_cxx-4.8.dylib @executable_path/libdb_cxx-4.8.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libboost_system-mt.dylib @executable_path/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libboost_filesystem-mt.dylib @executable_path/libboost_filesystem-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libboost_program_options-mt.dylib @executable_path/libboost_program_options-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libboost_thread-mt.dylib @executable_path/libboost_thread-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /opt/local/lib/libboost_chrono-mt.dylib @executable_path/libboost_chrono-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/QtWidgets ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui @executable_path/QtGui ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/QtCore ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork @executable_path/QtNetwork ./ProtoShares-Qt.app/Contents/MacOS/ProtoShares-Qt


install_name_tool -change /opt/local/lib/libboost_system-mt.dylib @executable_path/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/libboost_thread-mt.dylib
install_name_tool -change /opt/local/lib/libboost_system-mt.dylib @executable_path/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/libboost_filesystem-mt.dylib
install_name_tool -change /opt/local/lib/libboost_system-mt.dylib @executable_path/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/libboost_chrono-mt.dylib
install_name_tool -change /opt/local/lib/libboost_system-mt.dylib @executable_path/libboost_system-mt.dylib ./ProtoShares-Qt.app/Contents/MacOS/libboost_program_options-mt.dylib



install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Versions/5/QtGui @executable_path/QtGui ./ProtoShares-Qt.app/Contents/MacOS/QtWidgets
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/QtCore ./ProtoShares-Qt.app/Contents/MacOS/QtWidgets
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/QtCore ./ProtoShares-Qt.app/Contents/MacOS/QtNetwork
install_name_tool -change /Users/dlarimer/Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/QtCore ./ProtoShares-Qt.app/Contents/MacOS/QtGui


It will provide the clues you need to move the stdlib into the .app bundle and have it link properly.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

toast

DACer do you have Xcode or the command-line tools?
Is it normal for macs to ship without a compiled libstdc++? o.O

I think the new plan of action is to make a script to:

use otool -L to get a list of dependencies for each binary
copy the dependencies into Keyhotee.app/Contents/Framework
use install_name_tool to update the dependency location
recurse for each dependency

does that sound right?
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

toast

Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

dacer

toast, your app doesn't work. Here are the errors:

Process:         Keyhotee [96701]
Path:            /Users/USER/Desktop/Keyhotee.app/Contents/MacOS/Keyhotee
Identifier:      com.invictus-innovations.Keyhotee
Version:         ???
Code Type:       X86-64 (Native)
Parent Process:  launchd [325]
Responsible:     Keyhotee [96701]
User ID:         502

Date/Time:       2014-01-07 11:22:08.719 +0800
OS Version:      Mac OS X 10.9.1 (13B42)
Report Version:  11
Anonymous UUID:  34E4D3B8-32EB-4101-C151-E00FF791C271

Sleep/Wake UUID: 449CA051-C2E8-4E65-A794-89684178D6A1

Crashed Thread:  0

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: __ZNSt12bad_weak_ptrD1Ev
  Referenced from: /Users/USER/Desktop/Keyhotee.app/Contents/MacOS/Keyhotee
  Expected in: /usr/lib/libstdc++.6.dylib
in /Users/USER/Desktop/Keyhotee.app/Contents/MacOS/Keyhotee

Binary Images:
       0x103069000 -        0x103519ff7 +QtWidgets (5.2) <90678B22-5BFC-336C-9013-C8AD403562AA> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
       0x103641000 -        0x10366afff +QtPrintSupport (5.2) <6FF469E4-221E-3778-B7F3-38BE34501CFB> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
       0x103688000 -        0x104e45fff +QtWebKit (5.2) <D6CD80EC-39FB-337F-91B4-ED65F038468A> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtWebKit.framework/Versions/5/QtWebKit
       0x1050c7000 -        0x105447fff +QtGui (5.2) <9EE7FD9C-121D-3D0B-8CC7-1D46745BB2E9> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
       0x105512000 -        0x105614ff7 +QtNetwork (5.2) <0E387C83-7429-3900-8113-63CCBC7DBD91> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
       0x10564a000 -        0x105b2aff7 +QtCore (5.2) <13F4E3F1-E1B0-3DA9-AF41-D189CEA9F30E> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
       0x105bb3000 -        0x105bb7fff  com.apple.agl (3.2.3 - AGL-3.2.3) <1B85306F-D2BF-3FE3-9915-165237B491EB> /System/Library/Frameworks/AGL.framework/Versions/A/AGL
       0x105bbf000 -        0x105e60fff +QtQuick (5.2) <C6FE3B79-4F6D-3E59-AB61-C4729D4E96D3> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtQuick.framework/Versions/5/QtQuick
       0x105efe000 -        0x10622fff7 +QtQml (5.2) <3C186F3B-725B-318A-A8B3-42CD18EC101A> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtQml.framework/Versions/5/QtQml
       0x1062af000 -        0x1062e5fff +QtPositioning (5.2) <CAB66797-BF4D-3AC7-B3F7-A3D56B090AFE> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtPositioning.framework/Versions/5/QtPositioning
       0x1062fa000 -        0x106387ff7 +QtMultimedia (5.2) <17628B38-FB07-36C5-8B2B-12DDC26222B0> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtMultimedia.framework/Versions/5/QtMultimedia
       0x1063c8000 -        0x1063f1fff +QtSql (5.2) <A2D12DF9-665E-30D2-99EF-FDCA8D393A58> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtSql.framework/Versions/5/QtSql
       0x106409000 -        0x106429ff7 +QtSensors (5.2) <305A3896-E85C-36E1-890A-4F895DF65BCC> /Users/USER/Desktop/Keyhotee.app/Contents/Frameworks/QtSensors.framework/Versions/5/QtSensors
    0x7fff6cd18000 -     0x7fff6cd4b817  dyld (239.3) <D1DFCF3F-0B0C-332A-BCC0-87A851B570FF> /usr/lib/dyld
    0x7fff8b5c0000 -     0x7fff8b60eff9  libstdc++.6.dylib (60) <0241E6A4-1368-33BE-950B-D0A175C41F54> /usr/lib/libstdc++.6.dylib
    0x7fff8b60f000 -     0x7fff8b61bff7  com.apple.OpenDirectory (10.9 - 173.1.1) <6B78BD7B-5622-38E6-8FC6-86A117E3ACCA> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory
    0x7fff8b61c000 -     0x7fff8b61dff7  libSystem.B.dylib (1197.1.1) <BFC0DC97-46C6-3BE0-9983-54A98734897A> /usr/lib/libSystem.B.dylib
    0x7fff8b755000 -     0x7fff8c07105f  com.apple.CoreGraphics (1.600.0 - 599.7) <7D0FD5A7-A061-39BA-8E00-723825D2C4DD> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
    0x7fff8c0af000 -     0x7fff8c0b5ff7  libsystem_platform.dylib (24.1.4) <331BA4A5-55CE-3B95-99EB-44E0C89D7FB8> /usr/lib/system/libsystem_platform.dylib
    0x7fff8c106000 -     0x7fff8c116fff  libbsm.0.dylib (33) <2CAC00A2-1352-302A-88FA-C567D4D69179> /usr/lib/libbsm.0.dylib
.....

toast

yo, this part might actually be all that you need to do... but again it depends on what's going on on your machine

## wtf, but this worked
# cp -r /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/ /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/lib
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

toast

Ok, I *think* I maybe got a portable app. Gonna hold off on writing a script until someone else confirms it works on their machine. We might also have to work together a bit because the script may end up depending on the environment pretty hard.

Anyway, here's a high-level outline of what I did


# cd keyhotee/bin

## copy libstdc++.6.dylib and libgcc_s.1.dylib from gcc folder from brew installation
# cp /usr/local/Cellar/gcc48/4.8.2/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/libstdc++.6.dylib Keyhotee.app/Contents/Frameworks/libstdc++.6.dylib
# cp /usr/local/Cellar/gcc48/4.8.2/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/libgcc_s.1.dylib Keyhotee.app/Contents/Frameworks/libgcc_s.1.dylib

## change references in offending library
# install_name_tool -change /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/lib/libstdc++.6.dylib @executable_path/../Frameworks/libstdc++.6.dylib Keyhotee.app/Contents/PlugIns/sqldrivers/libqsqlite.dylib
# install_name_tool -change /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/lib/libgcc_s.1.dylib @executable_path/../Frameworks/libgcc_s.1.dylib Keyhotee.app/Contents/PlugIns/sqldrivers/libqsqlite.dylib

## wtf, but this worked
# cp -r /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2/ /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/lib

## finally
# sudo /usr/local/Cellar/qt5/5.2.0/bin/macdeployqt Keyhotee.app/ -dmg



dmg download link:
https://dl.dropboxusercontent.com/u/12641785/Keyhotee.dmg
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

bytemaster

Quote from: toast on January 06, 2014, 10:45:22 PM
What exactly should this script do? The fix appears to be to rebuild your local qt installation with a particular flag.
edit: do you mean the script to put the app into a nice .dmg?

I can package up my local .app and we can test if it's portable

Correct, when you just compile the .app (something I have been able to do for development) the shared libraries are referenced from /opt/???   
When I run the macdeployqt script it doesn't completely resolve all of the issues and move the required dependencies inside the .app bundle
When I get that fixed it runs then crashes loading Qt image plugins. 

So making it portable is the challenge here.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

toast

What exactly should this script do? The fix appears to be to rebuild your local qt installation with a particular flag.
edit: do you mean the script to put the app into a nice .dmg?

I can package up my local .app and we can test if it's portable
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

bytemaster

Quote from: toast on January 06, 2014, 10:34:08 PM
Aha! Compilation successful, make install successful & keyhotee running after tackling the libpng issues.

bytemaster, try

brew uninstall qt5
brew install libpng
brew install qt5 --without-x11


then delete CMakeCache/CMakeFiles and redo everything

This should link in homebrew's libpng and remove the dependency on x11

Looks like you are but one small step away from winning this bounty... write a script and provide a download link to a OS X Keyhotee.dmg file :)
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

toast

Aha! Compilation successful, make install successful & keyhotee running after tackling the libpng issues.

bytemaster, try

brew uninstall qt5
brew install libpng
brew install qt5 --without-x11


then delete CMakeCache/CMakeFiles and redo everything

This should link in homebrew's libpng and remove the dependency on x11
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

toast

nvm, read your post more carefully

try deleting the whole repo, re-downloading, and building again. Probably not the "right" way to do it but it has worked for me before
cmake's caching sucks
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

toast

Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.