Universal Binary on Mac OS X
boulifb

Hello,

I have compiled and installed Allegro using the universal binary option. While it compiled well and runs fine on my Mac intel, I am unable to produce any true universal binaries. After compilation, I get only intel compiled boundled applcations, thus even if I select PPC and Intel as architecture targets in Xcode.

Maybe I have missunderstood a step in the installation procedure, but I don't see where.

Can anybody tell me how to compile properly allegro applications as universal binary please? ???

Best regards.

Fred.

Thomas Harte

I think this might be another problem with Allegro's Probject Builder templates when matched to modern Xcode. The problem is probably that you have ZeroLink enabled even for your Deployment build? If so then that's why you're only getting an Intel binary. One way to fix your problem is to disable ZeroLink for your Deployment build. Another way is to do "Project->Upgrade All Targets in Project to Native" (which seems to mean "native to Xcode", not "native to your CPU family") which I think does a similar thing. But check that ZeroLink setting just to be sure!

boulifb

Hi,

The ZeroLink is already deactivated. When I use the "Upgrade All Targets in Project to Native" I get plenty of errors (203) in allegro headers and so on...

Maybe the Xcode template have to be updated to the newer versions of Xcode.

There must be a way to compile allegro applications in UB while waiting for "bug" fix.

Thomas Harte
Quote:

Hi,

The ZeroLink is already deactivated. When I use the "Upgrade All Targets in Project to Native" I get plenty of errors (203) in allegro headers and so on...

Which begs the question — did you remember to do ./fix.sh macosx-universal instead of just ./fix.sh macosx? Allegro, being very weird, is very UNIX centric and based on the model that your users will download your application and install Allegro for themselves separately.

Quote:

Maybe the Xcode template have to be updated to the newer versions of Xcode.

There must be a way to compile allegro applications in UB while waiting for "bug" fix.

Attached is my replacement Allegro template for Xcode. Assuming you have universal versions of the Allegro framework and .a libraries (another UNIX hangover), it'll build universal binaries for you and, unlike the ProjectBuilder project, will even embed the framework so you can easily distribute your work.

Go to /Library/Application Support/Apple/Developer Tools/Project Templates/Application/Allegro Application/, trash everything except main.c and drop in the AllegroApp.xcodeproj that comes out of the .zip file. After that, all Allegro projects you create will be in its image.

I've actually been meaning to offer it for contribution to the main Allegro distribution, I just haven't had my Mac online for the last week.

boulifb

Hi Thomas,

Ok, with our project fix it is compiled as UB!!! When getting the info (Get Info) the system says it is a universal application :)
That's great!! :)
Thanks!!

Fred.

Thomas Harte

That's good news! I must put together an installer with the framework, the project files and the various .a and .dylib files as soon as I've figured out how!

boulifb

as it manually works, it should be a good idea to integrate the fix to the install process of allegro.

Note:
A friend tested the generated app on his PPC mac, and he had the following log:

Last login: Wed Nov 22 22:11:59 on console
/Users/collo/Desktop/TokiTori.app/Contents/MacOS/TokiTori; exit
Welcome to Darwin!
Collos-Computer:~ collo$
/Users/collo/Desktop/TokiTori.app/Contents/MacOS/TokiTori; exit
dyld: Library not loaded: liballeg-4.2.dylib
Referenced from: /Users/collo/Desktop/TokiTori.app/Contents/MacOS/TokiTori
Reason: image not found
Trace/BPT trap
logout
[Process completed]

Any idea?

Fred.

Thomas Harte

Did you do sudo make install-framework EMBED=1 rather than just sudo make install-framework when you built Allegro?

Trogdor

This might sound as a strange or noobish request (which is right, i got a mac since 2 months and the last time i coded anything in C was at least 10 years ago), but Thomas, as you seem to be very experienced with this, could you perhaps draw up a quick howto of getting allegro to work correctly under macosx ?
The helpfile ( http://alleg.sourceforge.net/latestdocs/en/build/macosx.html ) kind of gives some options, but raises me more quiestions then it answers.

I want to build universal binaries (ofcourse)
I want to embed allegro (ofcourse. can hardly expect users to install some 3rd party stuff as well, that would be highly amateuristic)

I am currently fighting with the installation.
For example setting the staticlinking option on for a universal binary gives me a "archive's cputype (7, architecture i386) does not match cputype (18) for specified -arch flag: ppc" error (installing it on coreduo machine, not on a ppc)
(do i actualy need static linking?)

Also if i build it all the standard way and create an allegro project in xcode, i get a reference to a 'projectname.app' file in the project, that is not created.
It builds and runs only if i remove the reference.

So, a somewhat more clear helpfile / howto / listing of options would be rather helpfull to me, and probably also to other fresh starters like myself (that i know are lurking around somewhere. speak up, crowd!)

(again, sorry if my lack of experience is wasting time)

Edit:
one thing i found out is that you have to 'sudo make uninstall' 'sudo make clean' in order to change build flags. otherwise the whole rebuild process will do nothing at all.

The correct setup is: ./fix macosx-universal
and make sure the EMBED=1 thingy is enabled when installing the framework.

Thread #589339. Printed from Allegro.cc