Pages: [1]
  Print  
Author Topic: Self-Compiling on OSX  (Read 34175 times)
LANS
Nub


Cakes 0
Posts: 5


« on: May 31, 2008, 07:43:54 PM »

I'm trying to self-compile open arena on OSX. So far I've tried compiling using both the makefile and make-macosx-ub.sh, but both give me untraceable errors. I've upgraded to GCC 4.3.0 and SVN 1.4.6 because doing so reduced the number of warnings throws, but now it still won't compile. It will provide me with assembly files (*.o and *.d), but when I throw LD at them it gives me errors.


I can run the precompiled version of OA, but I want to figure out how to self-compile it, as I'm looking into (with some friends) turning the Quake 3 engine into a variant of multiplayer 2D asteroids. We could code most of it ourselves from scratch, but nobody we've been able to find (let alone myself) can write good, lag-accounting netcode, which is why we're using Qauke3 as the base engine. (For those of you familiar with ambrosia software, the game is inspired by the EV series)


LD throws this:
Code:
/usr/bin/ld: Undefined symbols:
_main
_CL_ForwardCommandToServer
_CL_GameCommand
_UI_GameCommand
_CL_CDDialog
_CL_CDKeyValidate
_CL_CharEvent
_CL_ConsolePrint
_CL_Disconnect
_CL_FlushMemory
_CL_Frame
_CL_Init
_CL_InitKeyCommands
_CL_JoystickEvent
_CL_KeyEvent
_CL_MouseEvent
_CL_PacketEvent
_CL_Shutdown
_CL_StartHunkUsers
_Key_WriteBindings
_Sys_DetectAltivec
_Sys_Error
_Sys_GetEvent
_Sys_Init
_Sys_Milliseconds
_Sys_Print
_Sys_Quit
_Sys_RandomBytes
_Sys_ShowConsole
_S_ClearSoundBuffer
_Sys_BeginStreamedFile
_Sys_DefaultCDPath
_Sys_DefaultHomePath
_Sys_DefaultInstallPath
_Sys_EndStreamedFile
_Sys_FreeFileList
_Sys_ListFiles
_Sys_Mkdir
_Sys_StreamSeek
_Sys_StreamedRead
_Sys_Exit
_cl_shownet
_Sys_SendPacket
_Sys_StringToAdr
_Sys_CheckCD
_Sys_IsLANAddress
_Sys_SnapVector
_CL_MapLoading
_CL_ShutdownAll
_NET_Sleep
_Sys_LoadDll
_Sys_UnloadDll
_VM_CallCompiled
_VM_Compile
collect2: ld returned 1 exit status
I've tried using both the OA and ioquake3 makefiles, and get the same error.


Make throws this:
Code:
echo QVM tools not built when cross-compiling
QVM tools not built when cross-compiling
make  targets B=build/release-darwin-ppc CFLAGS="  -Wall -Wimplicit -Wstrict-prototypes -fno-strict-aliasing -DMACOS_X -fno-common -pipe -gfull -DUSE_OPENAL=1 -DUSE_CURL=1 -DUSE_CURL_DLOPEN=1 -DUSE_CODEC_VORBIS=1 -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 -Icode/SDL12/include -DUSE_LOCAL_HEADERS=1 -DSVN_VERSION=\\\"1.33+oa_SVN1347M\\\" -DNDEBUG  -faltivec -O3 -ffast-math -falign-loops=16 -MMD"
gcc -mdynamic-no-pic -DDEDICATED -Wall -Wimplicit -Wstrict-prototypes -fno-strict-aliasing -DMACOS_X -fno-common -pipe -gfull -DUSE_OPENAL=1 -DUSE_CURL=1 -DUSE_CURL_DLOPEN=1 -DUSE_CODEC_VORBIS=1 -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 -Icode/SDL12/include -DUSE_LOCAL_HEADERS=1 -DSVN_VERSION=\"1.33+oa_SVN1347M\" -DNDEBUG  -faltivec -O3 -ffast-math -falign-loops=16 -MMD -o build/release-darwin-ppc/ded/unix_main.o -c code/unix/unix_main.c
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSLayoutTypes.h:28,
                 from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATS.h:25,
                 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:26,
                 from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:24,
                 from code/unix/unix_main.c:75:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSTypes.h:252: error: expected identifier or '(' before '[' token
code/unix/unix_main.c:1361:2: warning: #warning Sys_BinName not implemented
make[1]: *** [build/release-darwin-ppc/ded/unix_main.o] Error 1
make: *** [build_release] Error 2


make-macosx-ub.sh throws this:
Code:
Building PPC Dedicated Server against "/Developer/SDKs/MacOSX10.3.9.sdk"
Building PPC Client against "/Developer/SDKs/MacOSX10.2.8.sdk"
Building X86 Client/Dedicated Server against "/Developer/SDKs/MacOSX10.4u.sdk"
Building Dedicated Server using /Developer/SDKs/MacOSX10.3.9.sdk
echo QVM tools not built when cross-compiling
QVM tools not built when cross-compiling
make  targets B=build/release-darwin-ppc CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.3.9.sdk                   -DMAC_OS_X_VERSION_MIN_REQUIRED=1030  -Wall -Wimplicit -Wstrict-prototypes -fno-strict-aliasing -DMACOS_X -fno-common -pipe -gfull -DUSE_OPENAL=1 -DUSE_CURL=1 -DUSE_CURL_DLOPEN=1 -DUSE_CODEC_VORBIS=1 -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 -Icode/SDL12/include -DUSE_LOCAL_HEADERS=1 -DSVN_VERSION=\\\"1.33+oa_SVN1347M\\\" -DNDEBUG  -faltivec -O3 -ffast-math -falign-loops=16 -MMD"
gcc -mdynamic-no-pic -DDEDICATED -arch ppc -isysroot /Developer/SDKs/MacOSX10.3.9.sdk                   -DMAC_OS_X_VERSION_MIN_REQUIRED=1030  -Wall -Wimplicit -Wstrict-prototypes -fno-strict-aliasing -DMACOS_X -fno-common -pipe -gfull -DUSE_OPENAL=1 -DUSE_CURL=1 -DUSE_CURL_DLOPEN=1 -DUSE_CODEC_VORBIS=1 -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 -Icode/SDL12/include -DUSE_LOCAL_HEADERS=1 -DSVN_VERSION=\"1.33+oa_SVN1347M\" -DNDEBUG  -faltivec -O3 -ffast-math -falign-loops=16 -MMD -o build/release-darwin-ppc/ded/sv_bot.o -c code/server/sv_bot.c
cc1: error: unrecognized command line option "-arch"
make[1]: *** [build/release-darwin-ppc/ded/sv_bot.o] Error 1
make: *** [build_release] Error 2


I'm running 10.4.11 on an iMac G4 700. I've also tried compiling it on an old PC running Ubuntu 8.0.4 (fully updated), and I've gotten the same errors.


Any suggestions?
Logged
jackoverfull
Member


Cakes 14
Posts: 385


Member


WWW
« Reply #1 on: June 01, 2008, 03:11:12 PM »

i built it on tiger and leopard, i can assure that it is possible.

you need, essentially:
-a clean system;
-a basic xcode installation;
-libogg;
-libvorbis (and libvorbisfile, that comes with the previous);
-the libogg and libvorbis headers (automatically installed with the libs)

you may need to edit make-macosx-ub.sh to remove references to the 10.3.9 and 10.2.8 sdks, but probably not.

i think that you should try on a clean system: gcc 4.3.0 isn't necessary, and i, personally, suggest to avoid the use of non apple-provided gccs on os x if you don't need them.
Logged
LANS
Nub


Cakes 0
Posts: 5


« Reply #2 on: June 07, 2008, 03:44:51 PM »

I've managed to get "make" to not throw errors. It produces 3 files:
ioquake3.ppc
ioq3ded.ppc
ioquake3-smp.ppc

How do I convert these into something I can run? They appear to be executable, and they do run, but I can't get the actual game to run so I can play it.

Any help please?
Logged
jackoverfull
Member


