MacOsX Version issues

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

Re: MacOsX Version issues

#136 Post by tzlaine »

Thanks for doing this! Ok, here's my take on your GG patch. I changed some formatting-type stuff, and s/NULL/0. Do these changes work for you? If so, I'll be committing these files as they are here, including your copyright. If you approve, I'll take this as written consent to release this code under LGPL.

Now, I have a couple of questions:
Why do you start so many of your string literals with '\p' (e.g. "\pOpenGL.framework")?
Did you build GG with its SCons build system? It appears you did not, since I found "#ifdef FREEORION_MACOSX" in your changes to GG/Ogre/OgreGUI.h. Before I can accept this patch for GG's trunk, I'll need your assurance that the SCons build works. Otherwise, I'll stick this changeset in a patches directory in the GG repository.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: MacOsX Version issues

#137 Post by Geoff the Medio »

Someone posted a crash bug about the Mac OSX version on sourceforge:

https://sourceforge.net/tracker/index.p ... tid=544942

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#138 Post by .Id »

Geoff the Medio wrote:Your patch for freeorion doesn't appear to contain the XCode project files. Can those be bundled up in a ready-to-use way and put in SVN as well?
yes, I can arrange that

should I just include the XCode project or all the dependencies?
the whole mac SDK may be >50MBs.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: MacOsX Version issues

#139 Post by Geoff the Medio »

.Id wrote:
Geoff the Medio wrote:Your patch for freeorion doesn't appear to contain the XCode project files. Can those be bundled up in a ready-to-use way and put in SVN as well?
yes, I can arrange that

should I just include the XCode project or all the dependencies?
the whole mac SDK may be >50MBs.
If there are a bunch of dependencies you need to build separately, then you should probably make an SDK like the Windows SDK that's already on SF as a separate download. The SDK will contain all the dependencies pre-built and a snapshot of the code and data off SVN, with subversion directories so that after downloading the SDK, the user can update from SVN to get any recent changes to the code or project files. Only the project files will go in SVN, so that they can be updated whenever files are added or removed from the build.

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#140 Post by .Id »

tzlaine wrote:Thanks for doing this! Ok, here's my take on your GG patch. I changed some formatting-type stuff, and s/NULL/0. Do these changes work for you? If so, I'll be committing these files as they are here, including your copyright. If you approve, I'll take this as written consent to release this code under LGPL.
Anything that's copyright from me, I didn't intend to have there.

But the aglGetProcAddress files are actually apple's work:
http://developer.apple.com/qa/qa2001/qa1188.html which I should have made clear, sorry.
Now, I have a couple of questions:
Why do you start so many of your string literals with '\p' (e.g. "\pOpenGL.framework")?
That was curious to me, too and I forgot to look into it.
Did you build GG with its SCons build system? It appears you did not, since I found "#ifdef FREEORION_MACOSX" in your changes to GG/Ogre/OgreGUI.h. Before I can accept this patch for GG's trunk, I'll need your assurance that the SCons build works. Otherwise, I'll stick this changeset in a patches directory in the GG repository.
I didn't use SCons. Considering a SCons build wasn't previously supported on a mac platform, I'll take you mean the changes don't break win32 or posix. And I'm fairly certain they don't, since everything would be preprocessed out and the aglGetProcAddress files do not even need to be looked at for those platforms. Would confirming a GG SCons build with this patch on linux suffice?

Naesbye
Krill Swarm
Posts: 11
Joined: Thu Dec 11, 2008 9:46 pm

Re: MacOsX Version issues

#141 Post by Naesbye »

I think the XCode project should be in the repo, but not the SDK. The SDK is bound to not change often anyway, right?

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#142 Post by .Id »

tzlaine wrote: Did you build GG with its SCons build system? It appears you did not, since I found "#ifdef FREEORION_MACOSX" in your changes to GG/Ogre/OgreGUI.h. Before I can accept this patch for GG's trunk, I'll need your assurance that the SCons build works. Otherwise, I'll stick this changeset in a patches directory in the GG repository.
Glad, I checked this. There was a bug where I #ifdef instead of #if, use this patch for OgreGUI.cpp instead of what was in previous files:

Code: Select all

Index: src/Ogre/OgreGUI.cpp
===================================================================
--- src/Ogre/OgreGUI.cpp        (revision 711)
+++ src/Ogre/OgreGUI.cpp        (working copy)
@@ -33,6 +33,10 @@
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
 #include <GL/gl.h>
 #include <GG/glext.h>
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#include "aglGetProcAddress.h"
 #else
 #include <GL/glx.h>
 #endif
@@ -191,6 +195,10 @@
     typedef void (*BindBufferARBFn)(GLenum, GLuint);
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
     BindBufferARBFn glBindBufferARB = (BindBufferARBFn)wglGetProcAddress("glBindBufferARB");
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+       OSStatus err = aglInitEntryPoints (); //init bundle
+       if (err != noErr) Exit(err);
+       BindBufferARBFn glBindBufferARB = (BindBufferARBFn)aglGetProcAddress("glBindBufferARB");
 #else
     BindBufferARBFn glBindBufferARB = (BindBufferARBFn)glXGetProcAddress((const GLubyte* )"glBindBufferARB");
 #endif
