all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikita Karetnikov <nikita@karetnikov.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: bug-guix@gnu.org
Subject: Re: Cross-building GHC
Date: Thu, 16 May 2013 12:04:58 +0400	[thread overview]
Message-ID: <87sj1nnydx.fsf@karetnikov.org> (raw)
In-Reply-To: 8738vxh8ld.fsf@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3785 bytes --]

I said that "you have to run './configure && make && make install &&
make clean' [...] to build the Stage 1 compiler." [1]  This is not
correct:

1. It seems that mips64el is not supported.  So it's necessary to port
   [2] GHC.

2. './configure && make && make install' build the Stage 2 (final)
   compiler, not Stage 1.

I've tried to port through .hc files (as described here [2]).

First I installed the cross-compiler to my profile and ran the following
commands:

# export CPATH="/root/.guix-profile/include"
# export LIBRARY_PATH="/root/.guix-profile/lib"
# export C_INCLUDE_PATH=/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include

# ln -s /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/lib/crt1.o /nix/store/x4j44am492nnajlwja1c7gs2ikqkdff4-gcc-cross-mips64el-linux-gnu-4.7.3/lib/gcc/mips64el-linux-gnu/4.7.3/crt1.o
# ln -s /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/lib/crti.o /nix/store/x4j44am492nnajlwja1c7gs2ikqkdff4-gcc-cross-mips64el-linux-gnu-4.7.3/lib/gcc/mips64el-linux-gnu/4.7.3/crti.o
# ln -s /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/lib/crtn.o /nix/store/x4j44am492nnajlwja1c7gs2ikqkdff4-gcc-cross-mips64el-linux-gnu-4.7.3/lib/gcc/mips64el-linux-gnu/4.7.3/crtn.o

These symlinks are needed because CROSS_LIBRARY_PATH doesn't work.

I tested the above using a simple C program:

#include<stdio.h>

main()
{
    printf("Hello World");
}

'mips64el-linux-gnu-gcc test.c' didn't return any errors.

After that I unpacked 'ghc-7.6.3-src.tar.bz2' to 'T'.  And replaced
'$GHC_PACKAGE_DB_FLAG' with 'package-db' in 'configure' because it
failed otherwise.

Then I ran these commands:

T# cp /bin/pwd utils/ghc-pwd/ghc-pwd
T# perl boot
T# ./configure --enable-hc-boot --target=mips64el-linux-gnu

'configure' returned lots of errors:

[...]

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/bits/types.h:128:3:
     error: #error 

In file included from /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/bits/byteswap.h:27:0:
    0,
                     from /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/endian.h:60,
                     from /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/bits/waitstatus.h:64,
                     from /nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/stdlib.h:42,
                     from /usr/local/lib/ghc-7.6.3/include/Rts.h:190,
                     from /tmp/ghc6782_0/ghc6782_0.c:1:

[...]

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/bits/types.h:133:1:
     error: unknown type name '__STD_TYPE'

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/bits/types.h:133:25:
     error: expected '=', ',', ';', 'asm' or '__attribute__' before '__dev_t'

[...]

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/stdio.h:678:1:
     error: unknown type name '__ssize_t'

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/stdio.h:781:12:
     error: unknown type name '__off64_t'

/nix/store/xisav2mcispg63ns8w9x5blvd14gyrd7-glibc-cross-mips64el-linux-gnu-2.17/include/stdio.h:784:1:
     error: unknown type name '__off64_t'
configure: error: Building ghc-pwd failed

Is anything wrong with environment variables?

[1] https://lists.gnu.org/archive/html/bug-guix/2013-03/msg00048.html
[2] http://hackage.haskell.org/trac/ghc/wiki/Building/Porting

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2013-05-16  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 12:23 Cross-building GHC Nikita Karetnikov
2013-03-14 17:32 ` Ludovic Courtès
2013-03-14 19:12   ` Nikita Karetnikov
2013-03-14 23:20     ` Ludovic Courtès
2013-05-16  8:04       ` Nikita Karetnikov [this message]
2013-05-16 18:16         ` Ludovic Courtès
2013-05-17  4:03           ` Nikita Karetnikov
2013-05-17 13:31             ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sj1nnydx.fsf@karetnikov.org \
    --to=nikita@karetnikov.org \
    --cc=bug-guix@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.