Cakes 14
Posts: 385


Member


WWW
« Reply #3 on: June 07, 2008, 04:05:19 PM »

ioquake3.ppc is the actual game, just put it in the same folder of baseoa, it should run.

ioq3ded.ppc is the dedicated server binary.

ioquake3-smp.ppc is the multi processor binary. i'm not sure that you should have it in recent versions of ioq3, if i remember right it was removed…

you will find all the info you need to make a .app bundle inside the make-macosx-ub.sh script.
Logged
LANS
Nub


Cakes 0
Posts: 5


« Reply #4 on: June 07, 2008, 09:13:10 PM »

I've finally traced the error back to ld (again).

Code:
LD build/release-darwin-ppc/ioquake3.ppc
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: can't locate file for: -lvorbisfile
collect2: ld returned 1 exit status

Any help?

Logged
sonicth
Nub


Cakes 0
Posts: 3


« Reply #5 on: June 08, 2008, 04:42:56 AM »

it cannot find file library 'vorbisfile.dylib' that came in vorbis.

One way is to compile without vorbis; we've discussed it here: http://openarena.ws/board/index.php?topic=1647.0


Otherwise you need to specify the directory where libvorbisfile.dylib lives with '-L/path/to/libdirectory' if you want to play vorbis files that other people made for the game.

On my system vorbis is installed with macports (http://www.macports.org), in /opt/local/lib (you can assure it's there by running 'port contents libvorbis | grep vorbisfile | grep dylib' in terminal), if you used Fink it will be in /sw/lib by default, if you've compiled it from source you should know where it is Wink

In Makefile, in '# SETUP AND BUILD -- MAC OS X' section:

 ifeq ($(USE_CODEC_VORBIS),1)
    BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
    CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
  endif

you need to change CLIENT_LDFLAGS line to this:

    CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg -L/opt/local/lib

if your vorbisfile.dylib is on that directory. I have not tested it, and there maybe a more elegant solution, but post a reply if it still does not compile!

Logged
LANS
Nub


Cakes 0
Posts: 5


« Reply #6 on: June 08, 2008, 10:40:01 AM »

make-macosx-ub.sh now gives this if I set the makefile to look in /usr/local/lib, which is where I originally installed ogg/vorbis

Code:
cp code/libs/macosx/libSDLmain.a build/release-darwin-ppc/libSDLmain.a
ranlib build/release-darwin-ppc/libSDLmain.a
LD build/release-darwin-ppc/ioquake3.ppc
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Developer/SDKs/MacOSX10.4u.sdk/opt/local/lib/libogg.0.dylib referenced from: /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libvorbisfile.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)

If I modify the makefile to use the macports version (/opt/local/lib), and run make-macosx-ub, I get this:

Code:
LD build/release-darwin-ppc/ioquake3.ppc
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: warning can't open dynamic library: /Developer/SDKs/MacOSX10.4u.sdk/opt/local/lib/libogg.0.dylib referenced from: /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libvorbisfile.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)

if I use "sudo make" it throws no errors.

If I use "sudo ./make-macosx-ub.sh" it throws this:

Code:
LD build/release-darwin-i386/ioquake3.i386
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /opt/local/lib/libvorbisfile.dylib cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /opt/local/lib/libvorbis.dylib cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /opt/local/lib/libogg.dylib cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_ov_clear
_ov_info
_ov_open_callbacks
_ov_pcm_total
_ov_read
_ov_seekable
_ov_streams
collect2: ld returned 1 exit status
make[2]: *** [build/release-darwin-i386/ioquake3.i386] Error 1
make[1]: *** [targets] Error 2
make: *** [release] Error 2

I'm almost there, any ideas guys?
Logged
jackoverfull
Member


Cakes 14
Posts: 385


Member


WWW
« Reply #7 on: June 08, 2008, 11:09:43 AM »

so, you're trying to do an universal build.

download this file: instructions (and precompiled libs, if you need them) are inside.

http://www.jackoverfull.com/giochi/openarena/modified_osx.zip
Logged
Pages: [1]
  Print  
 
Jump to: