Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Help in OSX

This thread is locked; no one can reply to it. rss feed Print
Help in OSX
MightyMouse
Member #9,658
April 2008
avatar

Hi,
I 've never tried Allegro so far, and I thought it would be nice to give it a try. I have Leopard:

$ uname -v
Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386
$

and I followed the instructions on macosx.txt file (or at least I think I did) :)
Now, when I tried to compile my hello-world program it says that I have not compiled for the right architecture (I have tried both macosx and macosx-universal) plus some other stuff:

$ gcc first.c -o first `allegro-config --libs`
ld: warning in /usr/local/lib/liballeg-4.2.2.dylib, file is not of required architecture
ld: warning in /usr/local/lib/liballeg-main.a, file is not of required architecture
Undefined symbols:
  "__install_allegro_version_check", referenced from:
      __mangled_main in cciA86Ez.o
  "_main", referenced from:
      start in crt1.10.5.o
  "_allegro_message", referenced from:
      __mangled_main in cciA86Ez.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
$

What did I do wrong? ???

Matthew Leverton
Supreme Loser
January 1999
avatar

Are you sure those are the libraries you just built? What version of gcc?

MightyMouse
Member #9,658
April 2008
avatar

I guess the libraries are fresh:

$ pwd
/usr/local/lib
$ ls -l liballeg*
-rwxr-xr-x  1 root  wheel  1109136 Apr  4 22:03 liballeg-4.2.2.dylib*
lrwxr-xr-x  1 root  wheel       20 Apr  4 22:03 liballeg-4.2.dylib@ -> liballeg-4.2.2.dylib
lrwxr-xr-x  1 root  wheel       20 Apr  4 22:03 liballeg-4.dylib@ -> liballeg-4.2.2.dylib
-rw-r--r--  1 root  wheel    12272 Apr  4 22:03 liballeg-main.a
lrwxr-xr-x  1 root  wheel       20 Apr  4 22:03 liballeg.dylib@ -> liballeg-4.2.2.dylib
$

Regarding gcc:

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr 
--mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ 
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple 
--with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)
$

Peter Hull
Member #1,136
March 2001

This seems to be a bit of a problem in general - try searching for "file is not of required architecture" in google.
Example: http://lists.apple.com/archives/xcode-users/2008/Feb/msg00137.html
http://www.cocoabuilder.com/archive/message/xcode/2007/11/10/17070

I can't quite see how their explanation relates to your problem, unless you have got another version of Allegro somewhere on your system - maybe from macports or something?

I have come across "Undefined symbols: __install_allegro_version_check" before and it was because (IIRC) I was including older headers and linking to newer libs.

Can you have a thorough check for other versions of Allegro?

Pete

MightyMouse
Member #9,658
April 2008
avatar

