UFO:Alien Invasion

Technical support => Mac => Topic started by: sandrock on September 03, 2009, 07:31:52 am

Title: Problem with making a Mac universal binary
Post by: sandrock on September 03, 2009, 07:31:52 am
Hey folks - new to the forums, been lurking a bit.
After playing with the stable 2.2.1 release for a while, I thought I'd try my hand at SVN-ing and compiling the 2.3 development version.
So, I followed the directions here:http://ufoai.ninex.info/wiki/index.php/Compile_for_Mac (http://ufoai.ninex.info/wiki/index.php/Compile_for_Mac)
Using Macports. Oh, and I'm on a Macbook, Intel Core 2 Duo 2.16 GHz

Trouble is, after I've gone through make/make lang/make maps/make pk3 steps, and try the make bundle TARGET_CPU=universal command, i get this message in Terminal:
cp: ../../../../radiant/uforadiant: No such file or directory
make: *** [copybinaries] Error 1


it does make a UFOAI.app file, but when I click on the app, it gives me this dialogue box:
You can't open the application "UFOAI" because it is not supported on this architecture

I'm a bit new to all this compiling and whatnot (though i'm eager to learn) - can anyone point me in the right direction here?
How do I tell what architecture my system uses?

I'd really love to be able to compile the newest versions, make dmgs, and upload them for you all, since it only takes me a few hours to do the whole process, and it seems there's just a couple others on here who have Macs fast enough and with enough space to do that.
Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 03, 2009, 07:38:22 am
running

./configure --enable-universal && make && make macinstaller

should be all you need
Title: Re: Problem with making a Mac universal binary
Post by: sandrock on September 03, 2009, 08:53:53 am
Mattn, thank you for the quick response ;-)

i ran the command string you posted, and this is what I got back (well, the end of it):

cd src/ports/macosx/installer; make TARGET_CPU=universal
cp: ../../../../radiant/uforadiant: No such file or directory
make[1]: *** [copybinaries] Error 1
make: *** [macinstaller] Error 2

Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 03, 2009, 09:00:15 am
ups - also type

    make uforadiant

please
Title: Re: Problem with making a Mac universal binary
Post by: sandrock on September 03, 2009, 09:59:19 am
ups - also type

    make uforadiant

please

I did type "make uforadiant" and then tried "make macinstaller" again, but received the same error message as before.
Looking through the log of the "make uforadiant" action, it looks like i'm getting quite a few errors, though in all honesty i don't know code at all so they could be nothing.
Code: [Select]
[sandrock-meets-pascal:~/ufoai/trunk] sandrock% make uforadiant
 * [RAD] src/tools/radiant/plugins/model/plugin.cpp
In file included from src/tools/radiant/libs/debugging/debugging.h:30,
                 from src/tools/radiant/include/modulesystem.h:31,
                 from src/tools/radiant/include/iscenegraph.h:242,
                 from src/tools/radiant/plugins/model/plugin.cpp:30:
src/tools/radiant/libs/stream/textstream.h:36:18: error: glib.h: No such file or directory
In file included from src/tools/radiant/libs/debugging/debugging.h:30,
                 from src/tools/radiant/include/modulesystem.h:31,
                 from src/tools/radiant/include/iscenegraph.h:242,
                 from src/tools/radiant/plugins/model/plugin.cpp:30:
