mips, mips64 supported?
Closed this issue · 7 comments
How to add mips and mips64 cpu architecture supporting including pjsip and openssl? thx.
mips and mips64 are not supported currently. It's necessary to implement them in the build scripts. To do that, you can follow these steps:
- Edit line 59 in
config.conf
: https://github.com/alexbbb/pjsip-android-builder/blob/master/config.conf#L59 and add"mips" "mips64"
. In the development stage I suggest you to simply comment the line and add the following:
TARGET_ARCHS=("mips" "mips64")
so you can easily test only those two architectures, without compiling for the other archs and losing time
- Add this to line 166 of
./openssl-build
(https://github.com/alexbbb/pjsip-android-builder/blob/master/openssl-build#L166):
elif [ "$OPENSSL_TARGET_ABI" == "mips" ]
then
#code to compile for mips
elif [ "$OPENSSL_TARGET_ABI" == "mips64" ]
then
#code to compile for mips64
- Add this before line 53 in
./openh264-build-target-archs
: (https://github.com/alexbbb/pjsip-android-builder/blob/master/openh264-build-target-archs#L53)
elif [ "$arch" == "mips" ]
then
ARGS="${ARGS}mips"
elif [ "$arch" == "mips64" ]
then
ARGS="${ARGS}mips64"
- Modify line 95 of
./prepare-build-system
: (https://github.com/alexbbb/pjsip-android-builder/blob/master/prepare-build-system#L95) to be:
sed -i 's/APP_ABI := armeabi armeabi-v7a arm64-v8a x86/APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64/g' jni/Application.mk
When you have executed ./prepare-build-system
for the first time, you can set the following flags in config.conf
to zero, to compile only OpenSSL, Libyuv and OpenH264 when you execute ./prepare-build-system
:
SETUP_PACKAGES=0
DOWNLOAD_NDK=0
DOWNLOAD_SDK=0
DOWNLOAD_TARGET_API=0
DOWNLOAD_PJSIP=0
DOWNLOAD_SWIG=0
so you can test the compilation of those libraries. When you're done implementing the necessary code to make them compile, you can go ahead and execute ./build
to build also pjsip. Feel free to fork the project and make the changes you need. After that, if you want you can send me a pull request.
I modified the files as u described.
With the modifications below, openssl, libyuv and openh264 for mips and mips64 are built
- ./openssl-build
elif [ "$OPENSSL_TARGET_ABI"=="mips" ]
then
#mips
${NDK_MAKE_TOOLCHAIN} --platform=android-${OPENSSL_TARGET_API} \
--toolchain=mipsel-linux-android-${OPENSSL_GCC_VERSION} \
--install-dir="${OPENSSL_TMP_FOLDER}/android-toolchain-mipsel"
export TOOLCHAIN_PATH="${OPENSSL_TMP_FOLDER}/android-toolchain-mipsel/bin"
export TOOL=mipsel-linux-android
export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
export CC=$NDK_TOOLCHAIN_BASENAME-gcc
export CXX=$NDK_TOOLCHAIN_BASENAME-g++
export LINK=${CXX}
export LD=$NDK_TOOLCHAIN_BASENAME-ld
export AR=$NDK_TOOLCHAIN_BASENAME-ar
export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
export ARCH_FLAGS=
export ARCH_LINK=
export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export LDFLAGS=" ${ARCH_LINK} "
cd ${OPENSSL_TMP_FOLDER}
./Configure android-mips --openssldir=${OPENSSL_OUTPUT_PATH}
build_library
elif [ "$OPENSSL_TARGET_ABI"=="mips64" ]
then
#mips64
echo "mips64"
${NDK_MAKE_TOOLCHAIN} --platform=android-${OPENSSL_TARGET_API} \
--toolchain=mips64el-linux-android-${OPENSSL_GCC_VERSION} \
--install-dir="${OPENSSL_TMP_FOLDER}/android-toolchain-mips64el"
export TOOLCHAIN_PATH="${OPENSSL_TMP_FOLDER}/android-toolchain-mips64el/bin"
export TOOL=mips64el-linux-android
export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
export CC=$NDK_TOOLCHAIN_BASENAME-gcc
export CXX=$NDK_TOOLCHAIN_BASENAME-g++
export LINK=${CXX}
export LD=$NDK_TOOLCHAIN_BASENAME-ld
export AR=$NDK_TOOLCHAIN_BASENAME-ar
export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
export ARCH_FLAGS=
export ARCH_LINK=
export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export LDFLAGS=" ${ARCH_LINK} "
cd ${OPENSSL_TMP_FOLDER}
./Configure android-mips64 --openssldir=${OPENSSL_OUTPUT_PATH}
build_library
So, with those modifications you are now able to successfully compile openssl, libyuv, openh264 and pjsip for mips and mips64?
Yes, the compilation for mips and mips64 including openssl, libyuv, openh264 and pjsip are ok.
I found that we need to change the TARGET_ARCHS build order and put "mips" and "mips64" before "x86_64".
Executing ./prepare-build-system to compile openh264, the process stopped in "x86_64" because of compilation error. It's another issue, not an issue in "mips".
- config.conf
TARGET_ARCHS=("armeabi" "armeabi-v7a" "mips" "mips64" "x86" "x86_64" "arm64-v8a")
@yaocl Thank you! The issue you encountered when building x86_64 is because that target ABI is supported only starting from API 21 (http://developer.android.com/ndk/guides/x86-64.html).
I had set OPENH264_TARGET_NDK_LEVEL=21, TARGET_ANDROID_API=21
But I got error message in openh264-build-output/logs/x86_64.log
I just download your binary release from
[https://github.com/alexbbb/pjsip-android-builder/releases/download/v1.0.0/pjsip-2.4.5-android-21.tar.gz]
and I did not see libopenh264.so in x86_64, arm64-v8a folders.
You're right, OpenH264 build issues for x86_64 and arm64 has not been resolved yet: #2 I need some help on that. Do you have any clues? I think it could be because OpenH264 1.0.0 is too old and doesn't support those archs. Newer OpenH264 versions are available, but I was unable to make them work with PJSIP yet.