Page 1 of 1
Trying to build LoW on OSX
Posted: Mon Apr 07, 2003 6:07 pm
by Clock Nova
I am attempting to build the Underworld 2 remake in OSX, but am having a problem. Bear in mind that I know almost nothing of UNIX, and am largely groping in the dark (but I WANT to learn)...
I have installed all of the necessary libraries (SDL, SDL_Mixer, etc.) and have up-to -date versions of the Apple developers tools, as well as X11. I have successfuly executed the "autoconf" and "./configure" commands, but when I type "make" I get this response:
g++ -O3 -ffast-math -DRELEASE -frtti -fsingle-precision-constant -fexceptions -Wp,-MMD,"./.deps/game.d",-MQ,"game.o",-MP -c game.cc -o game.o
In file included from game.cc:12:
setup.H:57:21: warning: GL/gl.h: No such file or directory
setup.H:58:22: warning: GL/glu.h: No such file or directory
game.cc: In function `bool Game::startup_video(bool)':
game.cc:133: `GL_VENDOR' undeclared (first use this function)
game.cc:133: (Each undeclared identifier is reported only once for each
function it appears in.)
game.cc:133: `glGetString' undeclared (first use this function)
game.cc:133: `GL_VERSION' undeclared (first use this function)
game.cc:134: `GL_RENDERER' undeclared (first use this function)
make: *** [game.o] Error 1
Can anyone (Max?) tell me what is going wrong? The author told me that LoW should be compilable on OSX, but hasn't enough experience to help me much. Can this be fixed, or am I wasting my time?
Re: Trying to build LoW on OSX
Posted: Mon Apr 07, 2003 10:43 pm
by sjs191
It can't find the OpenGL headers. If you're using Project Builder you need to add the OpenGL framework to the project (look in the Project menu for "Add Frameworks...").. I think it'll work after you've added those... The OpenGL framework hides in /System/Library/Frameworks on my Mac.
Re: Trying to build LoW on OSX
Posted: Mon Apr 07, 2003 10:54 pm
by sjs191
Err.. scratch that.. looks like you aren't using PB.. You'll need to find a way to get something like
/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
into your include path.. this is probably *not* the proper way to do it, but you might be able to get away with running a command something like the following:
sudo ln -s /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers /usr/include/GL
This will create a symbolic link in /usr/include called GL, which links to the OpenGL headers in the Framework, make should work after that.
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 4:28 am
by Clock Nova
Okay, that seemed to work, to a point. The OpenGL errors have been eliminated, but now when I "make" I get this text at the end of the output:
png.H:16:17: warning: png.h: No such file or directory
In file included from textures.cc:16:
png.H:36: `png_structp' was not declared in this scope
png.H:36: parse error before `,' token
png.H:69: 'png_structp' is used as a type, but is not defined as a type.
png.H:70: 'png_infop' is used as a type, but is not defined as a type.
png.H:71: 'png_infop' is used as a type, but is not defined as a type.
png.H:74: `png_structp' was not declared in this scope
png.H:74: `png_const_charp' was not declared in this scope
png.H:74: parse error before `)' token
png.H: In static member function `static void PNG_Context::_error_(...)':
png.H:74: `msg' undeclared (first use this function)
png.H:74: (Each undeclared identifier is reported only once for each function
it appears in.)
textures.cc: In function `bool Textures::initialize()':
textures.cc:171: warning: invalid conversion from `unsigned int*' to `GLuint*'
make: *** [textures.o] Error 1
What do you suppose this means?
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 5:25 am
by Darke
It probably means you haven't installed the png development libs, or it can't find them.
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 8:22 am
by Clock Nova
Actually, I know I have them. Here's where I may be going wrong, and it is probably going to seem very simple to most of you: when I compiled my first program, XU4 (U4 Recreated) I installed the SDL and Mixer libraries, and they all went into /usr/lib. After that, I was able to successfully compile and run it, and there was much rejoicing (hooray!)
Later, when wanted to install LoW, I realized that I was going to need more software. I ran accross Fink, and used that to install all of the necessary programs, and even reinstalled SDL and such. And it made things much easier. But now, all of it is in /sw, not /usr. So I have multiple copies of some libraries and apps, and some which are only in /sw. And I don't know where things are looking for their resources. How can I be sure that only the /sw directory, which was created by Fink, is being accessed when I try to compile and run apps? And what is the best way to remove duplicate libraries from the /usr directory?
Should be simple, I just don't know enough to do it. I'd love to get my hands on a good book that would introduce me to this information. Any suggestions?
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 5:05 pm
by sjs191
Well, I decided to give compiling low a shot, just to see how far I could get. I finally managed to pull it off.. with lots of problems.. It's a total nightmare as usual.. dunno why Apple couldn't make it work like other unicies (unixes?) so we wouldn't have all these problems..
No idea if this works BTW, I don't have the UW files on this system, so I haven't tried to run it... but here's how I got it to compile:
1) Make sure you've got all the necessary stuff installed via FINK (SDL, SDL_mixer, libpng, smpeg etc.) I had to fiddle with this several times before it worked. Make sure /sw/include/png.h is there, and also /sw/include/SDL/SDL_mixer.h... Also need to get autoconf via fink.
**Make sure you quit and then open a new terminal after making changes with dselect... otherwise they might not be detected**
I made the symbolic link for the GL includes in /sw/include rather than in /usr/include as my message about this above did... not sure if that makes a difference.
2) Get low source low-src-0_4.tgz
3) tar xfz low-src-0_4.tgz
4) cd low
5) autoconf
6) setenv CPPFLAGS -I/sw/include
7) setenv LDFLAGS -L/sw/lib
(Note: no idea if these last two help any)
8) ./configure
(Note: I suspect this isn't detecting SDL, SDL_Mixer and SMPEG properly for who knows what reason.)
9) Edit the file called Makefile and make the following changes:
There's a line that starts with COMPILE=g++ near the top.. add
-I/sw/include -DHAVE_LIBSDL_MIXER=1 -DHAVE_LIBSMPEG=1
to the end of that line.
Directly below that is a line LINK=g++... add the following to the end of it:
-L/sw/lib -framework OpenGL -lSDL -lSDL_mixer -lpng -lobjc
(if -L/sw/lib is already there you don't need to add it again, just add the other stuff)
10) make
I still get some warnings (one from ld to do with libz, not sure how serious it is..) but I get an executable out of it.
If you ever do find a book that explains any of this crap please post the title here so we can all benefit from it.
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 6:28 pm
by Clock Nova
I made all the changes you suggested, and followed your instructions, but this is as far as I get:
g++ -O3 -ffast-math -DRELEASE -frtti -fsingle-precision-constant -Wp,-MMD,"./.deps/sound.d",-MQ,"sound.o",-MP -c sound.cc -o sound.o
sound.cc:388: warning: ISO C++ forbids declaration of `Sound' with no type
sound.cc:391: syntax error before `::' token
sound.cc:403: syntax error before `*' token
sound.cc:416: parse error before `}' token
make: *** [sound.o] Error 1
Actually, I was getting that far before I made any of the changes you suggested, so I don't know if they did any good. But, as far as I can tell, everything that is required is installed and up-to-date. I even updated all of my libraries, including SDL and Mixer, with "dselect" before trying it.
Everything looks to be in the right place. Any idea what's wrong?
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 6:42 pm
by sjs191
This is the problem I had which makes me think configure can't find the SDL, SDL_mixer etc. libraries. Can you send post the COMPILE and LINK lines from your Makefile? It doesn't look like the extra bits I mentioned in step 9 are going in for some reason.
Specifically, it's failing because the "-DHAVE_LIBSDL_MIXER=1" part isn't in there.. although it looks like the "-I/sw/include" and "-DHAVE_LIBSMPEG=1" bits aren't in there either.
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 6:53 pm
by Clock Nova
Whoa! Nevermind. On closer inspection, it turns out that there was an extra hard return in the middle of one of those lines which was fouling things up. I fixed it, and it "made."
Now I have to make sure I get all of the extra datafiles in the right places. Of course, it may still not work. I'll let you know what happens. Thanks!
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 7:07 pm
by sjs191
I'm certain we'd both prefer it if LoW worked under the Mac, but you might be interested to know that DosBox
http://dosbox.sourceforge.net
Compiled with *ZERO* difficulty for me and is supposedly capable of running Ultima Underworlds I and II (haven't tried them under it yet, but I have tried Ultima 6 and it works fine!) Hopefully they'll add in 2xSAI soon (it only has point and the MAME scalers at the moment IIRC.)
Re: Trying to build LoW on OSX
Posted: Tue Apr 08, 2003 7:08 pm
by Clock Nova
Well, here's what's happening: I know that the UW2 datafiles are in the right place, but I'm not %100 sure the gdata and model files are where they need to be. At any rate, here is a sample of what happens when I type "./low"
setup: Loading settings from low.ini
kCGErrorInvalidConnection : CGSNewWindow: Invalid connection
2003-04-09 00:03:11.567 low[20750] _NXCreateWindow: error creating window (1002)
kCGErrorInvalidConnection : CGSSetWindowProperty: Invalid connection
kCGErrorInvalidConnection : CGSInvalidateWindowShadow: Invalid connection
kCGErrorInvalidConnection : CGSSetWindowListAlpha: Invalid connection
kCGErrorIllegalArgument : CGSLockWindowRectBits: Invalid window
kCGErrorFailure : Failed to create window context device.
kCGErrorFailure : CGWindowContextCreate: failed to create context.
2003-04-09 00:03:11.599 low[20750] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0, window:-1
kCGErrorFailure : CGContextResetClip: invalid context
kCGErrorFailure : CGContextReplaceTopGState: invalid context
kCGErrorInvalidConnection : CGSGetWindowProperty: Invalid connection
kCGErrorInvalidConnection : CGSSetHideOnDeact: error getting current hide-on-deactivate state
kCGErrorInvalidConnection : CGSSetWindowProperty: Invalid connection
kCGErrorInvalidConnection : CGSSetEventMask: error setting client event mask window property
kCGErrorInvalidConnection : CGSSetWindowEventMask: Invalid connection
kCGErrorInvalidConnection : CGSSetEventMask: error setting window event mask
kCGErrorInvalidConnection : CGSSetWindowToReleaseBackingOnOrderOut: Invalid connection
2003-04-09 00:03:11.670 low[20750] *** _NSAutoreleaseNoPool(): Object 0x2099f20 of class NSCFArray autoreleased with no pool in place - just leaking
2003-04-09 00:03:11.671 low[20750] *** _NSAutoreleaseNoPool(): Object 0x2099f40 of class NSCFArray autoreleased with no pool in place - just leaking...
...this goes on for a while, then it ends with:video: initialised 1024x768 windowed video mode
video: ATI Technologies Inc. OpenGL version 1.3 ATI-1.2.12
video: rendering with ATI Radeon 7500 OpenGL Engine
*** malloc_zone_malloc[20763]: argument too large: -49148
Abort
The screen actually dims for a split second, then nothing. Any thoughts?