|
OSX Snow Leopard |
OnlineCop
Member #7,919
October 2006
|
I upgraded from Leopard to Snow Leopard. When I tried to compile any of my previously-working projects, I get several warnings and a compile error: liballeg-main.a, file was built for unsupported file format which is not the architecture being linked (x86_64) liballeg.dylib, file was built for i386 which is not the architecture being linked (x86_64) Undefined symbols: "_main", referenced from: start in crt1.10.6.o (maybe you meant: __mangled_main_address, _mangled_main() ) "_allegro_message", referenced from: _mangled_main() in cc8qamGn.o "__install_allegro_version_check", referenced from: _mangled_main() in cc8qamGn.o ld: symbol(s) not found collect2: ld returned 1 exit status This is the file I'm trying to compile: 1
2#include <allegro.h>
3
4int main()
5{
6 allegro_init();
7
8 allegro_message("Output!");
9
10 return 0;
11} END_OF_MAIN()
And this is the command-line arguments I'm using: g++ test00.cpp `allegro-config --libs` where `allegro-config --libs` expands to: -L~/usr/local/lib -framework Cocoa -lalleg-main -lalleg So I blew away the entire drive, reinstalled Mac OSX Snow Leopard from disk, installed (and updated) XCode and X11, and followed the suggestions on the following pages in various orders, but with the same results. I've also used MacPorts and hoped it would work for me with both of these variations: sudo port install allegro sudo port install allegro +univeral I've tried installing to the following directories as well (by redefining the CMAKE_INSTALL_PREFIX in cmake/ccmake): /usr/local /opt/local ~/usr/local ~/opt/local I'm at a loss, and getting annoyed that I can no longer compile Allegro projects anymore. Any suggestions? I'll give screen dumps if you want them.
|
Arthur Kalliokoski
Second in Command
February 2005
|
This is Allegro 5 you're trying to use? `allegro-config --libs` is for 4.4x and below, isn't it? My command line to compile 4.9+ looks more like They all watch too much MSNBC... they get ideas. |
LennyLen
Member #5,313
December 2004
|
Arthur Kalliokoski said: This is Allegro 5 you're trying to use? It's not, based on the test-code snippet he pasted. edit: if it was the cmake reference that made you think it might be A5, A4.4 uses cmake as well.
|
Arthur Kalliokoski
Second in Command
February 2005
|
The first link he posted said: "Anyway, yes, pre-4.9 Allegro is limited to 32 bit on OS X." They all watch too much MSNBC... they get ideas. |
Evert
Member #794
November 2000
|
The answer is here: OnlineCop said: liballeg-main.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Default compiler output changed for Snow Leopard, from 32 bit to 64 bit. Allegro 4, unfortunately, can only be compiled in 32 bit because it uses deprecated APIs that are only available in 32 bit. Or upgrade to Allegro 5, which doesn't have the issue (but does have an entirely new API). |
OnlineCop
Member #7,919
October 2006
|
Most of the projects I've got on my plate still run off of 4.4 and earler so I'm running into this issue. Evert said: Set the compiler to compile your project in 32 bit mode (-m32) and everything will be fine. Is it as simple as that? Update my various Makefiles (or reconfigure cmake to include this flag) for each project and try again to see if this resolves the issue? I tried compiling for this, and it didn't throw up any compiler errors. Kudos! It doesn't run, with a " dyld: Library not loaded: liballeg.4.4.dylib " error, but that may just be that I need to update my paths. Thanks, Evert!
|
Felix-The-Ghost
Member #9,729
April 2008
|
OnlineCop
Member #7,919
October 2006
|
I tried installing Allegro from the SVN checkout (changing the install path through ccmake from /usr/local to /opt/local). I had already added /opt/local to my various paths: set CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/local/include set C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/local/include set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib set MANPATH=$MANPATH:/opt/local/share/man set PATH=$PATH:/opt/local/bin:/opt/local/sbin I've had to use MacPorts in order to get the dependency files (like cmake, gettext, etc.) that Allegro needs to compile, and then when it finally compiled my program above correctly (with the -m32 switch), I would get an error when running it: dyld: Library not loaded: liballeg.4.4.dylib Referenced from: allegro_test Reason: image not found From this mail archive, I got some good pointers as to find out WHAT was going on: Quote: Using "otool -L", you can see the install names recorded in a binary. For example, here's "/usr/bin/true": $ otool -L /usr/bin/true Note the full paths to libgcc_s and libSystem. I ran this on the file, and this was my output: $ otool -L allegro_test allegro_test: /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0) liballeg.4.4.dylib (compatibility version 4.4.0, current version 4.4.2) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.29.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.32.0) Notice that "liballeg.4.4.dylib" did not have a path to it: "/opt/local/lib/liballeg.4.4.dylib" Because of this, it wouldn't run but it was compiling just fine. Copying and/or linking (using ln /opt/local/lib/liballeg.4.4.dylib liballeg.4.4.dylib) would resolve this and get the program to run, but since it did not have that "/opt/local/lib/" prefix tacked onto the front it, it was not resolving from "just any old path". To remedy this, I had tried setting DYLD_LIBRARY_PATH to /opt/local/lib as was recommended all over the internet, but that caused MORE problems when trying to run it (it threw up more error messages about OTHER things not being able to be located correctly now). ::bang head on wall:: So I started over, cleaned up all the files, and got rid of everything. I installed Allegro directly from MacPorts: sudo port install allegro and let it choose all the dependencies for me. Now when I compile, it all works fine. So while it's a version older than SVN, it works. So I guess I'm happy that Allegro now compiles! Now if I could only get the DuMB music library to compile...
|
Evert
Member #794
November 2000
|
OnlineCop said: To remedy this, I had tried setting DYLD_LIBRARY_PATH to /opt/local/lib as was recommended all over the internet, but that caused MORE problems when trying to run it Did you try LD_LIBRARY_PATH as well? Did you add that directory to the path or did you override what else may have been in there? I don't know what you did wrong, but Allegro 4 SVN should compile and install properly (I did it yesterday or the day before). |
OnlineCop
Member #7,919
October 2006
|
Evert said: Did you try LD_LIBRARY_PATH as well? Did you add that directory to the path or did you override what else may have been in there? Yes, see my post: OnlineCop said:
set CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/local/include set C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/local/include
This always worked fine from SVN on Leopard, but when I tried Snow Leopard, it kept blowing up on me.
|
Felix-The-Ghost
Member #9,729
April 2008
|
OnlineCop
Member #7,919
October 2006
|
Were you able to copy the file (or link to it) into the current directory and get it working then? I think that was the only problem with the SVN version: when compiled, the library was not referencing the full path; it was referencing the local directory only, which is why it couldn't be found.
|
Felix-The-Ghost
Member #9,729
April 2008
|
OnlineCop
Member #7,919
October 2006
|
I think you had appended to your CMAKE_INSTALL_PREFIX the '~' symbol, so instead of /usr/local it was ~/usr/local. So it's possible that the file was located there. Anyway, now that it's working, I'd say do it all 100% through Macports for now. And if that gets working, you can always go the alternate routes and try to install it from SVN or something...
|
Felix-The-Ghost
Member #9,729
April 2008
|
I'm not posting from the same Mac I tried to install on last year -- but I am interested in trying to install it again (This is Snow Leopard I'm on) Is there like a [complete, working] guide somewhere cause I don't remember anything I did, nor have I even read the perhaps complete steps in this thread. I just want to be able to compile and package programs on Mac after trying for a year. |
OnlineCop
Member #7,919
October 2006
|
That's essentially why I posted my findings. If others' mileage vary, hopefully they'll post here as well. I'd say to start with Macports. Unless you HAVE to have the most-recent SVN checkout, go with the kinda-updated version that Macports has to offer. By the way, who keeps Allegro updated on Macports? Does someone submit the newest version/sources somewhere to point them to the recent version? Is that why doing sudo port install allegro only installs Allegro 4 and not 5?
|
Evert
Member #794
November 2000
|
Felix-The-Ghost said: Is there like a [complete, working] guide somewhere cause I don't remember anything I did, nor have I even read the perhaps complete steps in this thread. Just did this:
Then for testing:
From .bashrc: export DYLD_LIBRARY_PATH=/opt/intel/Compiler/11.0/056/lib/:$CUDA_HOME/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib:/usr/local/lib:/opt/local/lib:$CUDA_HOME/lib export C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/include:/opt/local/include export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$HOME/include export LIBRARY_PATH=$LIBRARY_PATH:$HOME/lib:/opt/local/lib That's all. Remember to open a new shell if you change your .bashrc (or simply source .bashrc). EDIT OnlineCop said: who keeps Allegro updated on Macports? Whoever is interested in maintaining it. |
Felix-The-Ghost
Member #9,729
April 2008
|
Can I still do it without root access since I'm on a school's computer? I've gotten stupid[er] in regards to installing over a years time of not even having my old computer (now I got it back) I seem to remember having a higher version of Allegro than the norm but still lower than 4.9. Is the official release 4.2 or 4.4? I seem to remember having 4.4 and the "official" release 4.2 since like one guy was reportedly working on the 4.4 branch. Or something. Maybe Trent. |
Evert
Member #794
November 2000
|
Felix-The-Ghost said: Can I still do it without root access since I'm on a school's computer? Of course. The steps I posted above are all done as a normal user (that's why modified CMAKE_INSTALL_PREFIX and installed it locally). Quote: Is the official release 4.2 or 4.4? I seem to remember having 4.4 and the "official" release 4.2 since like one guy was reportedly working on the 4.4 branch. Not sure what you mean by "official release". Allegro 4.4 is the current stable release from the Allegro 4 branch. |
OnlineCop
Member #7,919
October 2006
|
He's right. You can download the 4.4 version from the SVN. In fact, using MacPorts will install version 4.4.1, so it no longer points to 4.2 anymore. Now, MacPorts will install, by default, to /opt/local, so if you wanted all of its dependencies and other files, you will need to compile the sources for Mac yourself. THEN you will be able to change the path to ~/opt/local or ~/usr/local, or any other directory you want to use. Besides that, though, please let us know how your success bodes, so we can know whether we should stick those instructions into the Allegro Wiki.
|
Felix-The-Ghost
Member #9,729
April 2008
|
We can pretty much just say I'm stupid and have no idea what MacPorts is. >Just downloaded the "allegro-4.4.1.1.zip" from SVN. Its been a year since I did any of this stuff. |
OnlineCop
Member #7,919
October 2006
|
You can run other optional packages, such as lua (be sure to use the "+universal" flag: port install lua +universal to make it 32-bit compatible). Packages like cmake and the other dependencies are auto-magically downloaded as a dependency for Allegro. No need to call 'cmake' or 'make' yourself: MacPorts does it all for you.
|
|