Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mips, mips64 supported? #8

Closed
yaocl opened this issue Dec 22, 2015 · 7 comments
Closed

mips, mips64 supported? #8

yaocl opened this issue Dec 22, 2015 · 7 comments

Comments

@yaocl
Copy link

yaocl commented Dec 22, 2015

How to add mips and mips64 cpu architecture supporting including pjsip and openssl? thx.

@alexbbb
Copy link
Contributor

alexbbb commented Dec 22, 2015

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:

TARGET_ARCHS=("mips" "mips64")

so you can easily test only those two architectures, without compiling for the other archs and losing time

elif [ "$OPENSSL_TARGET_ABI" == "mips" ]
then
    #code to compile for mips

elif [ "$OPENSSL_TARGET_ABI" == "mips64" ]
then
    #code to compile for mips64
elif [ "$arch" == "mips" ]
    then
        ARGS="${ARGS}mips"
elif [ "$arch" == "mips64" ]
    then
        ARGS="${ARGS}mips64"
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.

@yaocl
Copy link
Author

yaocl commented Dec 22, 2015

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

@alexbbb
Copy link
Contributor

alexbbb commented Dec 22, 2015

So, with those modifications you are now able to successfully compile openssl, libyuv, openh264 and pjsip for mips and mips64?

@yaocl
Copy link
Author

yaocl commented Dec 23, 2015

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")

@alexbbb
Copy link
Contributor

alexbbb commented Dec 23, 2015

@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).

@yaocl
Copy link
Author

yaocl commented Dec 23, 2015

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.

@alexbbb
Copy link
Contributor

alexbbb commented Dec 23, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants