Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#7639 closed bug (fixed)

Fix installation issues with cross compiling + honour Stage1Only properly

Reported by: StephenBlackheath Owned by:
Priority: normal Milestone: 7.8.1
Component: Build System Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Installing GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: #7610 Related Tickets:

Description

This patch fixes three problems that occur during a cross compile to embedded Linux (details below):

  1. arm-ldu-linux-gnueabi-ghc-pkg gets a symlink but no wrapper script upon installation, and this causes the installation to break later when it tries to run it.
  1. hp2ps doesn't get the prefix like the other commands do (i.e. arm-ldu-linux-gnueabi-ghc- is missing from the name of the executable). This is just for consistency.
  1. The stage2 compiler is built when Stage1Only is set to YES (though it does not get installed). This makes the build take longer than it needs to.

mk/build.mk:

SplitObjs? = NO
HADDOCK_DOCS = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS = NO
BUILD_DOCBOOK_PDF = NO
INTEGER_LIBRARY = integer-simple
Stage1Only = YES

configure command:

./configure --target=arm-ldu-linux-gnueabi --prefix=/usr/local/ghc-ldu

Attachments (1)

0001-Fix-installation-issues-and-honouring-of-Stage1Only-.patch (2.1 KB) - added by StephenBlackheath 15 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 15 months ago by StephenBlackheath

  • Status changed from new to patch

comment:2 Changed 15 months ago by StephenBlackheath

  • Blocking 7610 added

comment:3 Changed 15 months ago by marlowsd@…

commit b0fad0c580e0dd52d73743a877608af60408ec89

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Thu Jan 31 12:05:03 2013 +0000

    add $(CrossCompilePrefix) to hp2ps (#7639)

 utils/hp2ps/ghc.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

comment:4 Changed 15 months ago by StephenBlackheath

In case it's helpful, with this patch I am suggesting in this ticket...

--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -99,6 +99,7 @@
 utils/ghc-pkg_$(GHC_PKG_DISTDIR)_INSTALL = YES
 utils/ghc-pkg_$(GHC_PKG_DISTDIR)_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
 utils/ghc-pkg_$(GHC_PKG_DISTDIR)_INSTALL_INPLACE = NO
+utils/ghc-pkg_$(GHC_PKG_DISTDIR)_WANT_INSTALLED_WRAPPER = YES
 
 ifeq "$(BootingFromHc)" "YES"
 utils/ghc-pkg_dist-install_OTHER_OBJS += $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_RTS_LIBS) $(libffi_STATIC_LIB)

...if it isn't applied, then this is what I get (latest head, git hash ca5d15a61c45d6ea763872df46efe5c7b33f8186):

blackh@amentet:~/src/ghc-ldu/ghc$ sudo make install
...
...snip...
...
/usr/bin/install -c -m 644  utils/hsc2hs/template-hsc.h "/usr/local/ghc-ldu/lib/ghc-7.7.20130203"
/usr/bin/install -c -m 755 -d "/usr/local/ghc-ldu/bin"
"rm" -f "/usr/local/ghc-ldu/bin/arm-ldu-linux-gnueabi-ghc-pkg"
ln -s arm-ldu-linux-gnueabi-ghc-pkg-7.7.20130203 "/usr/local/ghc-ldu/bin/arm-ldu-linux-gnueabi-ghc-pkg"
/usr/bin/install -c -m 755 -d "/usr/local/ghc-ldu/bin"
"rm" -f                                         "/usr/local/ghc-ldu/bin/arm-ldu-linux-gnueabi-ghc-7.7.20130203"
...
...snip...
...
/usr/local/ghc-ldu/lib/ghc-7.7.20130203/transformers-0.3.0.0
"/usr/local/ghc-ldu/lib/ghc-7.7.20130203/bin/ghc-pkg" --force --global-package-db "/usr/local/ghc-ldu/lib/ghc-7.7.20130203/package.conf.d" update rts/package.conf.install
/bin/sh: /usr/local/ghc-ldu/lib/ghc-7.7.20130203/bin/ghc-pkg: No such file or directory
make[1]: *** [install_packages] Error 127
make: *** [install] Error 2
blackh@amentet:~/src/ghc-ldu/ghc$ ls -l /usr/local/ghc-ldu/bin/
total 8
lrwxrwxrwx 1 root root   38 Feb  4 13:09 arm-ldu-linux-gnueabi-ghc -> arm-ldu-linux-gnueabi-ghc-7.7.20130203
-rwxr-xr-x 1 root root  308 Feb  4 13:09 arm-ldu-linux-gnueabi-ghc-7.7.20130203
lrwxrwxrwx 1 root root   42 Feb  4 13:09 arm-ldu-linux-gnueabi-ghc-pkg -> arm-ldu-linux-gnueabi-ghc-pkg-7.7.20130203
-rwxr-xr-x 1 root root 1113 Feb  4 13:09 arm-ldu-linux-gnueabi-hsc2hs
blackh@amentet:~/src/ghc-ldu/ghc$ 

So, arm-ldu-linux-gnueabi-ghc-pkg is a dangling symlink.

If I then apply the patch, then the wrapper arm-ldu-linux-gnueabi-ghc-pkg-7.7.20130203 gets installed and the problem goes away.

comment:5 Changed 15 months ago by simonmar

  • Difficulty set to Unknown

Ok, a fix for the ghc-pkg issue is coming (I didn't understand the fix, so spent some time looking at it, and I think I've done it in a slightly cleaner way).

Regarding the stage 2 issue, strictly speaking building compiler/stage2 is correct, because it is the ghc package that can be used with the cross-compiler. If you don't want to build it, then setting stage = 1 in your mk/build.mk should disable it.

comment:6 Changed 15 months ago by marlowsd@…

commit 0403da668db740c70c606329021fcfd0164c2573

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Tue Feb 5 12:39:50 2013 +0000

    install ghc-pkg correctly when Stage1Only=YES (#7639)

 utils/ghc-pkg/ghc.mk |   47 +++++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 20 deletions(-)

comment:7 Changed 15 months ago by simonmar

  • Component changed from Compiler to Build System
  • Milestone set to 7.8.1
  • Resolution set to fixed
  • Status changed from patch to closed

comment:8 Changed 15 months ago by StephenBlackheath

Thanks. Will try out 'stage = 1' and add a note to the CrossCompiling? wiki page if it does the trick.

Note: See TracTickets for help on using tickets.