#SelectExpand
1# whoami 2root 3# pwd 4/ 5# find . -name '*alleg*' 6./Library/Documentation/Help/Allegro.bundle/alleg000.html 7./Library/Documentation/Help/Allegro.bundle/alleg001.html 8./Library/Documentation/Help/Allegro.bundle/alleg002.html 9./Library/Documentation/Help/Allegro.bundle/alleg003.html 10./Library/Documentation/Help/Allegro.bundle/alleg004.html 11./Library/Documentation/Help/Allegro.bundle/alleg005.html 12./Library/Documentation/Help/Allegro.bundle/alleg006.html 13./Library/Documentation/Help/Allegro.bundle/alleg007.html 14./Library/Documentation/Help/Allegro.bundle/alleg008.html 15./Library/Documentation/Help/Allegro.bundle/alleg009.html 16./Library/Documentation/Help/Allegro.bundle/alleg010.html 17./Library/Documentation/Help/Allegro.bundle/alleg011.html 18./Library/Documentation/Help/Allegro.bundle/alleg012.html 19./Library/Documentation/Help/Allegro.bundle/alleg013.html 20./Library/Documentation/Help/Allegro.bundle/alleg014.html 21./Library/Documentation/Help/Allegro.bundle/alleg015.html 22./Library/Documentation/Help/Allegro.bundle/alleg016.html 23./Library/Documentation/Help/Allegro.bundle/alleg017.html 24./Library/Documentation/Help/Allegro.bundle/alleg018.html 25./Library/Documentation/Help/Allegro.bundle/alleg019.html 26./Library/Documentation/Help/Allegro.bundle/alleg020.html 27./Library/Documentation/Help/Allegro.bundle/alleg021.html 28./Library/Documentation/Help/Allegro.bundle/alleg022.html 29./Library/Documentation/Help/Allegro.bundle/alleg023.html 30./Library/Documentation/Help/Allegro.bundle/alleg024.html 31./Library/Documentation/Help/Allegro.bundle/alleg025.html 32./Library/Documentation/Help/Allegro.bundle/alleg026.html 33./Library/Documentation/Help/Allegro.bundle/alleg027.html 34./Library/Documentation/Help/Allegro.bundle/alleg028.html 35./Library/Documentation/Help/Allegro.bundle/alleg029.html 36./Library/Documentation/Help/Allegro.bundle/alleg030.html 37./Library/Documentation/Help/Allegro.bundle/alleg031.html 38./Library/Documentation/Help/Allegro.bundle/alleg032.html 39./Library/Documentation/Help/Allegro.bundle/alleg033.html 40./Library/Documentation/Help/Allegro.bundle/alleg034.html 41./Library/Documentation/Help/Allegro.bundle/alleg035.html 42./Library/Documentation/Help/Allegro.bundle/alleg036.html 43./Library/Documentation/Help/Allegro.bundle/alleg037.html 44./Library/Documentation/Help/Allegro.bundle/alleg038.html 45./Library/Documentation/Help/Allegro.bundle/alleg039.html 46./Library/Documentation/Help/Allegro.bundle/alleg040.html 47./Library/Documentation/Help/Allegro.bundle/alleg041.html 48./Library/Documentation/Help/Allegro.bundle/alleg042.html 49./Library/Documentation/Help/Allegro.bundle/alleg043.html 50./Library/Documentation/Help/Allegro.bundle/alleg044.html 51./Library/Documentation/Help/Allegro.bundle/alleg045.html 52./Library/Documentation/Help/Allegro.bundle/alleg046.html 53./Library/Documentation/Help/Allegro.bundle/alleg047.html 54./Library/Documentation/Help/Allegro.bundle/alleg048.html 55./Library/Documentation/Help/Allegro.bundle/alleg049.html 56./Library/Documentation/Help/Allegro.bundle/allegro.html 57./Library/Frameworks/Allegro.framework/Versions/4.2.2/Headers/allegro.h 58./Library/Frameworks/Allegro.framework/Versions/4.2.2/Headers/osxalleg.h 59./System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/lib/zi/America/Argentina/Rio_Gallegos 60./System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/zi/America/Argentina/Rio_Gallegos 61./Users/dimis/allegro-4.2.2 62./Users/dimis/allegro-4.2.2/allegro.cfg 63./Users/dimis/allegro-4.2.2/allegro.mft 64./Users/dimis/allegro-4.2.2/docs/html/alleg000.html 65./Users/dimis/allegro-4.2.2/docs/html/alleg001.html 66./Users/dimis/allegro-4.2.2/docs/html/alleg002.html 67./Users/dimis/allegro-4.2.2/docs/html/alleg003.html 68./Users/dimis/allegro-4.2.2/docs/html/alleg004.html 69./Users/dimis/allegro-4.2.2/docs/html/alleg005.html 70./Users/dimis/allegro-4.2.2/docs/html/alleg006.html 71./Users/dimis/allegro-4.2.2/docs/html/alleg007.html 72./Users/dimis/allegro-4.2.2/docs/html/alleg008.html 73./Users/dimis/allegro-4.2.2/docs/html/alleg009.html 74./Users/dimis/allegro-4.2.2/docs/html/alleg010.html 75./Users/dimis/allegro-4.2.2/docs/html/alleg011.html 76./Users/dimis/allegro-4.2.2/docs/html/alleg012.html 77./Users/dimis/allegro-4.2.2/docs/html/alleg013.html 78./Users/dimis/allegro-4.2.2/docs/html/alleg014.html 79./Users/dimis/allegro-4.2.2/docs/html/alleg015.html 80./Users/dimis/allegro-4.2.2/docs/html/alleg016.html 81./Users/dimis/allegro-4.2.2/docs/html/alleg017.html 82./Users/dimis/allegro-4.2.2/docs/html/alleg018.html 83./Users/dimis/allegro-4.2.2/docs/html/alleg019.html 84./Users/dimis/allegro-4.2.2/docs/html/alleg020.html 85./Users/dimis/allegro-4.2.2/docs/html/alleg021.html 86./Users/dimis/allegro-4.2.2/docs/html/alleg022.html 87./Users/dimis/allegro-4.2.2/docs/html/alleg023.html 88./Users/dimis/allegro-4.2.2/docs/html/alleg024.html 89./Users/dimis/allegro-4.2.2/docs/html/alleg025.html 90./Users/dimis/allegro-4.2.2/docs/html/alleg026.html 91./Users/dimis/allegro-4.2.2/docs/html/alleg027.html 92./Users/dimis/allegro-4.2.2/docs/html/alleg028.html 93./Users/dimis/allegro-4.2.2/docs/html/alleg029.html 94./Users/dimis/allegro-4.2.2/docs/html/alleg030.html 95./Users/dimis/allegro-4.2.2/docs/html/alleg031.html 96./Users/dimis/allegro-4.2.2/docs/html/alleg032.html 97./Users/dimis/allegro-4.2.2/docs/html/alleg033.html 98./Users/dimis/allegro-4.2.2/docs/html/alleg034.html 99./Users/dimis/allegro-4.2.2/docs/html/alleg035.html 100./Users/dimis/allegro-4.2.2/docs/html/alleg036.html 101./Users/dimis/allegro-4.2.2/docs/html/alleg037.html 102./Users/dimis/allegro-4.2.2/docs/html/alleg038.html 103./Users/dimis/allegro-4.2.2/docs/html/alleg039.html 104./Users/dimis/allegro-4.2.2/docs/html/alleg040.html 105./Users/dimis/allegro-4.2.2/docs/html/alleg041.html 106./Users/dimis/allegro-4.2.2/docs/html/alleg042.html 107./Users/dimis/allegro-4.2.2/docs/html/alleg043.html 108./Users/dimis/allegro-4.2.2/docs/html/alleg044.html 109./Users/dimis/allegro-4.2.2/docs/html/alleg045.html 110./Users/dimis/allegro-4.2.2/docs/html/alleg046.html 111./Users/dimis/allegro-4.2.2/docs/html/alleg047.html 112./Users/dimis/allegro-4.2.2/docs/html/alleg048.html 113./Users/dimis/allegro-4.2.2/docs/html/alleg049.html 114./Users/dimis/allegro-4.2.2/docs/html/allegro.css 115./Users/dimis/allegro-4.2.2/docs/html/allegro.html 116./Users/dimis/allegro-4.2.2/docs/man/allegro_404_char.3 117./Users/dimis/allegro-4.2.2/docs/man/allegro_error.3 118./Users/dimis/allegro-4.2.2/docs/man/allegro_exit.3 119./Users/dimis/allegro-4.2.2/docs/man/allegro_icon.3 120./Users/dimis/allegro-4.2.2/docs/man/allegro_id.3 121./Users/dimis/allegro-4.2.2/docs/man/allegro_init.3 122./Users/dimis/allegro-4.2.2/docs/man/allegro_message.3 123./Users/dimis/allegro-4.2.2/docs/man/find_allegro_resource.3 124./Users/dimis/allegro-4.2.2/docs/man/install_allegro.3 125./Users/dimis/allegro-4.2.2/docs/man/set_allegro_resource_path.3 126./Users/dimis/allegro-4.2.2/docs/rtf/allegro.rtf 127./Users/dimis/allegro-4.2.2/docs/scite/allegro.api 128./Users/dimis/allegro-4.2.2/docs/src/allegro._tx 129./Users/dimis/allegro-4.2.2/docs/txt/allegro.txt 130./Users/dimis/allegro-4.2.2/examples/allegro.pcx 131./Users/dimis/allegro-4.2.2/include/allegro 132./Users/dimis/allegro-4.2.2/include/allegro.h 133./Users/dimis/allegro-4.2.2/include/bealleg.h 134./Users/dimis/allegro-4.2.2/include/linalleg.h 135./Users/dimis/allegro-4.2.2/include/macalleg.h 136./Users/dimis/allegro-4.2.2/include/osxalleg.h 137./Users/dimis/allegro-4.2.2/include/qnxalleg.h 138./Users/dimis/allegro-4.2.2/include/winalleg.h 139./Users/dimis/allegro-4.2.2/include/xalleg.h 140./Users/dimis/allegro-4.2.2/lib/bcc32/allegro.def 141./Users/dimis/allegro-4.2.2/lib/dmc/allegro.def 142./Users/dimis/allegro-4.2.2/lib/macosx/liballeg-4.2.2.dylib 143./Users/dimis/allegro-4.2.2/lib/macosx/liballeg-main.a 144./Users/dimis/allegro-4.2.2/lib/mingw32/allegro.def 145./Users/dimis/allegro-4.2.2/lib/msvc/allegro.def 146./Users/dimis/allegro-4.2.2/misc/allegro-config-qnx.sh 147./Users/dimis/allegro-4.2.2/misc/allegro-config.in 148./Users/dimis/allegro-4.2.2/misc/allegro.m4 149./Users/dimis/allegro-4.2.2/misc/allegro.spec 150./Users/dimis/allegro-4.2.2/obj/bcc32/alleg 151./Users/dimis/allegro-4.2.2/obj/beos/alleg 152./Users/dimis/allegro-4.2.2/obj/djgpp/alleg 153./Users/dimis/allegro-4.2.2/obj/dmc/alleg 154./Users/dimis/allegro-4.2.2/obj/dmc/alleg_s 155./Users/dimis/allegro-4.2.2/obj/macosx/alleg 156./Users/dimis/allegro-4.2.2/obj/macosx/alleg/allegro.o 157./Users/dimis/allegro-4.2.2/obj/macosx/allp/allegro.o 158./Users/dimis/allegro-4.2.2/obj/mingw32/alleg 159./Users/dimis/allegro-4.2.2/obj/mingw32/alleg_s 160./Users/dimis/allegro-4.2.2/obj/msvc/alleg 161./Users/dimis/allegro-4.2.2/obj/msvc/alleg_crt 162./Users/dimis/allegro-4.2.2/obj/msvc/alleg_s 163./Users/dimis/allegro-4.2.2/obj/msvc/alleg_s_crt 164./Users/dimis/allegro-4.2.2/obj/qnx/alleg 165./Users/dimis/allegro-4.2.2/obj/unix/alleg 166./Users/dimis/allegro-4.2.2/obj/unix/shared/alleg 167./Users/dimis/allegro-4.2.2/obj/watcom/alleg 168./Users/dimis/allegro-4.2.2/src/allegro.c 169./Users/dimis/allegro-4.2.2/src/mac/allegro.r 170./Users/dimis/allegro_hello.c 171./Volumes/WINDOWSXP/WINDOWS/Fonts/smalleg.fon 172find: ./Volumes/WINDOWSXP/.Trashes/501/\004␀␀␀õ\001␀␀.\024␀␀: File name too long 173./opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/allegro 174./usr/local/bin/allegro-config 175./usr/local/include/allegro 176./usr/local/include/allegro.h 177./usr/local/include/osxalleg.h 178./usr/local/lib/liballeg-4.2.2.dylib 179./usr/local/lib/liballeg-4.2.dylib 180./usr/local/lib/liballeg-4.dylib 181./usr/local/lib/liballeg-main.a 182./usr/local/lib/liballeg.dylib 183./usr/local/man/man3/allegro_404_char.3 184./usr/local/man/man3/allegro_error.3 185./usr/local/man/man3/allegro_exit.3 186./usr/local/man/man3/allegro_icon.3 187./usr/local/man/man3/allegro_id.3 188./usr/local/man/man3/allegro_init.3 189./usr/local/man/man3/allegro_message.3 190./usr/local/man/man3/find_allegro_resource.3 191./usr/local/man/man3/install_allegro.3 192./usr/local/man/man3/set_allegro_resource_path.3 193./usr/local/texlive/2007/texmf-dist/tex/latex/bookhands/allegoth.sty 194./usr/share/swig/1.3.31/allegrocl 195./usr/share/swig/1.3.31/allegrocl/allegrocl.swg 196./usr/share/zoneinfo/America/Argentina/Rio_Gallegos 197#

Now near the end appears something like an entry for allegro through macports. However allegro does NOT seem to be installed through macports:

#SelectExpand
1# whoami 2root 3# port installed 4The following ports are currently installed: 5 MPlayer @1.0rc2_1+macosx (active) 6 Xft2 @2.1.12_0 (active) 7 aquaterm @1.0.1_0 (active) 8 atk @1.20.0_1 (active) 9 cairo @1.4.12_0 (active) 10 crafty @20.14_0 (active) 11 dia @0.96.1_0 (active) 12 docbook-xml @4.5_1 (active) 13 docbook-xml-4.1.2 @4.1.2_1 (active) 14 docbook-xml-4.2 @4.2_0 (active) 15 docbook-xml-4.3 @4.3_0 (active) 16 docbook-xml-4.4 @4.4_0 (active) 17 docbook-xml-4.5 @4.5_0 (active) 18 docbook-xsl @1.72.0_0 (active) 19 dos2unix @3.1_0 (active) 20 expat @2.0.1_0 (active) 21 ffmpeg @0.4.9-pre1_2+darwin_9 (active) 22 flip @20050821_0 (active) 23 fontconfig @2.5.0_0+macosx (active) 24 freetype @2.3.5_1 (active) 25 fugu @1.2.0_0 (active) 26 gawk @3.1.5_2 (active) 27 gd2 @2.0.35_0 (active) 28 gettext @0.17_2 (active) 29 gftp @2.0.18_2 (active) 30 ghostscript @8.61_0 (active) 31 glib2 @2.14.4_1+darwin_9 (active) 32 gnuplot @4.2.0_0 (active) 33 gsed @4.1.5_2 (active) 34 gtk-doc @1.9_0 (active) 35 gtk2 @2.12.2_0+x11 (active) 36 jpeg @6b_2 (active) 37 lame @3.97_0 (active) 38 libart_lgpl @2.3.19_2 (active) 39 libiconv @1.12_0 (active) 40 libmad @0.15.1b_1 (active) 41 libogg @1.1.3_2 (active) 42 libpng @1.2.24_0 (active) 43 libungif @4.1.4_2 (active) 44 libvorbis @1.2.0_0 (active) 45 libxml2 @2.6.30_0 (active) 46 libxslt @1.1.22_0 (active) 47 lzo2 @2.02_2+darwin_9 (active) 48 ncurses @5.6_0 (active) 49 ncursesw @5.6_0+darwin_9 (active) 50 openssl @0.9.8g_0 (active) 51 p5-xml-parser @2.36_0 (active) 52 pango @1.18.3_0 (active) 53 pdflib @7.0.2_0 (active) 54 perl5.8 @5.8.8_0 (active) 55 pkgconfig @0.22_0 (active) 56 popt @1.12_0 (active) 57 readline @5.2.007_0+darwin_9 (active) 58 render @0.9_1 (active) 59 scrollkeeper @0.3.14_6 (active) 60 teTeX @3.0_4 (active) 61 texi2html @1.76_3 (active) 62 texinfo @4.11_0 (active) 63 tiff @3.8.2_1+macosx (active) 64 unix2dos @2.2_0 (active) 65 unrar @3.7.8_0 (active) 66 wget @1.10.2_0 (active) 67 xmlcatmgr @2.2_1 (active) 68 xorg-util-macros @1.1.5_0 (active) 69 xorg-xproto @7.0.11_1 (active) 70 xrender @0.9.0_2 (active) 71 zlib @1.2.3_1 (active) 72# port location allegro 73Error: port location failed: Registry error: allegro not registered as installed. 74# port uninstall allegro 75Error: port uninstall failed: Registry error: allegro not registered as installed. 76#

???

EDIT: Now this is strange. I found http://www.allegro.cc/forums/thread/594400 which indicates a slight modification in order to compile stuff (with macports though...). Again I had no luck with the usual terminal. However, when I opened xterm and compiled with:
$ gcc -I/usr/local/include `allegro-config --libs` allegro_hello.c
The program actually compiled! :D
Now I have three final questions:
1) When I run the a.out the welcome message also appeared on my terminal. Is this ok? I guess so ...
2) Can you guess what could be the problem and I can not compile the same program with the same command on apple's terminal?
3) Finally, when I tried to compile the same file (under xterm again) with the simple

$ gcc allegro_hello.c -lalleg
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
$

I still have something undefined. :( Is there a way I can fix that?

Thank you all for your help!

Peter Hull
Member #1,136
March 2001

Quote:

I still have something undefined. Is there a way I can fix that?

Yes, it's main(). That is actually in liballeg-main.a because it can't go into a dylib. For technical reasons we have to execute 'our' main first before we enter the user's main (which gets renamed to _mangled_main) Have a look at what allegro-config --libs produces.
Pete

MightyMouse
Member #9,658
April 2008
avatar

Thanks

Go to: