我试着从linux i386交叉编译到arm-linux-gnueabihf,但我无法实现,因为在运行'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
我做了什么?
-) 从github编译了7.8.0(日志上说 "应该是7.8.0",我选择7.8是因为我认为它对交叉编译来说更稳定)到我的i386上(正常启动、配置、制作、安装)。这工作很好
-)从svn安装了最新的llvm(LLVM版本3.5svn)。
-) 将ghclibffi-tarballs中的libffi-3.0.11.tar.gz替换为libffi-3.0.13。
-) 添加了这个版本的 mkbuild.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
-) 从ftp.de.debian.orgdebianpoolmainnncursesncurses_5.9.orig.tar.gz下载了ncurses的源代码,并用". configure arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --target=arm-linux-gnueabihf --prefix=usrarm-linux-gnueabihf "+"make"。
-)做了 "perl boot",".configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --prefix=usrarm-linux-gnueabihf "和 "make".configure成功了,但是make给我这个奇怪的错误。
我还试着把ncurses中所有包含的文件复制到 librariesterminfo文件夹中,但也没有用。我想这个错误是在构建过程中的某个地方,但我不太确定,所以我把这个错误贴出来。
我还试着用 "apt-get download libncurses5-dev "和 "apt-get download libncurses5-dev "从我的Raspberry pi上获取libncurses5-dev.deb和libtinfo-dev,然后把它们复制到我的i386上,解压后添加到我的$PATH中。
有谁知道我如何用诅咒来解决这个问题吗?
PS: 我还确保我满足了 ghc.haskell.orgtracghcwikiBuildingPreparationLinux 和 ghc.haskell.orgtracghcwikiBuildingCrossCompiling 中提到的前提条件。
编辑:这是我的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
`
你好,Edi
所以,我找到了解决方案。
我所做的是以下几点。
用arm -gcc编译了ncurses库 用下面的命令。
./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --with-shared --host=arm-linux-gnueabihf --with-build-cpp=arm-linux-gnueabihf-g++
然后我用下面的命令配置了我的ghc:
./configure --target=arm-linux-gnueabihf --with-gcc=arm-linux-gnueabihf-gcc --prefix=/usr/arm-linux-gnueabihf --with-shared --with-sysroot=/path/to/cursescompiled/libs
然后它就通过了,没有再问我要curses -library.
所以伙计们,我希望这对你们有帮助。
遇到了类似的问题,这个问题让我找到了正确的解决方案。是的,我不得不调整sysroot,但作者的方法没有用,configure脚本只是忽略了 --with-sysroot
旗帜。所以我做了什么,而不是。
export SYSROOT=/usr/x86_64-w64-mingw32/sys-root/
export CFLAGS=--sysroot=$SYSROOT
export CPPFLAGS=--sysroot=$SYSROOT
export LDFLAGS=--sysroot=$SYSROOT
然后像往常一样进行配置和制作 在同一个终端会话中进行