Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Linux Pam creates static library instead of shared library

I am trying to cross compile Linux PAM for android in the following way

`#!/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`

The output gives statically built libraries. I want shared libraries. If I compile for linux, it builds shared library by default. But for Android it builds statically. The config.log file has following

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

What is going wrong?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I've had similar problems cross-compiling for Android from the command line. iOS is fun, too. See How To Configure for Android? on the Autoconf mailing list.

I believe host is incorrect. Try:

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

or

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

If that's not it, can you post the full results from config.log (full relating to the shared object tests, not the whole file).

Sorry I can't help you further. I'm trying the cross-compile of Linux-PAM-1.1.8 on my MacBook (its set up for Android dev), but here's my result:

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
$ 
over 4 years ago · Santiago Trujillo Report

0

I noticed this in the the big long log string:

Target: arm-linux-androideabi
Configured with: /tmp/android-8532/src/build/../gcc/gcc-4.6/configure ...
--disable-shared ...

So shared libraries are disabled, which means you won't be building them.

over 4 years ago · Santiago Trujillo Report

0

I made small progress and found that the can_build_shared flag is turned off because it can not find dynamic linker for host type = eabi

configure:9299: checking dynamic linker characteristics

In configure script the check is as following

  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
$as_echo_n "checking dynamic linker characteristics... " >&6; }


if test "$GCC" = yes; then
  case $host_os in

then there is a list of host_os like darwin, aix... but no swith case for "host_os=eabi"

This is the root cause. Looking for the solution..

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!