You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译PJSIP Android .so文件时遇features.h及链接错误求助

Let's break down your issues one by one and walk through concrete fixes step by step—since you're new to Android native development, I'll keep things as straightforward as possible.

1. Fixing the 'features.h' not found error in Windows 10 Ubuntu Bash (WSL)

The features.h file is part of the GNU C library, so this error typically pops up when your WSL environment is missing essential build dependencies, or your Android NDK configuration is misaligned. Here's how to fix it:

  • First, install the core build tools and libraries in your WSL Ubuntu instance:
    sudo apt-get update && sudo apt-get install build-essential libc6-dev
    
  • Double-check that you're using a compatible NDK version. Since you need to support the armeabi architecture (which was deprecated in newer NDKs), stick with NDK r17c or r18b—newer versions (r19+) no longer support armeabi.
  • When re-running the configure-android script, make sure you explicitly point to your cross-compiled OpenSSL build (not the system-installed OpenSSL on your WSL host). For example:
    ./configure-android --with-ssl=/path/to/your/openssl-1.1.1-pre6-android/armeabi-v7a
    
  • Before running make, run make clean && make dep to ensure no stale build files are causing conflicts.

2. Fixing OpenSSL linking errors in VirtualBox Ubuntu

Linking errors almost always boil down to one of three issues: mismatched architectures, incorrect OpenSSL paths, or missing cross-compiled OpenSSL libraries. Let's address each:

Step 1: Ensure you're cross-compiling OpenSSL for the correct Android architecture

You can't use a single OpenSSL build for all four architectures—you need to compile OpenSSL separately for each target. Here's a working example for armeabi-v7a (adjust variables for other architectures):

# Set up NDK paths and toolchain variables
export ANDROID_NDK=/path/to/your/ndk-r17c
export PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
export AR=arm-linux-androideabi-ar
export CC=armv7a-linux-androideabi19-clang
export CXX=armv7a-linux-androideabi19-clang++
export LD=arm-linux-androideabi-ld
export RANLIB=arm-linux-androideabi-ranlib
export STRIP=arm-linux-androideabi-strip

# Configure and build OpenSSL
cd /path/to/openssl-1.1.1-pre6
./Configure android-arm -D__ANDROID_API__=19 --prefix=/path/to/output/openssl-armeabi-v7a
make clean
make
make install
  • For armeabi: Use android instead of android-arm in the Configure command, and set CC=arm-linux-androideabi16-clang (API level 16 is the minimum for armeabi).
  • For arm64-v8a: Use android-arm64, set CC=aarch64-linux-android21-clang (API level 21 minimum), and adjust other tools to aarch64-linux-android-*.
  • For x86: Use android-x86, set CC=i686-linux-android16-clang, and tools to i686-linux-android-*.

Step 2: Configure PJSIP with the correct architecture-specific OpenSSL path

When configuring PJSIP, explicitly target the architecture and point to the matching OpenSSL build:

cd /path/to/pjsip
./configure-android --target=armeabi-v7a --with-ssl=/path/to/output/openssl-armeabi-v7a

Step 3: Debug linking errors with verbose output

If you still get linking errors, run make with verbose mode to see exactly what's going wrong:

make VERBOSE=1

This will show you the full linker command—check if it's including the -L/path/to/openssl/lib flag and linking against libssl.so and libcrypto.so. If not, you may need to adjust the configure-android flags or verify that your OpenSSL build actually generated those libraries.

Quick Pre-Checks to Avoid Headaches

  • Never use host OpenSSL: Always cross-compile OpenSSL for Android—using the system OpenSSL on your Ubuntu machine will cause architecture mismatches.
  • Clean builds: Always run make clean before reconfiguring or rebuilding to avoid stale files from previous attempts.
  • Verify architecture compatibility: Use the file command to check your compiled libraries. For example, an armeabi-v7a libssl.so should show: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked.

Once you get one architecture working, repeat the same steps for the other three (armeabi, arm64-v8a, x86) to generate all required .so files.

内容的提问来源于stack exchange,提问作者Priya Sindkar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:19:13