Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Building netbsd-5 on OS X 10.6 (Snow Leopard)



The following workarounds and patch come *close* to allowing building
the netbsd-5 branch on OS X 10.6 (Snow Leopard):

        1) set HOST_CC to "cc -m32 -mmacosx-version-min=10.4" in the
           environment or with the -V option to build.sh.

        2) set HOST_CXX to "c++ -m32 -mmacosx-version-min=10.4" in the
           environment or with the -V option to build.sh.

        The -m32 switch works around a problem with the pwcache
        (user_from_uid(), etc.) functions -- OS X actually has some but
        not all of them, has no prototypes for some, and uses different
        argument types than the NetBSD (libcompat) versions when in 64 bit
        mode.

        The -mmacos-version-min=10.4 switch works around a problem which
        results from using -m32, namely that libc functions called from
        libnbcompat for some mysterious reason get $UNIX2003 appended
        to their symbol names and then aren't found in libc at link time(!).

        3) Apply the following patch (which handles 64 bit time_t with 32 bit
           "long"):

==== //depot/equalizer/features/folsom/usr.bin/xinstall/xinstall.c#3 -
/workspaces/features/folsom/usr.bin/xinstall/xinstall.c ====
@@ -1130,7 +1130,8 @@
        if (*type == 'f') /* type=file */
                fprintf(metafp, " size=%lld", (long long)size);
        if (tv != NULL && dopreserve)
-               fprintf(metafp, " time=%ld.%ld", tv[1].tv_sec, tv[1].tv_usec);
+               fprintf(metafp, " time=%lld.%lld", (long long
int)tv[1].tv_sec,
+                                                (long long
int)tv[1].tv_usec);
        if (digestresult && digest)
                fprintf(metafp, " %s=%s", digest, digestresult);
        if (fflags)


Then you'll be darned close to having a working build, except that Apple's
GCC, when invoked with -m32,  throws an internal compiler error while
building the NetBSD tools GCC!

  --- dependall-libgcc ---
  --- _ashldi3.d ---
  --- dependall-libgcc_eh ---
  /Volumes/csfs/workspaces/features/folsom/gnu/dist/gcc4/gcc/unwind-pe.h: In
  function 'read_encoded_value_with_base':
  /Volumes/csfs/workspaces/features/folsom/gnu/dist/gcc4/gcc/unwind-pe.h:273:
  internal compiler error: Bus error
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <URL:http://www.NetBSD.org/Misc/send-pr.html> for instructions.

If anyone can help me work around that, I'd sure appreciate it.

-- 
Thor Lancelot Simon                                    
tls%rek.tjls.com@localhost
  "All of my opinions are consistent, but I cannot present them all
   at once."    -Jean-Jacques Rousseau, On The Social Contract


Home | Main Index | Thread Index | Old Index