Luca96 / dlib-for-android

Compile and embed Dlib in your Android projects with ease.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STRIP_TOOLS not working

kleysonr opened this issue · comments

The piece of code to strip the .so is not working as expected.

#!/bin/bash

STRIP_PATH="/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
STRIP_TOOLS=(
    ['armeabi-v7a'] = "$STRIP_PATH/arm-linux-androideabi-strip.exe"
    ['arm64-v8a']   = "$STRIP_PATH/aarch64-linux-android-strip.exe"
    ['x86']         = "$STRIP_PATH/x86_64-linux-android-strip.exe"
    ['x86_64']      = "$STRIP_PATH/x86_64-linux-android-strip.exe"
)

ABI=('armeabi-v7a' 'arm64-v8a' 'x86' 'x86_64')

for abi in "${ABI[@]}"
do

  echo "=> Compiling Dlib for ABI: '$abi'..."
  $STRIP_TOOLS[$abi] --strip-unneeded dlib/libdlib.so

done

Output

=> Compiling Dlib for ABI: 'armeabi-v7a'...
./x.sh: line 17: [armeabi-v7a][armeabi-v7a]: command not found
=> Compiling Dlib for ABI: 'arm64-v8a'...
./x.sh: line 17: [armeabi-v7a][arm64-v8a]: command not found
=> Compiling Dlib for ABI: 'x86'...
./x.sh: line 17: [armeabi-v7a][x86]: command not found
=> Compiling Dlib for ABI: 'x86_64'...
./x.sh: line 17: [armeabi-v7a][x86_64]: command not found

To get it working change to:

# Declare the array
declare -A STRIP_TOOLS

STRIP_TOOLS=(
        ['armeabi-v7a']=$STRIP_PATH/arm-linux-androideabi-strip
        ['arm64-v8a']=$STRIP_PATH/aarch64-linux-android-strip
        ['x86']=$STRIP_PATH/x86_64-linux-android-strip
        ['x86_64']=$STRIP_PATH/x86_64-linux-android-strip
)

and

${STRIP_TOOLS[$abi]} --strip-unneeded dlib/libdlib.so

Best Regards.

Pull request #4