Cannot have GHC in ARMv6 architecture

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot have GHC in ARMv6 architecture

jmcf125
Hi,

I have tried to have GHC in my Raspberry Pi, got stuck in the issue 7754
(https://ghc.haskell.org/trac/ghc/ticket/7754), since I didn't know
where to pass options to terminfo's configure file, although I did copy
the headers from my Raspberry Pi. I've been using HUGS ever since, as
Arch Linux doesn't have GHC for ARMv6, and deb2targz would not work.

I'm aware I have a phase 0 compiler installed, need to build a phase 1
compiler, and use that to cross-compile GHC itself (I wasn't the 1st
time I tried, couldn't find as much information as now).

I've read the following pages:
https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/RaspberryPi
https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling
https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation
along with quite a few bug reports, and questions on Stack Overflow that
seemed related but really aren't, or that are already exposed in the
tickets mentioned below.

Below,
/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses and
/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses are
directories to which I copied any headers and libraries, respectively,
from my Raspberry Pi.

I'm not sure which libraries I am supposed to point configure at. These
are the headers-libraries combinations I tried:

$ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses --with-curses-libraries=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses && make -j5
(...)
checking for unistd.h... yes
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
configure: error: curses headers could not be found, so this package cannot be built
See `config.log' for more details
libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2
(https://ghc.haskell.org/trac/ghc/ticket/7754)

$ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/usr/include --with-curses-libraries=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses && make -j5
(...)
checking for unistd.h... yes
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for setupterm in -ltinfo... no
checking for setupterm in -lncursesw... no
checking for setupterm in -lncurses... no
checking for setupterm in -lcurses... no
configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
configure: error: curses library not found, so this package cannot be built
See `config.log' for more details
libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2
(https://ghc.haskell.org/trac/ghc/ticket/7281)

$ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/usr/include --with-curses-libraries=/usr/lib && make -j5
<OR>
$ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses --with-curses-libraries=/usr/lib && make -j5
(...)
Configuring terminfo-0.4.0.1...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking for arm-unknown-linux-gnueabihf-gcc...
/home/jmcf125/ghc-raspberry-pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
checking whether the C compiler works... no
configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
configure: error: C compiler cannot create executables
See `config.log' for more details
libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 77
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2

Concerning the last 2, it'd be odd if they worked, how could, say, the
GCC cross-compiler for ARM use x86_64 libraries? I tried them anyway,
since the 1st 2 errors didn't seem to make sense...

Also, options --includedir and --oldincludedir seem to have no effect
(always get issue 7754), and it doesn't matter if I build registarised
or not, the results are the same (registarised, I'm using LLVM 3.6.2-3).

I'm sorry if I'm wasting your time with what to you might seem such a
simple thing, and not real development on GHC, but I don't know where
else to turn to. I'm still learning Haskell, and have never had to
compile compilers before.

Thank you in advance,
João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Karel Gardas

Hi,

I think sysroot option may help you. I wrote something about it for
ARMv8 in the past here:
https://ghcarm.wordpress.com/2014/01/18/unregisterised-ghc-head-build-for-arm64-platform/

Cheers,
Karel

On 09/ 7/15 08:18 PM, [hidden email] wrote:

> Hi,
>
> I have tried to have GHC in my Raspberry Pi, got stuck in the issue 7754
> (https://ghc.haskell.org/trac/ghc/ticket/7754), since I didn't know
> where to pass options to terminfo's configure file, although I did copy
> the headers from my Raspberry Pi. I've been using HUGS ever since, as
> Arch Linux doesn't have GHC for ARMv6, and deb2targz would not work.
>
> I'm aware I have a phase 0 compiler installed, need to build a phase 1
> compiler, and use that to cross-compile GHC itself (I wasn't the 1st
> time I tried, couldn't find as much information as now).
>
> I've read the following pages:
> https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/RaspberryPi
> https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling
> https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation
> along with quite a few bug reports, and questions on Stack Overflow that
> seemed related but really aren't, or that are already exposed in the
> tickets mentioned below.
>
> Below,
> /home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses and
> /home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses are
> directories to which I copied any headers and libraries, respectively,
> from my Raspberry Pi.
>
> I'm not sure which libraries I am supposed to point configure at. These
> are the headers-libraries combinations I tried:
>
> $ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses --with-curses-libraries=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses && make -j5
> (...)
> checking for unistd.h... yes
> checking ncurses.h usability... no
> checking ncurses.h presence... no
> checking for ncurses.h... no
> checking curses.h usability... no
> checking curses.h presence... no
> checking for curses.h... no
> configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
> configure: error: curses headers could not be found, so this package cannot be built
> See `config.log' for more details
> libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
> make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
> Makefile:71: recipe for target 'all' failed
> make: *** [all] Error 2
> (https://ghc.haskell.org/trac/ghc/ticket/7754)
>
> $ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/usr/include --with-curses-libraries=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/lib-curses && make -j5
> (...)
> checking for unistd.h... yes
> checking ncurses.h usability... yes
> checking ncurses.h presence... yes
> checking for ncurses.h... yes
> checking for setupterm in -ltinfo... no
> checking for setupterm in -lncursesw... no
> checking for setupterm in -lncurses... no
> checking for setupterm in -lcurses... no
> configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
> configure: error: curses library not found, so this package cannot be built
> See `config.log' for more details
> libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
> make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
> Makefile:71: recipe for target 'all' failed
> make: *** [all] Error 2
> (https://ghc.haskell.org/trac/ghc/ticket/7281)
>
> $ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/usr/include --with-curses-libraries=/usr/lib && make -j5
> <OR>
> $ ./configure --target=arm-linux-gnueabihf --with-curses-includes=/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo/include-curses --with-curses-libraries=/usr/lib && make -j5
> (...)
> Configuring terminfo-0.4.0.1...
> configure: WARNING: unrecognized options: --with-compiler, --with-gcc
> checking for arm-unknown-linux-gnueabihf-gcc...
> /home/jmcf125/ghc-raspberry-pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
> checking whether the C compiler works... no
> configure: error: in `/home/jmcf125/ghc-raspberry-pi/ghc/libraries/terminfo':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
> libraries/terminfo/ghc.mk:4: recipe for target 'libraries/terminfo/dist-install/package-data.mk' failed
> make[1]: *** [libraries/terminfo/dist-install/package-data.mk] Error 77
> Makefile:71: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Concerning the last 2, it'd be odd if they worked, how could, say, the
> GCC cross-compiler for ARM use x86_64 libraries? I tried them anyway,
> since the 1st 2 errors didn't seem to make sense...
>
> Also, options --includedir and --oldincludedir seem to have no effect
> (always get issue 7754), and it doesn't matter if I build registarised
> or not, the results are the same (registarised, I'm using LLVM 3.6.2-3).
>
> I'm sorry if I'm wasting your time with what to you might seem such a
> simple thing, and not real development on GHC, but I don't know where
> else to turn to. I'm still learning Haskell, and have never had to
> compile compilers before.
>
> Thank you in advance,
> João Miguel
> _______________________________________________
> ghc-devs mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
Hi, sorry for not sending a CC to the mailing list, works differently
from others I've used

> >  $ ls -R /home/jmcf125/ghc-raspberry-pi/sysroot/*
> >/home/jmcf125/ghc-raspberry-pi/sysroot/lib:
> >libcursesw.so  libncurses.so  libncurses++.so  libncurses.so.5@  libncurses.so.5.9*  libncursesw.so@  libncursesw.so.5@  libncursesw.so.5.9*
> >
> >/home/jmcf125/ghc-raspberry-pi/sysroot/usr:
> >include/
> >
> >/home/jmcf125/ghc-raspberry-pi/sysroot/usr/include:
> >cursesapp.h  cursesf.h  curses.h  cursesm.h  cursesp.h  cursesw.h  cursslk.h  ncurses_dll.h  ncurses.h@  slcurses.h
>
>
> This is misunderstadning, you need whole sysroot package for ARMv6. That
> means basically copy whole / or just google for it.
>
> The reason is simple curses headers include another headers and those will
> not be available in your way. Ditto for libs which depends at least on libc.

That was actually just the 1st thing I tried, then as I said:
> >I also tried extracting the ncurses official package for ARMv6 itself to
> >sysroot, and got another error message, where the compiler did work. I
> >begun to wonder whether I need a full ARMv6 system in sysroot to make
> >this work, and as my Raspberry Pi is on an external hard drive, I
> >mounted it on /mnt/jrpi, and changed the --sysroot option to it.
> >Finally, configure worked!

So, when doing that, configure works (the logs were for the previous
attempts). But why is that when I try to make, with a working configure,
and a real sysroot, that I get the following error?

> > $ make -j5
> >(...)
> >"inplace/bin/mkdirhier" compiler/stage2/doc/html/ghc//.
> ><<ghc: 13398192 bytes, 14 GCs, 190152/210488 avg/max bytes residency (2 samples), 26M in use, 0.000 INIT (0.000 elapsed), 0.016 MUT (0.257 elapsed), 0.015 GC (0.020 elapsed) :ghc>>
> >"inplace/bin/mkdirhier" utils/hsc2hs/dist-install/build/tmp//.
> >"inplace/bin/mkdirhier" utils/ghc-pkg/dist-install/build/tmp//.
> >"inplace/bin/mkdirhier" utils/ghctags/dist-install/build/tmp//.
> ><<ghc: 13396968 bytes, 14 GCs, 190128/210440 avg/max bytes residency (2 samples), 26M in use, 0.000 INIT (0.000 elapsed), 0.015 MUT (0.213 elapsed), 0.014 GC (0.017 elapsed) :ghc>>
> >"inplace/bin/mkdirhier" utils/ghc-pwd/dist-install/build/tmp//.
> >"inplace/bin/mkdirhier" utils/ghc-cabal/dist-install/build/tmp//.
> >"inplace/bin/mkdirhier" utils/hpc/dist-install/build/tmp//.
> >"inplace/bin/mkdirhier" utils/runghc/dist-install/build/tmp//.
> >docs/users_guide/users_guide.xml
> >make[1]: docs/users_guide/users_guide.xml: Command not found
> >docs/users_guide/what_glasgow_exts_does.gen.xml
> >docs/users_guide/ghc.mk:24: recipe for target 'docs/users_guide/users_guide.xml' failed
> >make[1]: *** [docs/users_guide/users_guide.xml] Error 127
> >make[1]: *** Waiting for unfinished jobs....
> >make[1]: docs/users_guide/what_glasgow_exts_does.gen.xml: Command not found
> >docs/users_guide/ghc.mk:24: recipe for target 'docs/users_guide/what_glasgow_exts_does.gen.xml' failed
> >make[1]: *** [docs/users_guide/what_glasgow_exts_does.gen.xml] Error 127
> >Writing utils/haddock/doc/haddock/license.html for section(license)
> >Writing utils/haddock/doc/haddock/ch01s03.html for section
> >Writing utils/haddock/doc/haddock/ch01s04.html for section
> >Writing utils/haddock/doc/haddock/introduction.html for chapter(introduction)
> >Writing utils/haddock/doc/haddock/invoking.html for chapter(invoking)
> >Writing utils/haddock/doc/haddock/ch03s02.html for section
> >Writing utils/haddock/doc/haddock/ch03s03.html for section
> >Writing utils/haddock/doc/haddock/ch03s04.html for section
> >Writing utils/haddock/doc/haddock/ch03s05.html for section
> >Writing utils/haddock/doc/haddock/hyperlinking.html for section(hyperlinking)
> >Writing utils/haddock/doc/haddock/module-attributes.html for section(module-attributes)
> >Writing utils/haddock/doc/haddock/ch03s08.html for section
> >Writing utils/haddock/doc/haddock/markup.html for chapter(markup)
> >Writing utils/haddock/doc/haddock/ix01.html for index
> >Writing utils/haddock/doc/haddock/index.html for book(haddock)
> >cp mk/fptools.css utils/haddock/doc/haddock/
> >Makefile:71: recipe for target 'all' failed
> >make: *** [all] Error 2

ghc-stage1 logically does not work, although it is created.

I hope this is clearer. Cheers,
João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Karel Gardas
On 09/ 9/15 01:22 PM, [hidden email] wrote:

> So, when doing that, configure works (the logs were for the previous
> attempts). But why is that when I try to make, with a working configure,
> and a real sysroot, that I get the following error?
>>> $ make -j5
>>> (...)
>>> "inplace/bin/mkdirhier" compiler/stage2/doc/html/ghc//.
>>> <<ghc: 13398192 bytes, 14 GCs, 190152/210488 avg/max bytes residency (2 samples), 26M in use, 0.000 INIT (0.000 elapsed), 0.016 MUT (0.257 elapsed), 0.015 GC (0.020 elapsed) :ghc>>
>>> "inplace/bin/mkdirhier" utils/hsc2hs/dist-install/build/tmp//.
>>> "inplace/bin/mkdirhier" utils/ghc-pkg/dist-install/build/tmp//.
>>> "inplace/bin/mkdirhier" utils/ghctags/dist-install/build/tmp//.
>>> <<ghc: 13396968 bytes, 14 GCs, 190128/210440 avg/max bytes residency (2 samples), 26M in use, 0.000 INIT (0.000 elapsed), 0.015 MUT (0.213 elapsed), 0.014 GC (0.017 elapsed) :ghc>>
>>> "inplace/bin/mkdirhier" utils/ghc-pwd/dist-install/build/tmp//.
>>> "inplace/bin/mkdirhier" utils/ghc-cabal/dist-install/build/tmp//.
>>> "inplace/bin/mkdirhier" utils/hpc/dist-install/build/tmp//.
>>> "inplace/bin/mkdirhier" utils/runghc/dist-install/build/tmp//.
>>> docs/users_guide/users_guide.xml
>>> make[1]: docs/users_guide/users_guide.xml: Command not found
>>> docs/users_guide/what_glasgow_exts_does.gen.xml
>>> docs/users_guide/ghc.mk:24: recipe for target 'docs/users_guide/users_guide.xml' failed
>>> make[1]: *** [docs/users_guide/users_guide.xml] Error 127
>>> make[1]: *** Waiting for unfinished jobs....
>>> make[1]: docs/users_guide/what_glasgow_exts_does.gen.xml: Command not found
>>> docs/users_guide/ghc.mk:24: recipe for target 'docs/users_guide/what_glasgow_exts_does.gen.xml' failed
>>> make[1]: *** [docs/users_guide/what_glasgow_exts_does.gen.xml] Error 127
>>> Writing utils/haddock/doc/haddock/license.html for section(license)
>>> Writing utils/haddock/doc/haddock/ch01s03.html for section
>>> Writing utils/haddock/doc/haddock/ch01s04.html for section
>>> Writing utils/haddock/doc/haddock/introduction.html for chapter(introduction)
>>> Writing utils/haddock/doc/haddock/invoking.html for chapter(invoking)
>>> Writing utils/haddock/doc/haddock/ch03s02.html for section
>>> Writing utils/haddock/doc/haddock/ch03s03.html for section
>>> Writing utils/haddock/doc/haddock/ch03s04.html for section
>>> Writing utils/haddock/doc/haddock/ch03s05.html for section
>>> Writing utils/haddock/doc/haddock/hyperlinking.html for section(hyperlinking)
>>> Writing utils/haddock/doc/haddock/module-attributes.html for section(module-attributes)
>>> Writing utils/haddock/doc/haddock/ch03s08.html for section
>>> Writing utils/haddock/doc/haddock/markup.html for chapter(markup)
>>> Writing utils/haddock/doc/haddock/ix01.html for index
>>> Writing utils/haddock/doc/haddock/index.html for book(haddock)
>>> cp mk/fptools.css utils/haddock/doc/haddock/
>>> Makefile:71: recipe for target 'all' failed
>>> make: *** [all] Error 2
>
> ghc-stage1 logically does not work, although it is created.

How exactly ghc-stage1 behaves? What does ghc-stage1 --info tells you?

Karel

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
> How exactly ghc-stage1 behaves? What does ghc-stage1 --info tells you?
 $ ../inplace/bin/ghc-stage1 --make HelloWorld.lhs

HelloWorld.lhs:1:1:
    Could not find module ‘Prelude’
    There are files missing in the ‘base-4.8.1.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.

 $ ../inplace/bin/ghc-pkg check -v >ghc-pkg.check.log  2>&1

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

HelloWorld.lhs (103 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
> How exactly ghc-stage1 behaves? What does ghc-stage1 --info tells you?
Again, sorry, I really thought I included this.

 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv")
 ,("C compiler command","arm-linux-gnueabihf-gcc-sysroot")
 ,("C compiler flags"," -fno-stack-protector")
 ,("C compiler link flags"," -fuse-ld=gold -Wl,-z,noexecstack")
 ,("Haskell CPP command","arm-linux-gnueabihf-gcc-sysroot")
 ,("Haskell CPP flags","-E -undef -traditional ")
 ,("ld command","/home/jmcf125/ghc-raspberry-pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ld.gold")
 ,("ld flags"," -z noexecstack")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","YES")
 ,("ld supports filelist","NO")
 ,("ld is GNU ld","YES")
 ,("ar command","/home/jmcf125/ghc-raspberry-pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("perl command","/usr/bin/perl")
 ,("cross compiling","YES")
 ,("target os","OSLinux")
 ,("target arch","ArchARM {armISA = ARMv6, armISAExt = [VFPv2], armABI = HARD}")
 ,("target word size","4")
 ,("target has GNU nonexec stack","False")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","False")
 ,("Unregisterised","NO")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("Project version","7.10.2")
 ,("Project Git commit id","0da488c4438d88c9252e0b860426b8e74b5fc9e8")
 ,("Booter version","7.10.1")
 ,("Stage","1")
 ,("Build platform","x86_64-unknown-linux")
 ,("Host platform","x86_64-unknown-linux")
 ,("Target platform","arm-unknown-linux")
 ,("Have interpreter","YES")
 ,("Object splitting supported","NO")
 ,("Have native code generator","NO")
 ,("Support SMP","YES")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug thr thr_debug thr_l  ")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Uses package keys","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","NO")
 ,("Leading underscore","NO")
 ,("Debug on","False")
 ,("LibDir","/home/jmcf125/ghc-raspberry-pi/ghc/inplace/lib")
 ,("Global Package DB","/home/jmcf125/ghc-raspberry-pi/ghc/inplace/lib/package.conf.d")
 ]
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Karel Gardas
In reply to this post by jmcf125

So ghc-stage1 is working. Good! Now just to find why your base is
broken, please rebuild ghc completely and this time does not use any -j
5 option. It'll use just one core, but will stop on the first error.
Let's see how far you get.

Karel

On 09/ 9/15 02:59 PM, [hidden email] wrote:

>> How exactly ghc-stage1 behaves? What does ghc-stage1 --info tells you?
>   $ ../inplace/bin/ghc-stage1 --make HelloWorld.lhs
>
> HelloWorld.lhs:1:1:
>      Could not find module ‘Prelude’
>      There are files missing in the ‘base-4.8.1.0’ package,
>      try running 'ghc-pkg check'.
>      Use -v to see a list of the files searched for.
>
>   $ ../inplace/bin/ghc-pkg check -v >ghc-pkg.check.log  2>&1
>

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
> So ghc-stage1 is working. Good! Now just to find why your base is broken,
> please rebuild ghc completely and this time does not use any -j 5 option.
> It'll use just one core, but will stop on the first error. Let's see how far
> you get.
Ah. Alright, it took a while longer.

 $ ./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc-sysroot --enable-unregisterised && make
(...)
"inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -this-package-key ghcpr_8TmvWUcS1U1IKHT0levwg3 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/.    -optP-include -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package-key rts -this-package-key ghc-prim -XHaskell2010 -O -fllvm  -no-user-package-db -rtsopts      -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build   -c libraries/ghc-prim/./GHC/CString.hs -o libraries/ghc-prim/dist-install/build/GHC/CString.o
You are using a new version of LLVM that hasn't been tested yet!
We will try though...
opt: /tmp/ghc23881_0/ghc_1.ll:7:6: error: unexpected type in metadata definition
!0 = metadata !{metadata !"top", i8* null}
     ^
libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/CString.o' failed
make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/CString.o] Error 1
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2

This is weird, I think I'm not even using LLVM.

Before this, there were loads of things like these:
/tmp/ghc23862_0/ghc_2.hc:1528:30:
     warning: function called through a non-compatible type [enabled by default]
     ((void (*)(void *))(W_)&barf)((void *)(W_)&c7G_str);;
                                  ^

/tmp/ghc23862_0/ghc_2.hc:1528:30:
     note: if this code is reached, the program will abort


João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Karel Gardas
On 09/ 9/15 04:21 PM, [hidden email] wrote:

>> So ghc-stage1 is working. Good! Now just to find why your base is broken,
>> please rebuild ghc completely and this time does not use any -j 5 option.
>> It'll use just one core, but will stop on the first error. Let's see how far
>> you get.
> Ah. Alright, it took a while longer.
>
>   $ ./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc-sysroot --enable-unregisterised && make
> (...)
> "inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -this-package-key ghcpr_8TmvWUcS1U1IKHT0levwg3 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/.    -optP-include -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package-key rts -this-package-key ghc-prim -XHaskell2010 -O -fllvm  -no-user-package-db -rtsopts      -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build   -c libraries/ghc-prim/./GHC/CString.hs -o libraries/ghc-prim/dist-install/build/GHC/CString.o
> You are using a new version of LLVM that hasn't been tested yet!
> We will try though...

^ OK you can see this.

> opt: /tmp/ghc23881_0/ghc_1.ll:7:6: error: unexpected type in metadata definition
> !0 = metadata !{metadata !"top", i8* null}
>       ^
> libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/CString.o' failed
> make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/CString.o] Error 1
> Makefile:71: recipe for target 'all' failed
> make: *** [all] Error 2
>
> This is weird, I think I'm not even using LLVM.

This is not weird at all! GHC does not provide ARM NCG and so it is
using LLVM if you compile ARM registerised build.

So what about to start with the least pain and install supported LLVM
version?

Cheers,
Karel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Reid Barton-2
On Wed, Sep 9, 2015 at 11:46 AM, Karel Gardas <[hidden email]> wrote:
On 09/ 9/15 04:21 PM, [hidden email] wrote:
So ghc-stage1 is working. Good! Now just to find why your base is broken,
please rebuild ghc completely and this time does not use any -j 5 option.
It'll use just one core, but will stop on the first error. Let's see how far
you get.
Ah. Alright, it took a while longer.

  $ ./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc-sysroot --enable-unregisterised && make
(...)
"inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -this-package-key ghcpr_8TmvWUcS1U1IKHT0levwg3 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/.    -optP-include -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package-key rts -this-package-key ghc-prim -XHaskell2010 -O -fllvm  -no-user-package-db -rtsopts      -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build   -c libraries/ghc-prim/./GHC/CString.hs -o libraries/ghc-prim/dist-install/build/GHC/CString.o
You are using a new version of LLVM that hasn't been tested yet!
We will try though...

^ OK you can see this.

opt: /tmp/ghc23881_0/ghc_1.ll:7:6: error: unexpected type in metadata definition
!0 = metadata !{metadata !"top", i8* null}
      ^
libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/build/GHC/CString.o' failed
make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/CString.o] Error 1
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2

This is weird, I think I'm not even using LLVM.

This is not weird at all! GHC does not provide ARM NCG and so it is using LLVM if you compile ARM registerised build.

But "./configure [...] --enable-unregisterised" should mean using the C backend, not LLVM, right? So this still looks strange. Also there is an explicit "-fllvm" on the failing ghc-stage1 command line.

What is in your build.mk? Maybe you are using one of the build flavors that sets -fllvm explicitly?

That said you can also try installing the supported version of LLVM for ghc 7.10, which is LLVM 3.5.

Regards,
Reid Barton

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

Karel Gardas
On 09/ 9/15 05:59 PM, Reid Barton wrote:
>     This is not weird at all! GHC does not provide ARM NCG and so it is
>     using LLVM if you compile ARM registerised build.
>
>
> But "./configure [...] --enable-unregisterised" should mean using the C
> backend, not LLVM, right? So this still looks strange. Also there is an
> explicit "-fllvm" on the failing ghc-stage1 command line.

Indeed, I've overlooked that completely and I was referring to previous
info of `ghc --info' where it's clearly registerised:

  ,("Unregisterised","NO")
  ,("LLVM llc command","llc")
  ,("LLVM opt command","opt")
  ,("Project version","7.10.2")
  ,("Project Git commit id","0da488c4438d88c9252e0b860426b8e74b5fc9e8")
  ,("Booter version","7.10.1")
  ,("Stage","1")
  ,("Build platform","x86_64-unknown-linux")
  ,("Host platform","x86_64-unknown-linux")
  ,("Target platform","arm-unknown-linux")


Karel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
In reply to this post by Reid Barton-2
Okay, I tried with LLVM registerised, I've read about it and the idea sounds nice.

> What is in your build.mk? Maybe you are using one of the build flavors that
> sets -fllvm explicitly?
Ah, so that was it. I followed Karel's blog, seems back then the
BuildFlavour = quick-cross option he used didn't include LLVM, which makes
sense, since there was no support. Now, the option is there, as you suspected:

ifeq "$(BuildFlavour)" "quick-cross"
(...)
GhcStage2HcOpts    = -O0 -fllvm
GhcLibHcOpts       = -O -fllvm
(...)

>
> That said you can also try installing the supported version of LLVM for ghc
> 7.10, which is LLVM 3.5.
Good that it was still in Arch Linux repos, as llvm35. All went fine
through stage 1, now ghc-stage1 works, and I mean:
 $ ../inplace/bin/ghc-stage1 --make HelloWorld.lhs
[1 of 1] Compiling Main             ( HelloWorld.lhs, HelloWorld.o )
Linking HelloWorld ...

But I still got an error in the end (using make with only one core costed me a
few hours...):
(...)
echo 'exec "$executablename" ${1+"$@"}'                     >> inplace/bin/dll-split
chmod +x                                                     inplace/bin/dll-split
inplace/bin/dll-split compiler/stage2/build/.depend-v-dyn.haskell "DynFlags" "Annotations ApiAnnotation Avail Bag BasicTypes Binary BooleanFormula BreakArray BufWrite Class CmdLineParser CmmType CoAxiom ConLike Coercion Config Constants CoreArity CoreFVs CoreSubst CoreSyn CoreTidy CoreUnfold CoreUtils CostCentre Ctype DataCon Demand Digraph DriverPhases DynFlags Encoding ErrUtils Exception ExtsCompat46 FamInstEnv FastFunctions FastMutInt FastString FastTypes Fingerprint FiniteMap ForeignCall Hooks HsBinds HsDecls HsDoc HsExpr HsImpExp HsLit PlaceHolder HsPat HsSyn HsTypes HsUtils HscTypes IOEnv Id IdInfo IfaceSyn IfaceType InstEnv Kind Lexeme Lexer ListSetOps Literal Maybes MkCore MkId Module MonadUtils Name NameEnv NameSet OccName OccurAnal OptCoercion OrdList Outputable PackageConfig Packages Pair Panic PatSyn PipelineMonad Platform PlatformConstants PprCore PrelNames PrelRules Pretty PrimOp RdrName Rules Serialized SrcLoc StaticFlags StringBuffer TcEvidence TcRnTypes TcType TrieMap TyCon Type TypeRep TysPrim TysWiredIn Unify UniqFM UniqSet UniqSupply Unique Util Var VarEnv VarSet Bitmap BlockId ByteCodeAsm ByteCodeInstr ByteCodeItbls CLabel Cmm CmmCallConv CmmExpr CmmInfo CmmMachOp CmmNode CmmUtils CodeGen.Platform CodeGen.Platform.ARM CodeGen.Platform.ARM64 CodeGen.Platform.NoRegs CodeGen.Platform.PPC CodeGen.Platform.PPC_Darwin CodeGen.Platform.SPARC CodeGen.Platform.X86 CodeGen.Platform.X86_64 FastBool Hoopl Hoopl.Dataflow InteractiveEvalTypes MkGraph PprCmm PprCmmDecl PprCmmExpr Reg RegClass SMRep StgCmmArgRep StgCmmClosure StgCmmEnv StgCmmLayout StgCmmMonad StgCmmProf StgCmmTicky StgCmmUtils StgSyn Stream"
inplace/bin/dll-split: line 8: /home/jmcf125/ghc-raspberry-pi/ghc/inplace/lib/bin/dll-split: cannot execute binary file: Exec format error
inplace/bin/dll-split: line 8: /home/jmcf125/ghc-raspberry-pi/ghc/inplace/lib/bin/dll-split: Success
compiler/ghc.mk:655: recipe for target 'compiler/stage2/dll-split.stamp' failed
make[1]: *** [compiler/stage2/dll-split.stamp] Error 126
Makefile:71: recipe for target 'all' failed
make: *** [all] Error 2

OK, it did try to get to stage 2, as I thought it would. Is dll-split trying to
execute a stage 2 binary? Why? What's going on?

Thanks for the help so far,
João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
Now I think of it, the blog post was about getting stage 1. I did. So
that's what the cross-compile option is supposed to do, right? But why
does it give an error instead of just stopping in stage 1? To get both
stages, what option should I use? Should I just remove mk/build.mk?

Best regards,
João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Cannot have GHC in ARMv6 architecture

jmcf125
Hello again,

I still can't get the stage 2 binary, as previous messages show. Should
I manually use the stage 1 compiler to do it, along with GCC
cross-compiler, etc.? Because the page
https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/RaspberryPi
says that «The build should go successfully all the way to stage 2». Why
isn't it?

Hoping you can continue to help me. All the best,
João Miguel
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs