为 Android NDK 交叉编译 MPICH 库 [英] Cross-compiling a MPICH library for Android NDK

查看:33
本文介绍了为 Android NDK 交叉编译 MPICH 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是在 Android 手机上运行 MPICH.我正在使用 Debian Jessie.我认为我会在本教程之后实现这一目标:http://hex.ro/wp/projects/personal-cloud-computing/compiling-mpich2-for-android-and-running-on-two-phones/但我决定从 Android NDK 创建它,而不是使用 Buildroot 创建工具链,如本网站所示:http://www.threadstates.com/articles/2013/setting-up-an-android-cross-compiling-environment-with-the-ndk.html我尝试使用 MPICH 库版本 2.1.4、2.1.5、3.0.4 并使用以下命令对其进行配置:

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

但我仍然有这种错误:

configure: 错误:SMPD 需要 MD5 支持,并且配置不能在 md5.h 中找到 md5_calc 或在 openssl/md5.h 中找到 MD5

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

我发现它与 openssl 版本有关,我尝试按照此说明进行操作:

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

下载、编译、修改OpenSSL安装到NDK目录.cd ~ wget www.openssl.org/source/openssl-1.0.0g.tar.gz tar xvzf

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

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

编辑生成文件:
CC= arm-linux-gnueabi-gcc-4.6

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

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

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

EX_LIBS= -ldl

EXE_EXT=

ARFLAGS=

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

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

RANLIB= arm-linux-gnueabi-ranlib

RANLIB= arm-linux-gnueabi-ranlib

NM= arm-linux-gnueabi-nm

NM= arm-linux-gnueabi-nm

PERL=/usr/bin/perl

PERL= /usr/bin/perl

焦油=焦油

TARFLAGS= --no-recursion

TARFLAGS= --no-recursion

MAKEDEPPROG= gcc

MAKEDEPPROG= gcc

LIBDIR=lib

我尝试以类似的方式交叉编译 MPICH 而不是 HIPL

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

下载并交叉编译 HIPL.cd ~ bzr co lp:hipl trunk cd trunk 编辑configure.ac 并注释掉所有AM_CFLAGS autoreconf --install

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

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

CC=arm-linux-gnueabi-gcc-4.6

CC=arm-linux-gnueabi-gcc-4.6

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

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

CFLAGS="-nostdlib"

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"

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]: 进入目录`/home/mkomu/projects/hipl-bzr/arm' CC lib/core/builder.lo 文件中

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

从 lib/core/debug.h:34:0 包含,

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: 错误:未知类型名称 'in_port_t'

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

lib/core/protodefs.h:1027:5: 错误:未知类型名称 'in_port_t'

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

lib/core/protodefs.h:1036:5: 错误:未知类型名称 'in_port_t'

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

lib/core/protodefs.h:1043:5: 错误:未知类型名称 'in_port_t'

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

lib/core/protodefs.h:1054:5: 错误:未知类型名称 'in_port_t'

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

lib/core/protodefs.h:1055:5: 错误:未知类型名称 'in_port_t' ...

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

它来自站点:bugs.launchpad.net/hipl/+bug/715126

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 在包含的文件中tcp_finalize.c:7:0: tcp_impl.h:108:89: 错误:未知类型名称'in_port_t' make[8]: * [tcp_finalize.o] Błąd 1

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?

推荐答案

在 Linux 中,in_port_tnetinet/in.h 中被定义为 uint16_t代码>.唯一使用此 typedef 的地方是 sockaddr_in 的定义.

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.

Android NDK 没有定义或使用 in_port_t,而是使用 unsigned short int.要使用 Android NDK 编译代码,请使用 typedef in_port_t 或将其替换为 unsigned short int.

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.

这篇关于为 Android NDK 交叉编译 MPICH 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