[GHC] #6086: Cross compilation fails using system linker for other architecture binaries

GHC ghc-devs at haskell.org
Sun Sep 14 11:12:27 UTC 2014


#6086: Cross compilation fails using system linker for other architecture binaries
----------------------------------------------+---------------------------
              Reporter:  mtjm                 |            Owner:
                  Type:  bug                  |           Status:  closed
              Priority:  high                 |        Milestone:  7.8.4
             Component:  Build System         |          Version:  7.8.3
            Resolution:  fixed                |         Keywords:
      Operating System:  Linux                |     Architecture:  arm
       Type of failure:  Building GHC failed  |       Difficulty:  Unknown
             Test Case:                       |       Blocked By:
              Blocking:  9421                 |  Related Tickets:
Differential Revisions:                       |
----------------------------------------------+---------------------------

Comment (by cetu86):

 Inside your cross toolchain there is a directory that is literally called
 "sysroot". Inside it you'll find your standard unix root. Looks like this

 {{{
 .
 └── arm-unknown-linux-gnueabi
     ├── arm-unknown-linux-gnueabi
     │   └── sysroot
     │       ├── bin
     │       ├── etc
     │       ├── include
     │       ├── lib
     │       ├── sbin
     │       ├── share
     │       ├── usr
     │       │   ├── bin
     │       │   ├── include --> ncurses.h, curses.h go here
     │       │   ├── lib --> libncurses.a goes here
     │       └── var
 }}}

 If you use ".../sysroot/usr" as prefix everything should go fine. Except
 ncurses puts its header files in a subdirectory "include/ncurses" but ghc
 includes the header file as

 {{{
 #include <ncurses.h>
 }}}
 not as

 {{{
 #include <ncurses/ncurses.h>
 }}}

 What it did was move all files in the ncurses directory one up and create
 a symlink for compatibility. (in case I'd later install something that
 expects ncurses in its original place) Like this:


 {{{
 cd sysroot/usr/inlude/ncurses
 mv * ..
 cd ..
 rmdir ncurses
 ln -s . ncurses
 }}}
 Now I have

 {{{
 daniel at inferno:~/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-
 gnueabi/sysroot/usr/include/ > ls -l ncurs* curs*
 -rw-r--r-- 1 daniel users  6590  9. Sep 12:38 cursesapp.h
 -rw-r--r-- 1 daniel users 27646  9. Sep 12:38 cursesf.h
 -rw-r--r-- 1 daniel users 76252  9. Sep 12:38 curses.h
 -rw-r--r-- 1 daniel users 19518  9. Sep 12:38 cursesm.h
 -rw-r--r-- 1 daniel users  8489  9. Sep 12:38 cursesp.h
 -rw-r--r-- 1 daniel users 49280  9. Sep 12:38 cursesw.h
 -rw-r--r-- 1 daniel users  7312  9. Sep 12:38 cursslk.h
 lrwxrwxrwx 1 daniel users     1  9. Sep 14:19 ncurses -> .
 -rw-r--r-- 1 daniel users  3925  9. Sep 12:38 ncurses_dll.h
 lrwxrwxrwx 1 daniel users     8  9. Sep 12:38 ncurses.h -> curses.h
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6086#comment:25>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list