I was able to build the latest OpenSG sources from the Subversion repository
on Mac OS X (10.4) today, but I ran into a few problems. First, a linker
error about an unresolved symbol occurs when building libOSGSystem.dylib. No
specializations for the function osgSwapBytes<T>() exist for the unsigned
long and long cases because OSG::UInt32 maps to unsigned int (and OSG::Int32
to int). Somewhere in the code, however, the compiler must be interpreting a
constant as an unsigned long instead of an unsigned int and/or unsigned long
is being used instead of OSG::UInt32. The first attachment (link.patch)
fixes the linking problem, but I would not call it a very good patch. It's
really just a hack, but it seems to me that fixing things without cluttering
up OSGBaseFunctions.inl would mean tracking down the places in the code
where the unsigned longs are coming into the picture and forcing them to be
OSG::Uint32. Even then, this same problem could crop up later since the
types themselves both represent four-byte values. The name mangling is where
things go awry.

As far as the build itself goes, it does not behave in what I would call an
intuitive manner with respect to the var_arch and darwin_universal
arguments. It seems to me that if I set var_arch to a specific architecture,
then only that architecture should be built regardless of what the state of
the universal binary flag is. Looking at SConsAddons, I cannot follow the
flow of the code, so I do not understand how the decision is made about
which "-arch <arch>" options get added to the compiler and linker argument
lists under what circumstances. Given this, I had to build with var_arch set
to ia32 (for an Intel Mac) and darwin_universal set to no.

Beyond that, the OpenGL and GLUT frameworks on my machines do not include a
ppc64 binary. Since the universal build appears to include "-arch ppc64" no
matter what, linking the OpenSG libraries as universal binaries fails.
Having a way to limit the binaries built when making a universal binary
would be a big help, and maybe this is already possible with the current
state of SConsAddons.

Finally, running the test programs fails due to two problems. The first is
that DYLD_LIBRARY_PATH isn't being handled. Second, the call to os.spawnle()
isn't passing in the program name as is required. I don't know why this
isn't a problem on other platforms, but maybe Python 2.3 is less forgiving
about misusing os.spawn[lv]*(). The second attachment (build.patch) fixes
these problems.

 -Patrick


-- 
Patrick L. Hartling                    | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2msw3          | http://www.infiscape.com/
Index: Source/Base/Base/OSGBaseFunctions.inl
===================================================================
--- Source/Base/Base/OSGBaseFunctions.inl       (revision 559)
+++ Source/Base/Base/OSGBaseFunctions.inl       (working copy)
@@ -2797,6 +2797,15 @@
             ((src & 0xff000000) >> 24)  );
 }
 
+#if defined(__APPLE__)
+template <>
+inline unsigned long
+osgSwapBytes<unsigned long>(unsigned long src)
+{
+    return osgSwapBytes(static_cast<UInt32>(src));
+}
+#endif
+
 /*! \ingroup GrpBaseBaseMiscFn
  */
 template <>
@@ -2806,6 +2815,15 @@
     return static_cast<Int32>(osgSwapBytes(static_cast<UInt32>(src)));
 }
 
+#if defined(__APPLE__)
+template <>
+inline long
+osgSwapBytes<long>(long src)
+{
+    return static_cast<long>(osgSwapBytes(static_cast<Int32>(src)));
+}
+#endif
+
 /*! \ingroup GrpBaseBaseMiscFn
  */
 template <>
Index: Source/SConscript
===================================================================
--- Source/SConscript   (revision 559)
+++ Source/SConscript   (working copy)
@@ -138,6 +138,8 @@
             ev = os.environ
             if GetPlatform() == "win32":
                 key = "PATH"
+            elif GetPlatform() == "darwin":
+                key = "DYLD_LIBRARY_PATH"
             else:
                 key = "LD_LIBRARY_PATH"
                 
@@ -146,7 +148,8 @@
             else:
                 ev[key] = path
             
-            exit_code = os.spawnle(os.P_WAIT, str(target[0]), ev)
+            prog = str(target[0])
+            exit_code = os.spawnle(os.P_WAIT, prog, prog, ev)
             
             if exit_code != 0:
                 Exit(exit_code)

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to