src/tools/radiant/libs/stream/textstream.h:36:18: error: glib.h: No such file or directory
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, double)’:
src/tools/radiant/libs/stream/textstream.h:131: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h:131: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const HexChar&)’:
src/tools/radiant/libs/stream/textstream.h:199: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const FloatFormat&)’:
src/tools/radiant/libs/stream/textstream.h:218: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const Decimal&)’:
src/tools/radiant/libs/stream/textstream.h:237: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, double)’:
src/tools/radiant/libs/stream/textstream.h:131: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h:131: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const HexChar&)’:
src/tools/radiant/libs/stream/textstream.h:199: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const FloatFormat&)’:
src/tools/radiant/libs/stream/textstream.h:218: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/stream/textstream.h: In function ‘TextOutputStreamType& ostream_write(TextOutputStreamType&, const Decimal&)’:
src/tools/radiant/libs/stream/textstream.h:237: error: there are no arguments to ‘g_snprintf’ that depend on a template parameter, so a declaration of ‘g_snprintf’ must be available
src/tools/radiant/libs/string/string.h: In function ‘int string_compare_nocase(const char*, const char*)’:
src/tools/radiant/libs/string/string.h:88: error: ‘g_ascii_strcasecmp’ was not declared in this scope
src/tools/radiant/libs/string/string.h: In function ‘int string_compare_nocase_n(const char*, const char*, size_t)’:
src/tools/radiant/libs/string/string.h:97: error: ‘g_ascii_strncasecmp’ was not declared in this scope
src/tools/radiant/libs/string/string.h: In function ‘int string_compare_nocase(const char*, const char*)’:
src/tools/radiant/libs/string/string.h:88: error: ‘g_ascii_strcasecmp’ was not declared in this scope
src/tools/radiant/libs/string/string.h: In function ‘int string_compare_nocase_n(const char*, const char*, size_t)’:
src/tools/radiant/libs/string/string.h:97: error: ‘g_ascii_strncasecmp’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp: In function ‘void PicoPrintFunc(int, const char*)’:
src/tools/radiant/plugins/model/plugin.cpp:60: error: ‘g_message’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp:68: error: ‘g_warning’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp:76: error: ‘g_critical’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp: In function ‘void PicoPrintFunc(int, const char*)’:
src/tools/radiant/plugins/model/plugin.cpp:60: error: ‘g_message’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp:68: error: ‘g_warning’ was not declared in this scope
src/tools/radiant/plugins/model/plugin.cpp:76: error: ‘g_critical’ was not declared in this scope
lipo: can't figure out the architecture type of: /var/folders/I+/I+wF2o4r2RaxDU+1YuUSk++++TI/-Tmp-//ccUCOMBK.out
make: *** [debug-darwin-universal/tools/radiant/plugins_cpp/tools/radiant/plugins/model/plugin.o] Error 1
Title: Re: Problem with making a Mac universal binary
Post by: Dorzak on September 03, 2009, 07:08:35 pm
ups - also type

    make uforadiant

please

Same errors I was getting, and yes according to macports the packages you mentioned not being installed are installed.

Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 03, 2009, 08:25:54 pm
i'm sorry - it works on my mac and not an experienced mac user - just bought it a few days ago. someone with more experience would have to take a look at this
Title: Re: Problem with making a Mac universal binary
Post by: sandrock on September 03, 2009, 11:40:03 pm
No worries, Mattn - i can still run the game from the Terminal command line, after all.
I certainly appreciate your willingness to help me figure it out ;-)
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 03, 2009, 11:50:22 pm
Ick.

Code: [Select]
Kleiman-ibook:~ michael$ port outdated
No installed ports are outdated.
Kleiman-ibook:~ michael$ sudo port install  gtkglext +universal  gtk2 +universal openal +universal
Password:
--->  Computing dependencies for gtkglext
--->  Building cairo
--->  Building cairo for architecture ppc
--->  Building cairo for architecture i386
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_cairo/work/cairo-1.8.8-i386" && /usr/bin/make -j1 all " returned error 2
Command output:       __get_pattern_ft_options in cairo-ft-font.o
      __cairo_ft_unscaled_font_create_for_pattern in cairo-ft-font.o
  "_FcPatternAddInteger", referenced from:
      __cairo_ft_font_options_substitute in cairo-ft-font.o
      __cairo_ft_font_options_substitute in cairo-ft-font.o
      __cairo_ft_font_options_substitute in cairo-ft-font.o
      __cairo_ft_scaled_font_create_toy in cairo-ft-font.o
      __cairo_ft_scaled_font_create_toy in cairo-ft-font.o
...

XCode version is 3.1.2.

Any clues? Anyone?

Can we go back to disabling radiant?
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 04, 2009, 03:12:19 am
I have the answer. It is a flaw in Macports

If you need port X for a program locally, it will be installed, usually with the default options.
If you then need it later with a different option, like "+universal", it will not be remade.

I've got a lot of ports to remake.
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 05, 2009, 06:43:09 am
OpenAl is not available in universal binary in Mac Ports.

If either Ufo or Radiant requires OpenAl, then it cannot be compiled as universal.

I've sent a message to the macports mailing list, but there is no current maintainer for this library.
Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 05, 2009, 07:32:59 am
the glib problem seems to only occur if you build an universal, too

the strange thing is that if you skip the --enable-universal in your configure call the pkg-config will deliver the correct CFLAGS (that also contains the include option for the include/glib2.0/ directory) - but if you enable universal only the LDFLAGS are set correctly, but the CFLAGS are not.
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 05, 2009, 11:29:12 pm
OpenAl is included in Mac OS 10.4 and higher:

Kleiman-ibook:Development michael$ ls /System/Library/Frameworks/OpenAL.framework/
total 16
4 CodeResources@   4 OpenAL@      0 Versions/
4 Headers@      4 Resources@

I'm going to punt on this issue; 10.2 and 10.3 people will have to wait.
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 06, 2009, 02:19:25 am
And it's a non-issue: Gtk2 requires 10.4.

Worse:
Quote from: Gtk mac home page@http://sourceforge.net/apps/trac/gtk-osx/wiki/GtkQuartz
Gtk+-2 is implemented on Macintosh OSX in gtk+-2/gdk/quartz and gtk+-2/gtk. The current list of files are provided below. Graphics and text rendering are provided by Cairo Graphics and Pango, respectively. As of this writing, the Quartz implementations of both Cairo and Pango appear to be actively maintained.

Sadly, the same cannot be said of Gtk+. The primary developer of both the contents of this project and of the Quartz backend for Gtk+, Richard Hult, has withdrawn from further work on any aspect of Gtk+ on OSX. When we pointedly asked on the gtk-devel mailing list if there was anyone with commit permission who was willing to commit to keeping the Quartz backend current, we were met with silence.

Meanwhile, I'm still having trouble getting this (gtk) to compile universal. Just grabbing a disk image and having it installed is almost looking favorable :-).