@@ -204,6 +212,8 @@
     typedef void (*UseProgramARBFn)(GLuint);
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
     UseProgramARBFn glUseProgramARB = (UseProgramARBFn)wglGetProcAddress("glUseProgramARB");
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+       UseProgramARBFn glUseProgramARB = (UseProgramARBFn)aglGetProcAddress("glUseProgramARB");
 #else
     UseProgramARBFn glUseProgramARB = (UseProgramARBFn)glXGetProcAddress((const GLubyte* )"glUseProgramARB");
 #endif
@@ -222,6 +232,9 @@

 void OgreGUI::Exit2DMode()
 {
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+       aglDellocEntryPoints();
+#endif
     glPopClientAttrib();
     glPopAttrib();
 }
And given that it's in GG source, I think it's more appropriate to check for __APPLE__ instead of FREEORION_MACOSX here?

Code: Select all

Index: GG/Ogre/OgreGUI.h
===================================================================
--- GG/Ogre/OgreGUI.h   (revision 711)
+++ GG/Ogre/OgreGUI.h   (working copy)
@@ -29,6 +29,21 @@
 #ifndef _GG_OgreGUI_h_
 #define _GG_OgreGUI_h_

+#ifdef __APPLE__
+/* prevents OpenTransportProviders.h (a system header in Mac SDKs)
+    from trying to enum what's already defined by includeing it elsewhere */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#undef TCP_NOTIFY_THRESHOLD
+#undef TCP_ABORT_THRESHOLD
+#undef TCP_CONN_NOTIFY_THRESHOLD
+#undef TCP_CONN_ABORT_THRESHOLD
+#undef TCP_OOBINLINE
+#undef TCP_URGENT_PTR_TYPE
+#undef TCP_KEEPALIVE
+#include <Carbon/Carbon.h>
+#endif
+
 #include <OgreDataStream.h>
 #include <OgreRenderTargetListener.h>
 #include <OgreSharedPtr.h>
These compile with SCons on linux and still in Xcode.

I can rewrite that code to get OpenGL entry points if you'd like.

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#143 Post by .Id »

Naesbye wrote:I think the XCode project should be in the repo, but not the SDK. The SDK is bound to not change often anyway, right?
Right. Not as frequent as the Xcode project.

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#144 Post by .Id »

Patch to add the Xcode project is attached.

Universal Binary: FreeOrion 0.3.12 rev 2913
I redid some things with boost dependency; maybe it will play nice with PPC. There's one obvious bug that I haven't fixed, just worked around so far. See the bug.zip attachment for details. I'd really appreciate any suggestions or help in fixing it.
Run the "unpack-FO" shell script after downloading everything.

Mac SDK: rev 2913 included
An SDK for Mac that includes all dependencies and svn revision 2913 of the code.
Run the "unpack-sdk" shell script after downloading everything.
Attachments
bug.zip
Crash on clicking "Exit" seems isolated to the Mac build.
(2.52 KiB) Downloaded 95 times
FO-Xcode-patch.zip
Patch to add Xcode project to svn.
(25.51 KiB) Downloaded 93 times

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: MacOsX Version issues

#145 Post by eleazar »

.Id wrote: Run the "unpack-FO" shell script after downloading everything.
err, how do you do that?

"run" doesn't seem to be the necessary command.

Naesbye
Krill Swarm
Posts: 11
Joined: Thu Dec 11, 2008 9:46 pm

Re: MacOsX Version issues

#146 Post by Naesbye »

'\p' is a relic from the days of old, when the Mac Toolbox was in ROM and Pascal-based :-P

It denotes that the string is a Pascal string, and gets substituted with a length count (to indicate the length of the string), as opposed to a C string which ends when a 0x00 (zero) is encountered.

If I remember correctly. But those Pascal strings should die a horrible death, if possible.

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#147 Post by .Id »

eleazar wrote:
.Id wrote: Run the "unpack-FO" shell script after downloading everything.
err, how do you do that?

"run" doesn't seem to be the necessary command.
Double clicking from the Finder should (hopefully) work.

Inside a terminal, just typing the full path of the script would work, or change directory to it and do `./unpack-FO`
This is all provided that the execute permission is set on that script: `chmod u+x unpack-FO`

User avatar
.Id
Space Squid
Posts: 76
Joined: Fri Feb 06, 2009 6:54 pm

Re: MacOsX Version issues

#148 Post by .Id »

Thanks for the hint about Pascal strings.
I doubt they're necessary for the purposes of that particular code. It was mostly appearing in error/debug strings except 1 place.
So I'll review it and probably rewrite it sometime for practice/fun, but feel free to beat me to it and we can compare notes.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: MacOsX Version issues

#149 Post by eleazar »

thanks that worked

jabyrd3
Space Krill
Posts: 2
Joined: Mon Mar 30, 2009 2:12 am

Re: MacOsX Version issues

#150 Post by jabyrd3 »

Have any of you guys bumped into this lib error yet?

dyld: Library not loaded: /usr/lib/libexpat.1.dylib
Referenced from: /Users/.../Desktop/FreeOrion.app/Contents/MacOs/../SharedSupport/libgvc_builtins.dylib
Reason: image not found
Trace/BPT trap


I downloaded the FreeOrion 0.3.11 UB from sourceforge, and I started to get library errors. So I installed X11, and now i'm getting this expat.1.dylib error. I found a libexpat.1.0.dylib on my computer, but i couldn't find 1.0. Anybody mind pointing me to it, or perhaps giving me a hint?

Oh, btw, I'm running an old MBP, first hardware iteration with 10.4.

Update: Just downloaded the last version of the SDK you posted. Couldn't find any libexpat in it. Am I looking in the wrong place, or is this just a lib i should already have had?

Post Reply