Opened 19 months ago

Last modified 13 months ago

#8378 new bug

Cross-compiling from x86_64-unknown-linux-gnu to x86_64-sun-solaris2 with mkGmpConstants workaround fails to build objects for integer-gmp

Reported by: AlainODea Owned by:
Priority: normal Milestone:
Component: Build System Version:
Keywords: solaris, integer-gmp Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: 8373,8366,8361 Differential Revisions:

Description

Here is the script I used to get build dependencies:

sudo apt-get update
sudo apt-get install --assume-yes ghc libncurses5-dev \
  mesa-common-dev freeglut3-dev libedit-dev
cabal install happy alex haddock

Here is the build bootstrap script I am using on a clean Ubuntu 13.04 install:

#!/bin/bash
export TARGET=x86_64-sun-solaris2.11
export PREFIX=$HOME/Documents/gcc/cross/$TARGET
export SYSROOT=$PREFIX/sysroot
export PATH=$PATH:$PREFIX/bin

export GCC=$PREFIX/bin/$TARGET-gcc
export LD=$PREFIX/bin/$TARGET-ld
export NM=$PREFIX/bin/$TARGET-nm
export OBJDUMP=$PREFIX/bin/$TARGET-objdump

git clone git://github.com/ghc/ghc
pushd ghc
echo "Stage1Only = YES" >> mk/build.mk
cp mk/build.mk{.sample,}
./sync-all --no-dph get
perl boot
patch -d libraries/haskeline/ -p1 < \
  ../ghc-patches/0001-Include-termios.h-for-solaris2-host.-Fixes-8366.patch
cp $SYSROOT/opt/local/include/gmp.h libraries/integer-gmp/gmp/
./configure \
  --host=x86_64-unknown-linux-gnu \
  --build=x86_64-unknown-linux-gnu \
  --target=x86_64-sun-solaris2 \
  --with-gcc=$GCC \
  --with-ld=$LD \
  --with-nm=$NM \
  --with-objdump=$OBJDUMP
make
# will fail with failure to run mkGmpDerivedConstants
scp inplace/lib/bin/mkGmpDerivedConstants root@ns2:.
ssh root@ns2 "./mkGmpDerivedConstants" > \
  libraries/integer-gmp/mkGmpDerivedConstants/dist/GmpDerivedConstants.h
make
cat << __EOF__ >> libraries/base/include/HsBaseConfig.h
#define HTYPE_DOUBLE Double
#define HTYPE_FLOAT Float
__EOF__
make
#make -j $(nproc)
popd

The log of the run is attached. It is too large for the ticket body and apparently too large for Gist as well.

Somewhere along the way the build forgets integer-gmp and no objects are built for it.

Attachments (1)

cross_ghc.log.gz (150.9 KB) - added by AlainODea 19 months ago.
Log of build bootstrap and GHC build within it including the integer-gmp objects failure

Download all attachments as: .zip

Change History (4)

Changed 19 months ago by AlainODea

Log of build bootstrap and GHC build within it including the integer-gmp objects failure

comment:1 Changed 19 months ago by AlainODea

Here are the "WARNING" messages from the log.

This seems likely to be problematic, not sure what I've done wrong with it:

checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... ranlib
configure: WARNING: using cross tools not prefixed with host triplet

This seems to be mostly harmless, but I can work around it by install packages with xmllint, xsltproc, and dblatex on my build system:

checking for xmllint... no
configure: WARNING: cannot find xmllint in your PATH, you will not be able to validate your documentation
checking for xsltproc... no
configure: WARNING: cannot find xsltproc in your PATH, you will not be able to build the HTML documentation
checking for dblatex... no
configure: WARNING: cannot find dblatex in your PATH, you will not be able to build the PDF and PS documentation

This suggests that I need to include more in my $SYSROOT for my cross-compiler:

checking nlist.h presence... no
configure: WARNING: nlist.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: nlist.h: proceeding with the compiler's result

This is a fallback I guess:

checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation

This looks very problematic:

checking sys/eventfd.h presence... yes
configure: WARNING: sys/eventfd.h: present but cannot be compiled
configure: WARNING: sys/eventfd.h:     check for missing prerequisite headers?
configure: WARNING: sys/eventfd.h: see the Autoconf documentation
configure: WARNING: sys/eventfd.h:     section "Present But Cannot Be Compiled"
configure: WARNING: sys/eventfd.h: proceeding with the compiler's result
configure: WARNING:     ## ----------------------------------------------- ##
configure: WARNING:     ## Report this to [email protected] ##
configure: WARNING:     ## ----------------------------------------------- ##

This is potentially the cause of #8366:

Configuring terminfo-0.3.2.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
config.status: creating terminfo.buildinfo
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Configuring integer-gmp-0.5.1.0...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
config.status: creating integer-gmp.buildinfo
config.status: creating gmp/config.mk
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Configuring base-4.7.0.0...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
configure: creating ./config.status
config.status: creating base.buildinfo
config.status: creating include/HsBaseConfig.h
config.status: creating include/EventConfig.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Configuring unix-2.7.0.0...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
configure: creating ./config.status
config.status: creating unix.buildinfo
config.status: creating include/HsUnixConfig.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Configuring directory-1.2.0.1...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc

Lots more of those.

comment:2 Changed 19 months ago by AlainODea

Also of interest:

configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used

comment:3 Changed 13 months ago by kgardas

As dyson OS is still not using GNU LibC, I guess it is very similar from ABI point of view to Solaris. Perhaps it may be good to start with hacking on Solaris then? See #8910 for first attempt of crosscompiling from i386 solaris to amd64 solaris...

Note: See TracTickets for help on using tickets.