Cross Compiling ghostscript for android, what host should I use?

匿名 (未验证) 提交于 2019-12-03 02:42:02

问题:

Hi Guys I am using this tutorial to build ghostscript-9.19 to be able to use in my android application to convert eps document to pdf. It fails while configure. Here are the logs

checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... arm-linux-androideabi-gcc --  sysroot=/<path>/android-ndk-    r11c/platforms/android-17/arch-arm/ checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables...  checking whether we are cross compiling... configure: error: in     `/<path>/ghostscript-9.19/tiff-config': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details configure: error: libtiff configure script failed 

This is the build file I am running

#!/bin/sh # Compiles ghostscript for Android # Make sure you have NDK_ROOT defined in .bashrc or .bash_profile  INSTALL_DIR="`pwd`/app/jni/gs" SRC_DIR="`pwd`/../ghostscript-9.19"  cd $SRC_DIR  export PATH="/<path>/android-ndk-r11c/toolchains/arm-         linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$PATH" export SYS_ROOT="/<path>/Android/android-ndk- r11c/platforms/android-17/arch-arm/" export CC="arm-linux-androideabi-gcc --sysroot=$SYS_ROOT" export LD="arm-linux-androideabi-ld" export AR="arm-linux-androideabi-ar" export RANLIB="arm-linux-androideabi-ranlib" export STRIP="arm-linux-androideabi-strip"  mkdir -p $INSTALL_DIR ./configure --host=arm-linux-androideabi --build=x86_64-apple-darwin --prefix=$INSTALL_DIR LIBS="-lc -lgcc"  make PREFIX=$INSTALL_DIR make install DESTDIR=$INSTALL_DIR  exit 0 

I am using --host=arm-linux-androideabi. What host should i use? What do I need to change in ghostScript project to make compile in successfully? Any help is highly appreciated.

回答1:

Cross compiling Ghostscript is pretty involved, partly because the Ghostscript build relies on building and running interim tools (genarch, genconf, mkromfs and echogs) which, obviously, must be built with the native compiler, rather than the cross compiler.

I think the problem you are seeing is because the call to the libtiff configure doesn't pass on the required options.

You may be better served grabbing, and tweaking the two files (a makefile and a header) from this commit: Makefile for Android MuPDF libgs.so

and tweaking it to match your requirements.

There is a basic guide of what to do for cross compiling at the bottom of this page: Ghostscript FAQ

I have a "project" to improve support for cross compiling, but it is slow going at the moment.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!