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

bootstrap of ghc6 on kfreebsd-amd64



Hello.

I give it another shot. It is now much better, but still does not work.

Attached please find a patch (ghc612.diff)
which should suffice for regular build.
Please include it in debian package anyway.

The bootstrap have been from (linux-)amd64 to kfreebsd-amd64,
build dirs have been the same on both platforms.
I followed instruction at
http://hackage.haskell.org/trac/ghc/wiki/Building/Porting,
the "plat" is x86_64-unknown-kfreebsdgnu.

The used source code have been patched as in debian 6.12.1-2 package
and the attached diff.

The changes against recipe:

Into mk/build.mk on kfreebsd-amd64 also add "-lffi -lncurses" and

--- rts/ghc.mk
+++ rts/ghc.mk
@@ -19,8 +19,7 @@
 # merge GhcLibWays and GhcRTSWays but strip out duplicates
 rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays))

-ALL_RTS_LIBS = $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf)) \
-              rts/dist/build/libHSrtsmain.a
+ALL_RTS_LIBS = rts/dist/build/libHSrtsmain.a $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
 all_rts : $(ALL_RTS_LIBS)

# -----------------------------------------------------------------------------


The problem is in step "check that the bootstrapped compiler is generating working binaries"

./inplace/bin/ghc-stage2 ./hello.hs -o hello
<command line>: does not exist: hello.hs

But the stat syscall succeeded and no open is even tried.

 20169 ghc-stage2 RET   read 0
 20169 ghc-stage2 CALL  close(0x3)
 20169 ghc-stage2 RET   close 0
 20169 ghc-stage2 CALL  stat(0x8050627c0,0x7fffffffe460)
 20169 ghc-stage2 NAMI  "hello.hs"
 20169 ghc-stage2 RET   stat 0
 20169 ghc-stage2 CALL  open(0x804ba7b88,0,0)
 20169 ghc-stage2 NAMI  "/usr/lib/gconv/gconv-modules.cache"
 20169 ghc-stage2 RET   open 3
 20169 ghc-stage2 CALL  fstat(0x3,0x7fffffffe140)
 20169 ghc-stage2 RET   fstat 0
 20169 ghc-stage2 CALL  [477](0,0x65c0,0x1,0x1,0x3,0)
 20169 ghc-stage2 RET   [477] 64684032/0x803db0000
 20169 ghc-stage2 CALL  close(0x3)
 20169 ghc-stage2 RET   close 0
 20169 ghc-stage2 CALL  open(0x460a000,0,0)
 20169 ghc-stage2 NAMI  "/usr/lib/gconv/UTF-32.so"
 20169 ghc-stage2 RET   open 3
 20169 ghc-stage2 CALL  read(0x3,0x7fffffffdb68,0x340)


There is some problem with struct stat mentioned in
http://hackage.haskell.org/trac/ghc/ticket/3472

Please could someone provide fixing recipe ?

Petr

./inplace/bin/ghc-stage2  +RTS --info

 [("GHC RTS", "YES")
 ,("GHC version", "6.12.1")
 ,("RTS way", "rts_v")
 ,("Host platform", "x86_64-unknown-kfreebsdgnu")
 ,("Host architecture", "x86_64")
 ,("Host OS", "kfreebsdgnu")
 ,("Host vendor", "unknown")
 ,("Build platform", "x86_64-unknown-kfreebsdgnu")
 ,("Build architecture", "x86_64")
 ,("Build OS", "kfreebsdgnu")
 ,("Build vendor", "unknown")
 ,("Target platform", "x86_64-unknown-kfreebsdgnu")
 ,("Target architecture", "x86_64")
 ,("Target OS", "kfreebsdgnu")
 ,("Target vendor", "unknown")
 ,("Word size", "64")
 ,("Compiler unregisterised", "YES")
 ,("Tables next to code", "YES")
 ]
diff -ur bd/driver/mangler/ghc-asm.lprl lx/driver/mangler/ghc-asm.lprl
--- bd/driver/mangler/ghc-asm.lprl	2009-12-10 19:11:33.000000000 +0100
+++ lx/driver/mangler/ghc-asm.lprl	2010-01-22 09:06:40.000000000 +0100
@@ -216,7 +216,7 @@
     $T_HDR_vector   = "\.text\n\t\.align 8\n";
 
     #--------------------------------------------------------#
-    } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|dragonfly|netbsd)$/m ) {
+    } elsif ( $TargetPlatform =~ /^x86_64-.*-(linux|openbsd|freebsd|dragonfly|netbsd|kfreebsdgnu)$/m ) {
 
     $T_STABBY       = 0; # 1 iff .stab things (usually if a.out format)
     $T_US           = ''; # _ if symbols have an underscore on the front
Pouze v lx/driver/mangler: ghc-asm.lprl~
diff -ur bd/rts/Linker.c lx/rts/Linker.c
--- bd/rts/Linker.c	2009-12-10 19:11:33.000000000 +0100
+++ lx/rts/Linker.c	2010-01-22 09:09:21.000000000 +0100
@@ -13,8 +13,8 @@
 /* Linux needs _GNU_SOURCE to get RTLD_DEFAULT from <dlfcn.h> and
    MREMAP_MAYMOVE from <sys/mman.h>.
  */
-#ifdef __linux__
-#define _GNU_SOURCE
+#if defined(__linux__) || defined(__GLIBC__)
+#define _GNU_SOURCE 1
 #endif
 
 #include "Rts.h"
@@ -63,12 +63,12 @@
 #include <sys/wait.h>
 #endif
 
-#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
 #define USE_MMAP
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -76,7 +76,7 @@
 
 #endif
 
-#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
 #  define OBJFORMAT_ELF
 #elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
 #  define OBJFORMAT_PEi386
@@ -1410,7 +1410,7 @@
        } else {
            if ((W_)result > 0x80000000) {
                // oops, we were given memory over 2Gb
-#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
+#if defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS)
                // Some platforms require MAP_FIXED.  This is normally
                // a bad idea, because MAP_FIXED will overwrite
                // existing mappings.
Pouze v lx/rts: Linker.c~
diff -ur bd/rts/posix/OSThreads.c lx/rts/posix/OSThreads.c
--- bd/rts/posix/OSThreads.c	2009-12-10 19:11:32.000000000 +0100
+++ lx/rts/posix/OSThreads.c	2010-01-22 09:03:26.000000000 +0100
@@ -7,10 +7,10 @@
  *
  * --------------------------------------------------------------------------*/
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
 /* We want GNU extensions in DEBUG mode for mutex error checking */
 /* We also want the affinity API, which requires _GNU_SOURCE */
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
 #endif
 
 #include "PosixSource.h"
Pouze v lx/rts/posix: OSThreads.c~

Reply to: