Using private frameworks for QT in xcode 4.3 - xcode

The Mac QT Installer puts its shared libraries under /Library/Frameworks/QtXXX.Framework.
I'm building a QT application using a qmake-generated xcode project. I'd like to add these frameworks as private framewords inside my app bundle for easy deployment.
I've tried various options for doing this but I don't seem to be able to make it work. What I did -
change the Qt framework files in /Library/Frameworks/ using install_name_tool as described here
copy the these framework bundles manually to inside the app bundle
recompiling the bundle.
When I change the name of the original framework so it would appear that it's not there, the app crashes and says that it doesn't find the needed framework. What am I doing wrong?
Using xcode 4.3 on OSX 10.7.3

Some options to deploy a Qt application on Mac:
Qt comes with the macdeployqt tool, to bundle Qt with the built app bundle. The tool is a bit limited though and might or might not do what you want.
CMake comes with DeployQt4, which can also be used for deployment only, in case one doesn't want to use cmake for the build as well.
One can write his own script using install_name_tool as described in your link. If it doesn't work, check with otool -L if you replaced all absolute paths in the executable and bundled libraries. You will have to fix the paths for the bundled libraries, too! (recursively, so to say).
The latest released cmake version (2.8.7) doesn't support XCode 4.3 properly though: Since Xcode 4.3, files previously being installed to /Developer are now in /Applications/Xcode.app/Contents/Developer. cmake still expects them in /Developer. That is fixed in cmake master but not released yet. A workaround is to create a symlink:
ln -s /Applications/Xcode.app/Contents/Developer /Developer

Related

Where has Lipo tool gone in XCode 4/5?

I had lipo on my command-line - I think as a left-over from XCode 3.2. I removed that old version today and now my scripts using LIPO=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo don't work!
Where can I find the location of Lipo now I'm using XCode 4/5? Will it be installed by default, or do I have to get an extra toolset from Apple? I noticed that XCode builds are still creating unified libs OK.
Apple moved the whole /Developer structure inside the app bundle. Everything that was in /Developer is now in Xcode.app/Contents/Developer.
The path to lipo would now be /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo
You can use xcode-select to get the path to lipo of the current Xcode version (useful if you use beta versions, because you can use xcode-select to switch between release and beta version without changing your scripts):
LIPO=`xcode-select -p`/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo
And if you install the Xcode Command Line Tools you will have a lipo in your system path (i.e. /usr/bin/lipo), so you don't need to create those path variables at all. The command line tools download should be available in the Downloads tab of Xcodes Preferences panel.

Where to get macos SDK 10.6 for Xcode?