The error I'm getting is:
Code: [Select]
Making all in gtk
/usr/bin/make  gtk-update-icon-cache
make[3]: `gtk-update-icon-cache' is up to date.
GDK_PIXBUF_MODULE_FILE=../gdk-pixbuf/gdk-pixbuf.loaders ./gtk-update-icon-cache --force --ignore-theme-index \
   --source builtin_icons stock-icons > gtkbuiltincache.h.tmp &&        \
mv gtkbuiltincache.h.tmp gtkbuiltincache.h
gtk-update-icon-cache: The generated cache was invalid.
make[2]: *** [gtkbuiltincache.h] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Error: Status 1 encountered during processing.
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 06, 2009, 11:12:50 pm
(Moved from the mac binary thread)
I managed to erase all macport installations needed to build gtk2, and just installed gtk2.

In the process, I ran into a bug in macport 1.8.0 (newest); it seems to build build tools before it builds libraries. If a build-tool needs a library, that library is only built for single machine, not for +universal.

So it looks like a true "from scratch" installation will take two separate build commands; one to make sure that libraries needed will be installed +universal, and a second to build the final programs with their build tools.

===

... and that is now questionable, as it seems I missed a few after all.

Still having trouble making a universal. This time with a better clean, and trouble on a different package. (Naturally, on 10.6 it compiles universal for i386 and x86_64 just fine.)

Title: Re: Problem with making a Mac universal binary
Post by: Dorzak on September 07, 2009, 07:12:16 am
And 10.6 can't get libSDL working yet.
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 17, 2009, 05:25:31 am
http://gtk-osx.org/ has prebuilt gtk2 / cario / glib frameworks.

They are i386 only. Gaarr.

I'm beginning to think that this won't build universal, but will have separate ppc and x86 programs.

===
So macport can't build universal. Prebuilt frameworks are not universal. http://sourceforge.net/apps/trac/gtk-osx/wiki/Build contains a port of Gtk2, but it doesn't say that it builds universal, and requires you to use a custom build harness to make programs -- for example,
Quote
And you have a reasonably complete GTK+ installation ready for you to build the application that interests you.

Code: [Select]
$ jhbuild build gimp

Let me see if I can get a ppc-only build.

(Again: Can we please get --disable-radiant back into the configure script?)
Title: Re: Problem with making a Mac universal binary
Post by: geever on September 17, 2009, 07:36:06 am
(Again: Can we please get --disable-radiant back into the configure script?)

I don't think it was removed, maybe renamed to --disable-uforadiant.

-geever
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 18, 2009, 05:37:25 am
Ok, then I've got a universal. Built! No gtk mess at all. But no radiant.

Crashes on a skimish. What is the "debugging log" option again?
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 18, 2009, 05:53:45 pm
With radiant disabled, make macinstaller fails with the following at the end:

cp -v ../../../../base/0shaders.pk3 UFOAI.app/base/0shaders.pk3
../../../../base/0shaders.pk3 -> UFOAI.app/base/0shaders.pk3
cp -v ../../../../base/0videos.pk3 UFOAI.app/base/0videos.pk3
../../../../base/0videos.pk3 -> UFOAI.app/base/0videos.pk3
Installing UFOAI.app/Contents/Libraries/libjpeg.62.dylib...done
Installing UFOAI.app/Contents/Libraries/libtheora.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libogg.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libSDL_mixer-1.2.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libSDL-1.2.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libpng12.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libiconv.2.dylib...done
Installing UFOAI.app/Contents/Libraries/libfreetype.6.dylib...done
Installing UFOAI.app/Contents/Libraries/libvorbis.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libz.1.dylib...done
Installing UFOAI.app/Contents/Libraries/libcurl.4.dylib...done
Installing UFOAI.app/Contents/Libraries/libSDL_ttf-2.0.0.dylib...done
Installing UFOAI.app/Contents/Libraries/libintl.8.dylib...done
Finalizing ufo...Finalizing ufoded...Finalizing ufo2map...done
........................................................................
created: /Users/Michael/Documents/Development/ufoai/trunk/src/ports/macosx/installer/ufoai-2.3-dev-macosx-universal.dmg
cp: ../../../../radiant/uforadiant: No such file or directory
make[1]: *** [copybinaries-uforadiant] Error 1
make: *** [macinstaller] Error 2
stbmac:trunk Michael$

Now, even if I had radiant, it would be trying to copy it _AFTER_ building the dmg. Kinda pointless.

Revision 26252
Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 19, 2009, 12:37:34 am
nope - as it would build another dmg for radiant
Title: Re: Problem with making a Mac universal binary
Post by: keybounce on September 19, 2009, 01:43:51 am
Oh, so it's not one DMG with both programs, it's two separate DMG's.
Title: Re: Problem with making a Mac universal binary
Post by: Dorzak on September 19, 2009, 07:29:09 am
Got it to build as i386, but it didn't include the languages.

No language options when looking at options.
Title: Re: Problem with making a Mac universal binary
Post by: Mattn on September 19, 2009, 08:43:00 am
the problem here is in main.cpp:443

Code: [Select]
  bindtextdomain(GETTEXT_PACKAGE, "i18n");

it's not searching the mo files at the correct location. Can you upload the dmg somewhere?

maybe one can work around it by providing a suitable PKGDATADIR (via ./configure --datadir=/path/to/dmg) - i'm just not sure which path would be the correct one. how are other packages handling this that are providing gettext support?
Title: Re: Problem with making a Mac universal binary
Post by: Dorzak on September 22, 2009, 08:59:30 am


maybe one can work around it by providing a suitable PKGDATADIR (via ./configure --datadir=/path/to/dmg) - i'm just not sure which path would be the correct one. how are other packages handling this that are providing gettext support?

I worked around it by
"Show Package Contents" on the UFOAI.app on the one with the broken Campaign start you uploaded with the UFO Radiant.   

Copied the language files within there into the app from the DMG I made on my wife's computer.

Couldn't do it within the DMG, had to do it after copying the app out of the DMG.

Throwing the zip file with languages up somewhere and the i386 DMG I made.  Will let you know when it is uploaded.