Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cross compile ghc curses not found

I tried to crosscompile from linux i386 to arm-linux-gnueabihf, but i cant make it happen, because it gives me this weird error while running 'make':

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/edi/ghc_cross/ghc/libraries/terminfo':
configure: error: curses library not found, so this package cannot be built
See 'config.log' for more details
make[2]: *** [libraries/terminfo/dist-install/package-data.mk] Error 1
make[1]: *** [all_libraries/terminfo] Error 2
make[1]: Leave Directory '/home/edi/ghc_cross/ghc'
make: *** [all] Error 2

What have i done:

-) Compiled 7.8.0 from github (The log says 'That should have been 7.8.0', i chose 7.8 because i thought it would be more stable for crosscompiling) to my i386 (normal boot, configure, make, make install). This worked fine

-) installed newest llvm from svn (LLVM version 3.5svn)

-) replaced the libffi-3.0.11.tar.gz in ghc/libffi-tarballs with libffi-3.0.13

-) added this version of mk/build.mk:

SRC_HC_OPTS = -H32m _o -fasm -Rghc-timing
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -O0 -DDEBUG -Wall
GhcLibHcOpts = -O -fasm -XGenerics
GhcLibWays = v dyn
SplitObjs = NO
Stage1Only = YES

-) downloaded the sourcecode of ncurses from ​ftp.de.debian.org/debian/pool/main/n/ncurses/ncurses_5.9.orig.tar.gz and builded it with "./configure arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf " + "make". afterwards i added the folder to my $PATH

-)did "perl boot", "./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --prefix=/usr/arm-linux-gnueabihf" and "make". ./configure worked, but make gives me this weird error.

I also tried copying all included files from ncurses to the libraries/terminfo folder, but that also didn't work. I think the mistake is somewhere in the building process, but i'm not exactly sure, so thats why i'm posting this bug.

I also tried getting the libncurses5-dev.deb and libtinfo-dev from my Raspberry pi with "apt-get download libncurses5-dev" and "apt-get download libncurses5-dev" and copied them to my i386, extracted them and added them to my $PATH

Does anyone have an idea about how i can fix that problem with curses?

PS: i also made sure that i met the prerequirements mentioned in ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Linux and ​ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling

Edit: this is the log of my config.log:

`

configure:3400: checking for setupterm in -lcurses 
configure:3425: arm-linux-gnueabihf-gcc -o conftest -fno-stack-protector conftest.c -lcurses >&5 

/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/../lib/libcurses.a when searching for -lcurses 

/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/libcurses.a when searching for -lcurses 

/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcurses 

collect2: error: ld returned 1 exit status

configure:3425: $? = 1 

configure: failed program was: 
| /* confdefs.h */ 
| #define PACKAGE_NAME "Haskell terminfo package" 
| #define PACKAGE_TARNAME "terminfo" 
| #define PACKAGE_VERSION "0.2" 
| #define PACKAGE_STRING "Haskell terminfo package 0.2" 
| #define PACKAGE_BUGREPORT "judah dot jacobson at gmail dot com" 
| #define PACKAGE_URL "" 
| #define STDC_HEADERS 1 
| #define HAVE_SYS_TYPES_H 1 
| #define HAVE_SYS_STAT_H 1 
| #define HAVE_STDLIB_H 1 
| #define HAVE_STRING_H 1 
| #define HAVE_MEMORY_H 1 
| #define HAVE_STRINGS_H 1 
| #define HAVE_INTTYPES_H 1 
| #define HAVE_STDINT_H 1 
| #define HAVE_UNISTD_H 1 
| /* end confdefs.h. */ 
| 
| /* Override any GCC internal prototype to avoid an error. 
| Use char because int might match the return type of a GCC 
| builtin and then its argument prototype would still apply. */ 
| #ifdef __cplusplus 
| extern "C" 
| #endif 
| char setupterm (); 
| int 
| main () 
| { 
| return setupterm (); 
| ; 
| return 0; 
| } 
configure:3434: result: no 
configure:3450: error: in `/home/edi/ghc_cross/ghc/libraries/terminfo': 
configure:3452: error: curses library not found, so this package cannot be built See "config.log" for more details

`

Greetings, Edi

like image 834
Visionstar Avatar asked Feb 07 '14 14:02

Visionstar


1 Answers

So, i've found the solution.

What i did is the following:

compiled the ncurses library with the arm-gcc with the following command:

./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --with-shared --host=arm-linux-gnueabihf --with-build-cpp=arm-linux-gnueabihf-g++

afterwards i did make and did configured my ghc with the following:

./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --prefix=/usr/arm-linux-gnueabihf --with-shared --with-sysroot=/path/to/cursescompiled/libs 

Then it went through and didn't ask me for the curses-library anymore.

so guys, i hope this will be helpful for you

like image 102
Visionstar Avatar answered Nov 19 '22 23:11

Visionstar