I am having Xcode 4.4 on OS X Lion. I'd like to install the Mac 10.6 SDK - also known as macosx10.7 SDK - because I need to compile openFrameworks.
I found that I need to download additional tools from this site. However I didn't find any 10.6 SDK there. I also tried looking in Xcode Preferences -> Downloads -> Components, but there is no way.
I am wondering how can I install previous SDKs for Xcode?
Unfortunately, Apple tends to make this much harder than you'd like. You can't download SDKs by themselves. They come as part of specific versions of Xcode. So you have to download the right version of Xcode. Search for "10.6", and you'll see that you want Xcode 4.1.
Once you download that, you can install it (that version will go into /Developer, so it won't break your /Applications version), or you can open up the package and find the SDKs in it. If you don't know how to crack open these packages, just install it.
Once you do that, search for "MacOSX10.6.sdk". I forget exactly where it is in that particular version.
What I do at that point is copy the sdk into a /SDKs directory. That way I always have them all.
Now, you need to add it to your current version of Xcode. You can do that by making symlinks in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs. If you like, you can use my tiny link-sdks script for that.
UPDATE: In modern versions of Xcode (7.3+) to use older SDKs edit MinimumSDKVersion here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist
All legacy MacOS SDKs can be found on GitHub -
https://github.com/phracker/MacOSX-SDKs
If you search the openFrameworks forums, there are a few posts where people are providing download links from their public Dropbox folders, for example.
Somewhat off topic, but I hit a very similar problem trying to install Erlang using kerl.
Everything worked for me until the "kerl build ..." step. The build log showed the following error:
odbcserver.c:117:10: fatal error: 'sql.h' file not found #include "sql.h"
The problem is that the ODBC is no longer part of the Mavericks installation(i.e., MacOS 10.6 SDK isn't installed). Piecing together advice from a variety of sites, none of which worked by themselves, the following set of steps fixed the issue:
brew install unixodbc - installs the missing ODBC libraries and include files (e.g., sql.h).
Set CFLAGS to point to the include directory for the unixodbc installation as part of the kerl build command (e.g.,):
CFLAGS="-I/usr/local/Cellar/unixodbc/2.3.2/include" ./kerl build R15B R15B
This points the build to the ODBC include files.
My environment is Mavericks, the xcode command line tools, and xcode v5.1.1.
Some SDK(with Xcode) you can download from direct links. List here:
http://iphonesdkdev.blogspot.ru/2010/04/old-versions-of-iphone-sdk.html
Some don't work, but something you can still download. For example:
http://adcdownload.apple.com/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg

Xcode 4.3 with Eclipse, CUDA, problems?

I understand that the /Developer folder no longer exists after installing XCode4.3. To me, this seems it would have bad consequences. First, CUDA installs into /Developer/GPU_Computing. Second, what happens to the GCC keychain? Eclipse relies on the GCC keychain command line tools, which I'm told disappear with Xcode 4.3.
Can someone shed light as to whether they have dealt with either of these problems?
Xcode 4.3 changed a lot.
Starting from the version 4.3 XCode became a standard Mac OS X application(it reside in the Application Folder), so you can try to move the GPU_Computing under the new root folder of XCode. However i think that an updated version of the CUDA SDK you add support for the new Xcode folder structure.
XCode and Apple are moving towards the new LLVM compiler, so GCC still supported for now, but it will disappear in next releases, so you should migrate to LLVM as soon as you can ...
You can still use GCC with eclipse installing Command line Developer Tools package .
You will have to install command-line tools package.
Run Xcode, open Wcode->Preferences..., and on "Components" tab on the "Downloads" screen select "Command line tools".
I can build and run CUDA Toolkit samples with that package installed.

qmake QT 4.6 application with no XCode project in Mac OS X?

I've downloaded the source for KardsGT, which is written for I think QT 4.6.x onto my Mac OS X 10.6.8 system.
Since KardsGT is not written specifically for Mac OS X (it was meant for GNU/Linux), there is no associated XCode files, etc. When I run qmake on the source, I get lots of error like
WARNING: Ignored (not found) '/src/kardsgt-0.7.1/src/players/players-debug.xcodeproj'
It seems that qmake is thinking I am using XCode for this project? How do I correct this so the code will compile? (I've tried qmake -unix but that didn't change the results)
You do not need Xcode to compile a Qt program. Just run
$ qmake -config release
$ make clean
$ make
and you should be good to go (if the sources do not use any Linux-specific stuff).

Linking to libcrypto for Leopard?

I am using Mac OS X 10.6 SDK and my deployment target is set to Mac OS 10.5. I'm linking to libcrypto (AquaticPrime requires this) and found out that my app doesn't launch on Leopard. The error is
dyld: Library not loaded: /usr/lib/libcrypto.0.9.8.dylib
I've tried the following workarounds but none of them work:
Linking directly to libcrypto.0.9.7.dylib (the 10.6 SDK refuses to link directly with libcrypto.0.9.7.dylib.
Copying the 10.5 SDK's version of libcrypto.0.9.7.dylib to the 10.6 lib directory and try t link with it (this time the link process succeeded but in Leopard the app still tries to lookup the non-existent libcrypto.0.9.8.dylib file and thus won't launch).
Copying libcrypto.0.9.7.dylib from a Mac OS X 10.5.8 installation and link with it (the link was successful but the app still looks for libcrypto.0.9.8.dylib).
Is there a way to link to this library and still use the 10.6 SDK?
Thanks.
As per this thread here ( first post in thread: http://lists.apple.com/archives/cocoa-dev/2009/Aug/msg01737.html , "libcrypto on Snow Leopard" thread listing: http://lists.apple.com/archives/cocoa-dev/2009/Aug/thrd19.html ), I believe the solution is to do the following:
Go to /Developer/SDKs/MacOSX10.5.sdk/usr/lib/ . From this folder, copy "libcrypto.0.9.7.dylib" to your project source folder.
Rename the file you just copied to "libmycrypto.dylib".
Add the file you just renamed to your project. Make sure to remove any other linked libcrypto frameworks from your project.
Go through your build settings, and make sure you remove the "-lcrypto" linker flag. (It's usually put in the "Other Linker Flags" setting.)
Now you should be able to build your project and it will work on both 10.5 and 10.6.
(libcrypto.0.9.7 is available on both 10.5 and 10.6. The file you copied is just a stub of the headers, but you're just linking against it, not embedding it in your project. Since the linker uses the install path not the actual filename of the dylib, naming it "libmycrypto.dylib" eliminates path conflicts, but still allows you to link against the library you need.
FWIW, this is an Xcode problem. You should be able to link against /usr/lib/libcrypto.dylib -- the symbolic link -- and have it target the correct version of libcrypto on both 10.5 and 10.6. However, Xcode always seems to link to version 0.9.8 when building on Snow Leopard for some reason.)
You could try setting the base SDK to 10.5 in your target build settings.
Depending on what you're using the lib for, you might be able to replace libcrypto with CommonCrypto which works well with both 10.5 and 10.6. I've used libcrypto only for the MD5 function, so I replaced openssl/md5.h with CommonCrypto/CommonDigest.h and MD5() with CC_MD5(), and libcrypto with CommonCrypto, and now it works on both Leopards.
Have you tried linking against libcrypto.0.9.dylib or libcrypto.dylib instead of the specific versions?
Leopard OS X ships with a libcrypto and libssl that only has the ppc architecture.
A simple solution that doesn't require changing the code of the app is to backup your libcrypto.0.9.dylib, libcrypto.0.9.8.dylib, libssl0.9.dylib, libssl.0.9.8.dylib and copy over the libcrypto.0.9.7.dylib and libssl.0.9.7.dylib.
You can use Terminal.app to make these changes in your Applications folder:
cd /usr/lib
sudo cp libcrypto.0.9.dylib libcrypto.0.9.dylib.old
sudo cp libssl.0.9.dylib libssl.0.9.dylib.old
sudo ln -sf libcrypto.0.9.7.dylib libcrypto.0.9.dylib
sudo ln -sf libssl.0.9.7.dylib libssl.0.9.dylib
Here's an alternative solution that lets you stay on the freshest openssl version:
1. reactivate the current openssl: port activate openssl#1.0.0c_0 (or whatever)
2. clean up your old unwanted versions of everything: port uninstall inactive
3. uninstall badly behaved ports: port uninstall md5sha1sum subversion neon
4. get them back: port install subversion md5sha1sum

Resources