0
目標使用NDK工具鏈爲Android編譯思科libsrtp並使用libsrtp.a靜態鏈接到我自己的庫。使用Android工具鏈與autoconf交叉編譯
設置:我使用以下文件
<setup.sh>
export CROSS_SYSROOT=/home/psurana/aa/sysroot
export CROSS_COMPILE=aarch64-linux-android-
export SYSROOT=/home/psurana/aa/sysroot
export CC="${CROSS_COMPILE}gcc --sysroot=${SYSROOT}"
export CXX="${CROSS_COMPILE}gxx --sysroot=${SYSROOT}"
PATH=/home/psurana/aa/bin:$PATH
的話,我做如下配置:
source setup.sh && ./configure --host=aarch64-linux-android --build=`./config.guess` && make -j
這編譯對我來說。收益率 -
File: libsrtp.a(ut_sim.o)
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: AArch64
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 1480 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 64 (bytes)
Number of section headers: 10
Section header string table index: 7
到目前爲止好。
問題
然而,當我libsrtp.a鏈接作爲預構建的靜態庫,我得到以下錯誤:
./srtp/libsrtp.a(rand_source.o): In function `rand_source_init':
err.c:(.text+0x0): undefined reference to `stdout'
err.c:(.text+0xc): undefined reference to `stdout'
,並
rand_source.c:(.text+0x28): undefined reference to `stderr'
rand_source.c:(.text+0x3c): undefined reference to `stderr'
我的理解是, Android在其libc中沒有stderr,但那麼libsrtp如何獲得這些?
我以前使用類似的東西建立了相同的庫,我知道它構建。我不知道錯誤可能是什麼。
它的工作!我沒有添加這個標誌,但我更改了Application.mk中的Android NDK版本,並開始編譯。 :)。 – Pranay