系统相关
首页 > 系统相关> > Linux Pam创建静态库而不是共享库

Linux Pam创建静态库而不是共享库

作者:互联网

我正在尝试通过以下方式为Android交叉编译Linux PAM

`#!/bin/sh
# Linux-PAM/build.sh

INSTALL_DIR="`pwd`/out"

export
PATH="android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin:$PATH"
export CROSS_COMPILER="$PATH:android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin"
export SYS_ROOT="android/prebuilts/ndk/current/platforms/android-9/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-eabi --build=x86_64 --enable-shared --prefix=$INSTALL_DIR LIBS="-lc -lgcc"

make
make install`

输出给出静态构建的库.我想要共享库.如果我针对Linux进行编译,则默认情况下会构建共享库.但是对于Android,它是静态构建的. config.log文件具有以下内容

configure:3581: arm-linux-androideabi-gcc --sysroot=android/prebuilts/ndk/current/platforms/android-9/arch-arm -v >&5
Using built-in specs.
COLLECT_GCC=arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../libexec/gcc/arm-linux-androideabi/4.6.x-google/lto-wrapper
Target: arm-linux-androideabi
Configured with: /tmp/android-8532/src/build/../gcc/gcc-4.6/configure --prefix=/usr/local --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/tmp/android-8532/obj/temp-install --with-mpfr=/tmp/android-8532/obj/temp-install --with-mpc=/tmp/android-8532/obj/temp-install --without-ppl --without-cloog --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-gcc-version=4.6 --with-binutils-version=2.21 --with-gmp-version=4.2.4 --with-mpfr-version=2.4.1 --with-gdb-version=7.3.x --with-arch=armv5te --with-sysroot=/tmp/android-8532/install/sysroot --with-prefix=/tmp/android-8532/install --with-gold-version=2.21 --enable-gold --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default


....

configure:10632: checking if libtool supports shared libraries
configure:10634: result: no
configure:10637: checking whether to build shared libraries
configure:10658: result: no

怎么了?

解决方法:

从命令行对Android进行交叉编译时,我遇到了类似的问题. iOS也很有趣.请参阅Autoconf邮件列表上的How To Configure for Android?.

我相信主机是不正确的.尝试:

./configure --build=`./config.guess` --host=arm ...

要么

./configure --build=`./config.guess` --host=arm-linux-androideabi ...

如果不是这样,您可以从config.log中发布完整结果(与共享对象测试有关的完整结果,而不是整个文件).

对不起,我不能再帮你了.我正在MacBook(为Android开发人员设置)上尝试Linux-PAM-1.1.8的交叉编译,但这是我的结果:

In file included from pam_modutil_private.h:14:0,
                 from pam_audit.c:12:
./include/security/pam_modutil.h:53:20: fatal error: shadow.h: No such file or directory
compilation terminated.
make[2]: *** [pam_audit.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

$pwd
/Users/jwalton/Linux-PAM-1.1.8
$find . -iname shadow.h
$

标签:gcc,android-ndk,autoconf,pam,linux
来源: https://codeday.me/bug/20191122/2058412.html