The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: daveesq on February 19, 2008, 09:08:08 pm



Title: Building an OS X Bundled App
Post by: daveesq on February 19, 2008, 09:08:08 pm
Hello all.

I was just wondering whether anyone could tell me how to build UQM as an OS X bundled application (.app).  I've looked through the svn repository, but I didn't see any building instructions, much less platform-specific ones.  Essentially, I just want to know what the process is for building the OS X release.

Thanks (especially for everyone's hard work in making UQM as great as it is),
David


Title: Re: Building an OS X Bundled App
Post by: 0xDEC0DE on February 19, 2008, 09:53:27 pm
The build scripts support OSX directly.  So from the trunk directory:

Code:
./build.sh uqm install

There is no Step 2.

Also see here (http://www.submedia.net/uqm/).


Title: Re: Building an OS X Bundled App
Post by: daveesq on February 19, 2008, 10:01:37 pm
Well I'll be dipped!   :-[

Thanks!!!


Title: Re: Building an OS X Bundled App
Post by: Michael Martin on February 24, 2008, 06:59:12 am
I've just committed a draft of the steps I had to go through to make it build on my own Mac system, so hopefully this won't be as much of a problem in the future.

Nic, as the resident expert, feel free to correct any errors I've made  8)


Title: Re: Building an OS X Bundled App
Post by: C. Bob on April 24, 2008, 10:00:40 am
I want to try rebuilding UQM, so I can test out ship performance changes; since there's no moddability yet, it's necessary.

At any rate, build.sh is completely resistant to use! It claims "permission denied" whenever I try to do anything with it.

An average log (altered for personal details):
Ascent:~ anonymous$ /uqm-0.6.2/sc2/build/unix/build.sh uqm install
-bash: /uqm-0.6.2/sc2/build/unix/build.sh: Permission denied
Ascent:~ anonymous$ su
Password:
Ascent:/Users/anonymous root# /uqm-0.6.2/sc2/build/unix/build.sh uqm install
su: /uqm-0.6.2/sc2/build/unix/build.sh: Permission denied

I've placed uqm-0.6.0-content.uqm and uqm-0.6.2 in the hard drive's root directory.  Is that correct?

Please let me know what I'm doing wrong; I'm a complete amateur to Unix-based things (and hope to largely stay that way; it's not my kinda world), but learning enough to compile UQM would be great. I like tweaking the idea of changing ship stats and the like, and it'd be cool. Some future UQM version might make it easier, but well.

- Bob


Title: Re: Building an OS X Bundled App
Post by: meep-eep on April 24, 2008, 06:25:29 pm
There is no need to put anything in your hard drive's root directory.
I suspect that build.sh does not have the execute bit set. I don't know why though; where did you get the source from?
In the directory containing the UQM source, do "chmod 755 build.sh". That should fix the execute bit.
Then just follow the instructions from INSTALL.macosx.


Title: Re: Building an OS X Bundled App
Post by: C. Bob on April 25, 2008, 03:50:18 am
Well, it turned out that I was attempting to use the wrong build.sh file entirely to do it. I managed to find the right one.

Here's the result of my most recent attempts:
'echo -n' capable echo found.
Sed stream editor found.
tr found.
Make found.
build/unix/build.sh: line 1: libmikmod-config: command not found
build/unix/build.sh: line 1: libmikmod-config: command not found
build/unix/build.sh: line 1: libmikmod-config: command not found
GNU C compiler found.
We have a C preprocessor.
We have a C dependency generator.
We have a C compiler.
We have a linker.
We have a Objective-C preprocessor.
We have a Objective-C dependency generator.
We have a Objective-C compiler.
Rez resource compiler (Apple Developer Tools) found.
We have a MacOS X resource compiler (Rez).
Little-endian machine detected.
Simple DirectMedia Layer not found.

The only documentation of this is ages old; in an incompetent attempt to follow out some advice Nic gave someone almost five ago for an earlier version (http://forum.uqm.stack.nl/index.php?topic=1112.0), I replaced the uqm-indent file with the version in Nic's latest source; this produced no notable effect.

I found the build.patch file made back in '04 (http://bugs.uqm.stack.nl/show_bug.cgi?id=358), but having no clue what to do with it, and no apparent file I could copy its contents into, then that doesn't work.


Title: Re: Building an OS X Bundled App
Post by: Novus on April 25, 2008, 08:36:58 am
Don't bother with Nic's old patches; they'll probably just make things worse. Your real problem is that you're missing most of the libraries; at least SDL (http://libsdl.org/). You want the OS X development libraries for the latest stable (1.2 branch, not SVN trunk) version. UQM has (for reasons I don't fully understand) its own copy of Mikmod, so you don't need to worry that it can't find a system-wide one.


Title: Re: Building an OS X Bundled App
Post by: C. Bob on April 25, 2008, 10:21:41 am
Well, that explains a lot.

I installed all the frameworks and the like, but didn't know about these other things, or that they were required.

With the long, convoluted SDL developmental setup ahead and no apparent installation documentation in sight (I checked the docs; it just talks about the technical things *after* you've installed it, though I probably overlooked something obvious to everyone else), I think it'd make the most sense to just give up on setting it up myself and see if there's anyone who wouldn't mind doing so (who it would be easy for); I don't have any experience whatsoever and it'd take ages. It isn't worth the effort anymore, when I really just want to hone in this one thing, and then I'm basically done.

Thanks for the advice, in any case.

- Bob


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 13, 2008, 12:19:48 am
Don't bother with Nic's old patches; they'll probably just make things worse. Your real problem is that you're missing most of the libraries; at least SDL (http://libsdl.org/).

I had exactly the same errors, and yet I definitely have SDL already installed.

Where can I find McMartin's draft of the steps?

EDIT: thanks, nic. It was here:

http://sc2.svn.sourceforge.net/viewvc/sc2/trunk/sc2/INSTALL.macosx?view=markup

EDIT AGAIN:

I'm getting an error where I don't have stricmp() defined on my system, and it's required in a bunch of places. This is... odd. Any ideas?


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 13, 2008, 05:33:37 am
The build.sh script checks for stricmp() and strcasecmp(). As long as one is found, UQM should build; if neither is, the build.sh script should abort with an error.
What error do you see exactly? Is it something reported by build.sh while it's detecting what is needed? Or is it an error during compilation, or linking?


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 13, 2008, 03:42:15 pm
Linking. Here you go:
Already having the object files ready, here's what I get:
Code:
$> build.sh uqm
  LINK     uqm-debug
Undefined symbols:
  "_stricmp", referenced from:
      _str2bool in mapres.c.o
      _str2bool in mapres.c.o
      _str2bool in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
      _res_IsBoolean in mapres.c.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [uqm-debug] Error 1

I am on 10.5.2, intel mac.
I have deactivated the ppc build target. If I don't, a whole lot more errors pop up.


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 13, 2008, 05:28:36 pm
What do you mean by "deactivated the ppc build target"?
Your bug sounds like your config_unix.h file is not correct. Does "./build.sh uqm clean" followed by "./build.sh uqm config" help?


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 13, 2008, 10:03:36 pm
What do you mean by "deactivated the ppc build target"?

in build.vars,
Code:
COMPILE_C='gcc -c -arch i386'

...
COMPILE_OBJC='gcc -c -arch i386'
LINK='gcc -arch i386'

instead of the same lines with "-arch ppc" before the "-arch i386"

The arch option sets the target architecture. With both, it tries to build a universal app. At least, that's how I understand it.

Your bug sounds like your config_unix.h file is not correct. Does "./build.sh uqm clean" followed by "./build.sh uqm config" help?

I did that; didn't help. if I cleaned and then configged then built, then it would come up with the error given and a lot more. If I cleaned and configged zapped the '-arch ppc' entries then it would only produce the error given.


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 13, 2008, 11:09:59 pm
You can generate some extra debug info by setting BUILDLOG in build/unix/config_functions to some file.
If you post that file here, I might be able to figure out a bit more.


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 14, 2008, 01:00:16 am
Here's the config log.

Code:
gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
/tmp/build.1184.tmp.c: In function ‘main’:
/tmp/build.1184.tmp.c:5: error: ‘strupr’ undeclared (first use in this function)
/tmp/build.1184.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.1184.tmp.c:5: error: for each function it appears in.)
/tmp/build.1184.tmp.c: In function ‘main’:
/tmp/build.1184.tmp.c:5: error: ‘strupr’ undeclared (first use in this function)
/tmp/build.1184.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.1184.tmp.c:5: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//cczH1NYN.out
Failed program was:
+++ START /tmp/build.1184.tmp.c
#include <sys/types.h>
#include <string.h>

int main(void) {
(void) strupr;
return 0;
}
+++ END /tmp/build.1184.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
/tmp/build.1184.tmp.c: In function ‘main’:
/tmp/build.1184.tmp.c:5: error: ‘stricmp’ undeclared (first use in this function)
/tmp/build.1184.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.1184.tmp.c:5: error: for each function it appears in.)
/tmp/build.1184.tmp.c: In function ‘main’:
/tmp/build.1184.tmp.c:5: error: ‘stricmp’ undeclared (first use in this function)
/tmp/build.1184.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.1184.tmp.c:5: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccMEnmuN.out
Failed program was:
+++ START /tmp/build.1184.tmp.c
#include <sys/types.h>
#include <string.h>

int main(void) {
(void) stricmp;
return 0;
}
+++ END /tmp/build.1184.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
/tmp/build.1184.tmp.c:3:3: error: #error
/tmp/build.1184.tmp.c:3:3: error: #error
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccElgHPZ.out
Failed program was:
+++ START /tmp/build.1184.tmp.c

#ifndef WIN32
# error
#endif
int main() {
return 0;
}
+++ END /tmp/build.1184.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
/tmp/build.1184.tmp.c:3:3: error: #error
/tmp/build.1184.tmp.c:3:3: error: #error
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccaWSVr3.out
Failed program was:
+++ START /tmp/build.1184.tmp.c

#ifndef __MINGW32__
# error
#endif
int main() {
return 0;
}
+++ END /tmp/build.1184.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -framework OpenGL /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 -I/opt/local/include /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -L/opt/local/lib -lmikmod -framework CoreAudio /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture
ld: warning in /opt/local/lib/libmikmod.dylib, file is not of required architecture

gcc -c -arch ppc -arch i386 -I/opt/local/include /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -L/opt/local/lib -lvorbisfile -lvorbis -lm -logg /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture
ld: warning in /opt/local/lib/libvorbisfile.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libvorbis.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libogg.dylib, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.1184.tmp.c -o /tmp/build.1184.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -lz /tmp/build.1184.tmp.c.o -o /tmp/build.1184.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
/tmp/build.5782.tmp.c: In function ‘main’:
/tmp/build.5782.tmp.c:5: error: ‘strupr’ undeclared (first use in this function)
/tmp/build.5782.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.5782.tmp.c:5: error: for each function it appears in.)
/tmp/build.5782.tmp.c: In function ‘main’:
/tmp/build.5782.tmp.c:5: error: ‘strupr’ undeclared (first use in this function)
/tmp/build.5782.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.5782.tmp.c:5: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccLWnEYp.out
Failed program was:
+++ START /tmp/build.5782.tmp.c
#include <sys/types.h>
#include <string.h>

int main(void) {
(void) strupr;
return 0;
}
+++ END /tmp/build.5782.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
/tmp/build.5782.tmp.c: In function ‘main’:
/tmp/build.5782.tmp.c:5: error: ‘stricmp’ undeclared (first use in this function)
/tmp/build.5782.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.5782.tmp.c:5: error: for each function it appears in.)
/tmp/build.5782.tmp.c: In function ‘main’:
/tmp/build.5782.tmp.c:5: error: ‘stricmp’ undeclared (first use in this function)
/tmp/build.5782.tmp.c:5: error: (Each undeclared identifier is reported only once
/tmp/build.5782.tmp.c:5: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccLbc5hr.out
Failed program was:
+++ START /tmp/build.5782.tmp.c
#include <sys/types.h>
#include <string.h>

int main(void) {
(void) stricmp;
return 0;
}
+++ END /tmp/build.5782.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
/tmp/build.5782.tmp.c:3:3: error: #error
/tmp/build.5782.tmp.c:3:3: error: #error
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//ccIcpkLb.out
Failed program was:
+++ START /tmp/build.5782.tmp.c

#ifndef WIN32
# error
#endif
int main() {
return 0;
}
+++ END /tmp/build.5782.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
/tmp/build.5782.tmp.c:3:3: error: #error
/tmp/build.5782.tmp.c:3:3: error: #error
lipo: can't figure out the architecture type of: /var/folders/MJ/MJvjeLdrGW4ooJhSVYS5bU+++TI/-Tmp-//cc0PB47D.out
Failed program was:
+++ START /tmp/build.5782.tmp.c

#ifndef __MINGW32__
# error
#endif
int main() {
return 0;
}
+++ END /tmp/build.5782.tmp.c

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -framework OpenGL /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture

gcc -c -arch ppc -arch i386 -I/opt/local/include /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -L/opt/local/lib -lmikmod -framework CoreAudio /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture
ld: warning in /opt/local/lib/libmikmod.dylib, file is not of required architecture

gcc -c -arch ppc -arch i386 -I/opt/local/include /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -L/opt/local/lib -lvorbisfile -lvorbis -lm -logg /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture
ld: warning in /opt/local/lib/libvorbisfile.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libvorbis.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libogg.dylib, file is not of required architecture

gcc -c -arch ppc -arch i386 /tmp/build.5782.tmp.c -o /tmp/build.5782.tmp.c.o
gcc -arch ppc -arch i386 -framework SDL -framework Cocoa -lobjc -framework SDL_image -lz /tmp/build.5782.tmp.c.o -o /tmp/build.5782.tmp.out
ld: warning in /Library/Frameworks//SDL.framework/SDL, file is not of required architecture
ld: warning in /Library/Frameworks//SDL_image.framework/SDL_image, file is not of required architecture


Title: Re: Building an OS X Bundled App
Post by: Novus on May 15, 2008, 07:55:10 pm
Looks like SDL is compiled for only Intel and UQM seems to be expecting both PowerPC and Intel 386 code to be stored in the same files.


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 16, 2008, 06:49:31 pm
So, how do I change that expectation?

Change EXTRA_PLATFORM_GCC_FLAGS_COMPILE_FOO to not include ppc architectures? That smells like what I did earlier, and that didn't work. Should we include an implementation of stricmp, perhaps a simple one aliasing it to the symbol actually used on macs?


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 16, 2008, 10:09:31 pm
What version of UQM is this? Is this 0.6.2? Or the version from SVN?

In 0.6.2 the build scripts defines HAVE_STRICMP if stricmp() is present, with port.h containing
Quote
#ifndef HAVE_STRICMP
#   define stricmp strcasecmp
#else
#   define strcasecmp stricmp
#endif

In SVN, the build scripts defines HAVE_STRICMP if stricmp() is present, and HAVE_STRCASECMP_UQM, with port.h containing:
Quote
#if !defined(HAVE_STRICMP) && !defined(HAVE_STRCASECMP_UQM)
#   error Neither stricmp() nor strcasecmp() is available.
#elif !defined(HAVE_STRICMP)
#   define stricmp strcasecmp
#elif !defined(HAVE_STRCASECMP_UQM)
#   define strcasecmp stricmp
#else
    // We should take care not to define anything if both strcasecmp() and
    // stricmp() are defined, as one might exist as a macro to the other.
#endif

You may be able to work around the problem by editing config_unix.h yourself (after running "./build.sh uqm"), changing HAVE_STRICMP and/or HAVE_STRCASECMP. I'm curious as to what it contains now.


Title: Re: Building an OS X Bundled App
Post by: Novus on May 16, 2008, 10:11:00 pm
Change EXTRA_PLATFORM_GCC_FLAGS_COMPILE_FOO to not include ppc architectures? That smells like what I did earlier, and that didn't work. Should we include an implementation of stricmp, perhaps a simple one aliasing it to the symbol actually used on macs?
To me this sounds like two completely different problems. If you don't case about PPC Macs (e.g. you're compiling for personal use), you can just leave them out like you already did. The stricmp bit is odd; it seems to be Microsoftese for strcasecmp. The build script should be detecting which is available. If you're already hacking build.vars, add "-Dstricmp=strcasecmp" to COMPILE_C. That's messy, but it should get it to link. Meep-eep's trying to figure out how to get it to work right instead of well enough.


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 16, 2008, 11:19:19 pm
What version of UQM is this? Is this 0.6.2? Or the version from SVN?

It's 0.6.2


You may be able to work around the problem by editing config_unix.h yourself (after running "./build.sh uqm"), changing HAVE_STRICMP and/or HAVE_STRCASECMP. I'm curious as to what it contains now.

Here's the config_unix.h file:
Code:
/* This file contains some compile-time configuration options for *nix
 * systems.
 * config_unix.h is generated from config_unix.h.in by build.sh
 * When building on MS Windows using build.sh (MinGW, Cygwin),
 * config_win.h is generated from src/config_win.h.in.
 * When using MSVC on MS Windows, you'll have to edit src/msvc++/config.h
 * manually if you want anything else than the defaults.
 */

#ifndef _CONFIG_UNIX_H
#define _CONFIG_UNIX_H

/* Directory where the UQM game data is located */
#define CONTENTDIR "/uqm/content"

/* Directory where game data will be stored */
#define USERDIR "~/.uqm/"

/* Directory where config files will be stored */
#define CONFIGDIR USERDIR

/* Directory where supermelee teams will be stored */
#define MELEEDIR "${UQM_CONFIG_DIR}/teams/"

/* Directory where save games will be stored */
#define SAVEDIR "${UQM_CONFIG_DIR}/save/"

/* Defined if words are stored with the most significant byte first */
#undef WORDS_BIGENDIAN

/* Defined if your system has readdir_r of its own */
#define HAVE_READDIR_R

/* Defined if your system has setenv of its own */
#define HAVE_SETENV

/* Defined if your system has strupr of its own */
#undef HAVE_STRUPR

/* Defined if your system has stricmp of its own */
#undef HAVE_STRICMP

/* Defined if your system has getopt_long */
#define HAVE_GETOPT_LONG

/* Defined if your system has iswgraph of its own*/
#define HAVE_ISWGRAPH

/* Defined if your system has wchar_t of its own */
#define HAVE_WCHAR_T

/* Defined if your system has wint_t of its own */
#define HAVE_WINT_T

#endif  /* _CONFIG_UNIX_H */

Interesting. So, HAVE_STRICMP is explicitly undefined here.


Now I can't get to the linking step anymore. What happen? I get the same thing with no modifications or with some or all.

Code:
  CC       obj/debug/src/sc2code/libs/graphics/sdl/3do_blt.c.o
In file included from src/sc2code/libs/graphics/sdl/sdl_common.h:25,
                 from src/sc2code/libs/graphics/sdl/3do_blt.c:21:
/Library/Frameworks/SDL_image.framework/Headers/SDL_image.h:28:17: error: SDL.h: No such file or directory
/Library/Frameworks/SDL_image.framework/Headers/SDL_image.h:29:25: error: SDL_version.h: No such file or directory
/Library/Frameworks/SDL_image.framework/Headers/SDL_image.h:30:24: error: begin_code.h: No such file or directory
/Library/Frameworks/SDL_image.framework/Headers/SDL_image.h:114:24: error: close_code.h: No such file or directory
make: *** [obj/debug/src/sc2code/libs/graphics/sdl/3do_blt.c.o] Error 1

I definitely have these missing header files; they're in /Library/Frameworks/SDL.framework/Headers


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 17, 2008, 12:49:08 am
Do you have a 'config.h' file in some location which might be scanner before src/?

Something to try: set and export "CFLAGS=-save-temps" before doing "./build.sh uqm config" (or edit build.vars afterwards). You'll get a whole lot of .s and .i files in your build root when you run "./build.sh uqm" then. The mapres.i file should give a bit of information on what files are actually included. It will be too big for the forum, but you could use pastebin.com (http://pastebin.com/) or something similar to pass it on to us.


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 19, 2008, 03:54:05 pm
Wait.. I see why it failed - I forgot that CFLAGS step in the instructions.  ::)

Trying again... okay. That just got back to where we were before.

Getting the further debug info... Oh, crud. I can't include both CFLAGS values. When I try

CFLAGS="-I/Library/Frameworks/SDL.framework/Headers -save-temps" ./build.sh uqm config

it just doesn't find the SDL framework and dies right away. Is it not possible to put more than one CFLAG on a line?

Okay, I put them into the COMPILE_C and COMPILE_OBJC values, after -c and before -arch i386...

http://pastebin.com/m78492fd2


Title: Re: Building an OS X Bundled App
Post by: meep-eep on May 19, 2008, 06:03:55 pm
You should be able to put as much flags in CFLAGS as you wish.

As for that file which you pasted... when including the file reslib.h it goes right to line 24, without executing line 23...
Did you, by any chance, comment out the line that says '#include "port.h"'?


Title: Re: Building an OS X Bundled App
Post by: Death 999 on May 19, 2008, 09:37:09 pm
...

...

I thought I undid that after doing it (so I could build just urquan.c without dragging along much else).
/me checks.

Huh. I must have 'reverted' the original instead of the modified. Or maybe typed :q instead of :wq?

Anywho, it compiles now (iff I remove "-arch ppc" from build.vars).

After adventures in finding the right content package...

Now I discover that the turning I was trying to put in simply doesn't work at all. Hmm. Well, we have the basic building taken care of.

~~~~ edited in much later, to sum up ~~~~

follow the instructions linked above, at
http://sc2.svn.sourceforge.net/viewvc/sc2/trunk/sc2/INSTALL.macosx?view=markup
using the branch 'if SDL complains'...
EXCEPT:
after configuring but before building, eliminate the ppc targets from build.vars