PDA

View Full Version : Bundling an OS X app, then copying it...




GothicChess.Com
Aug 4, 2007, 03:09 PM
Greeting folks,

I have my program running fine under XCode. I can launch it as an executable on the drive where I compiled it.

Strangely... when I copy it to my flash drive, and install it on my other Mac, the program does not run. In fact, it quits at the point where it would be loading resources from the .nib file.

Is there some sort of project setting that is needed to make the application a "bundle" that I am not aware of?

It used to be, you compiled applications, and where you copied them to, you could run them.

This one has me a little perplexed.

Thanks in advance!



HexMonkey
Aug 4, 2007, 04:51 PM
You probably need to change the build configuration. Choose Project > Set Active Build Configuration > Release, then rebuild.

GothicChess.Com
Aug 4, 2007, 09:43 PM
You probably need to change the build configuration. Choose Project > Set Active Build Configuration > Release, then rebuild.

Hello Hex,

Thanks to all base-16 of your monkiness for the help :)

I suppose we are running different versions of XCode, as I did not have those options available. Even after a slow, patient examination of the TARGET and APPLICATION and BUILD settings, it seems apparent that the program is destinted to be a "production" instance, not a "test" instance.

Yet, when I copy it and run it on any different machine, it can't even draw a window since it can't find the nib.

This is rather discouraging.

The software is rather high performance, and I would very much enjoy being able to run it on my new faster system.

I need to be able to get over this hurdle. I just can't figure out why dragging an application to another computer fails to copy all of the necessary resources along with it.

Any other ideas?????

HexMonkey
Aug 4, 2007, 10:15 PM
What version of Xcode are you running? See the attached screenshot for where the option is in the latest version. When built using the "Debug" configuration, applications will only run on the system they were built on. This is because they are built using ZeroLink, which speeds up builds and allows some debugging features to work, but stops them working on other computers. See here (http://www.zathras.de/angelweb/blog-the-dangers-of-zerolink.htm) for more information. Older projects use the terms "Development" and "Deployment" instead of "Debug" and "Release", but they have the same meaning.

Failing this, is there any output in the Console when you run your application on your faster system?

GothicChess.Com
Aug 5, 2007, 07:14 AM
Hello again Hex,

And thanks for that very explicit explanation! Still, unable to get the thing to copy over and run on another box. It does seem like either a ZeroLink issue, or a Development Release issue, but neither is the case, apparently.

A puzzle, indeed.

I am running version 1.5 of XCode on Mac OS X.3.9 on a 500 MHz Dual Processor G4 Cube.

When I run it on the other system, it merely launches, does nothing, then quits. No output console, or anything of this sort.

I think I will start "debugging by fprintf()", writing to a text file to see how far in the code executes on the other system. I am fairly sure one of the...


err = CreateNibReference(CFSTR("main"), &nibRef);
require_noerr( err, CantGetNibRef );



...statements, which are very early in the code.

Our Project menus differ below the New Build Phase item. I have Edit Active Target and Edit Active Executable (just two items) where you have the cluster of the three "Set" menu items. I then have the New Custom Executable menu item, and nothing else.

I hope this helps.

I would think if this problem is nebulous enough, it's solution would be helpful to others as well.



What version of Xcode are you running? See the attached screenshot for where the option is in the latest version. When built using the "Debug" configuration, applications will only run on the system they were built on. This is because they are built using ZeroLink, which speeds up builds and allows some debugging features to work, but stops them working on other computers. See here (http://www.zathras.de/angelweb/blog-the-dangers-of-zerolink.htm) for more information. Older projects use the terms "Development" and "Deployment" instead of "Debug" and "Release", but they have the same meaning.

Failing this, is there any output in the Console when you run your application on your faster system?

kainjow
Aug 5, 2007, 10:27 AM
Are you running the application on a PPC or Intel? And in Console.app, there is no output?

Eraserhead
Aug 5, 2007, 10:42 AM
Could you email me the code and see if I can build your project successfully?

Otherwise maybe you are using a framework that is only available locally.

PS the old "Release" build name used to be Deployment.

HexMonkey
Aug 5, 2007, 02:37 PM
I am running version 1.5 of XCode on Mac OS X.3.9 on a 500 MHz Dual Processor G4 Cube.

I seem to remember the setting was somewhere else in that version, but can't remember where. It may have been called "Build Style" rather than "Build Configuration" back then too. Have a look around for it, looking in the help if necessary. If you've never changed such a setting, it will definitely be stopping it from running on other computers.

Alloye
Aug 5, 2007, 03:20 PM
What are you using to copy the app? Keep in mind that app and nib bundles are really just directories. If you are not using the Finder to move things around, you must ensure you're doing a recursive copy to pick up all the contents.

Also, what is your "other Mac" and which version of OS X is it running?

GothicChess.Com
Aug 5, 2007, 08:36 PM
Could you email me the code and see if I can build your project successfully?

Otherwise maybe you are using a framework that is only available locally.

PS the old "Release" build name used to be Deployment.

It's 62,000 lines of code. And, I just recently moved all of it into one main.c file :) It compiles fine, it runs fine, it does what it is supposed to do.

I just can't move the dang thing!!! Arrrrgh!

GothicChess.Com
Aug 5, 2007, 08:38 PM
What are you using to copy the app? Keep in mind that app and nib bundles are really just directories. If you are not using the Finder to move things around, you must ensure you're doing a recursive copy to pick up all the contents.

Also, what is your "other Mac" and which version of OS X is it running?

I'm just draggin the 760K application over to a flash drive, then plugging the flash drive into the other Mac, then running it after copying it to the hard drive.

Both are G4 boxes running OS X. One is X.3.9 the other is X.4.something.

GothicChess.Com
Aug 5, 2007, 08:40 PM
I seem to remember the setting was somewhere else in that version, but can't remember where. It may have been called "Build Style" rather than "Build Configuration" back then too. Have a look around for it, looking in the help if necessary. If you've never changed such a setting, it will definitely be stopping it from running on other computers.

Thanks for the tip.

You would think Apple, with all of its focus on interface design, would have made the default setting such that everything could be replicated.

The irony.... the irony. Here we are, smart people, and we can't figure out this setting...

kainjow
Aug 5, 2007, 09:21 PM
And you're 100% sure that there is nothing showing up in Console.app after you launch? Because if there is a weird crash happening at launch and it's because of the OS (linked to missing frameworks, incompatible function calls with 10.4 SDK, etc), then it will show in Console. If not, then it's a problem with your code (check your use of relative paths). Also, are you building as an application bundle (probably should be)?

GothicChess.Com
Aug 6, 2007, 08:34 AM
I saw at the top of my "Detailed Build" window that, indeed, the "Style" had been set to "Development". The problem was, where is the path to change this?

I finally found it by double clicking the project icon from within XCode. One of the panes that is shown is "Styles", as mentioned by HexMonkey.

And, sure enough, one of the um-teen options shown will allow you to specify "Deployment" rather than "Development".

The XCode developers get a D- for this one. Terrible feature, terrible interface, and un-intuitive implementation.

Thanks to all for offering suggestions!