Cross-compiling a MPICH library for Android NDK

那年仲夏 提交于 2019-12-08 05:44:27

问题


My goal is to run MPICH on Android phones. I'm using Debian Jessie. I thought that I'll achieve that following this tutorial: http://hex.ro/wp/projects/personal-cloud-computing/compiling-mpich2-for-android-and-running-on-two-phones/ but instead of creating toolchain with Buildroot I decided to create it from Android NDK, as on this site: http://www.threadstates.com/articles/2013/setting-up-an-android-cross-compiling-environment-with-the-ndk.html I tried to use MPICH library versions 2.1.4, 2.1.5, 3.0.4 and configure it using command:

sudo CFLAGS=" -march=armv5 -mfpu=vfp -static "
 CC=/home/cerbia/android/bin/arm-linux-androideabi-gcc ./configure
 --prefix=/home/cerbia/old --host=arm-linux --with-pm=smpd --disable-f77 --disable-fc

but I still had this kind of error:

configure: error: SMPD requires MD5 support, and configure could not find either md5_calc in md5.h or MD5 in openssl/md5.h

I found, that it is connected with openssl version and I tried to follow this instruction:

Download, compile, modify and install OpenSSL to the NDK directory. cd ~ wget www.openssl.org/source/openssl-1.0.0g.tar.gz tar xvzf

openssl-1.0.0g.tar.gz cd openssl-1.0.0g ./config no-asm shared --prefix=$ANDROID_ROOT/platforms/android-3/arch-arm/usr

edit Makefile:
CC= arm-linux-gnueabi-gcc-4.6

CFLAG= -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_N -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -fPIC

DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_R C5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE

PEX_LIBS=

EX_LIBS= -ldl

EXE_EXT=

ARFLAGS=

AR= arm-linux-gnueabi-ar $(ARFLAGS) r

RANLIB= arm-linux-gnueabi-ranlib

NM= arm-linux-gnueabi-nm

PERL= /usr/bin/perl

TAR= tar

TARFLAGS= --no-recursion

MAKEDEPPROG= gcc

LIBDIR=lib

Than instead of HIPL I tried to cross-compile MPICH in the analogous way as below

Download and cross-compile HIPL. cd ~ bzr co lp:hipl trunk cd trunk edit configure.ac and comment out all AM_CFLAGS autoreconf --install

./configure --disable-gcc-warn --disable-firewall -host=arm-linux

CC=arm-linux-gnueabi-gcc-4.6

CPPFLAGS="-I$ANDROID_ROOT/platforms/android-3/arch-arm/usr/include"

CFLAGS="-nostdlib"

LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-3/arch-arm/usr/lib,-L$ANDROID_ROOT/platforms/android-3/arch-arm/usr/lib"

LIBS="-lc" make make all-am make[1]: Entering directory `/home/mkomu/projects/hipl-bzr/arm' CC lib/core/builder.lo In file

included from lib/core/debug.h:34:0,

             from lib/core/crypto.h:43,

             from lib/core/builder.c:100: lib/core/protodefs.h:917:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:929:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:1027:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:1036:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:1043:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:1054:5: error: unknown type name 'in_port_t'

lib/core/protodefs.h:1055:5: error: unknown type name 'in_port_t' ...

it comes from site: bugs.launchpad.net/hipl/+bug/715126

but I got the same errors as person there..

make[8]: Wejście do katalogu `/home/cerbia/old/mpich2-1.3.2/src/mpid/ch3/channels/nemesis/nemesis/netmod/tcp' CC tcp_finalize.c In file included from tcp_finalize.c:7:0: tcp_impl.h:108:89: error: unknown type name 'in_port_t' make[8]: * [tcp_finalize.o] Błąd 1

Do you have any advices what I should try to make it working?


回答1:


In Linux, in_port_t is typedefed as uint16_t in netinet/in.h. The only place this typedef is used is in the definition of sockaddr_in.

The Android NDK does not define or use in_port_t, but instead uses unsigned short int. To compile code using the Android NDK, either typedef in_port_t or replace it with unsigned short int.



来源:https://stackoverflow.com/questions/17111281/cross-compiling-a-mpich-library-for-android-ndk

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