dlib-for-android icon indicating copy to clipboard operation
dlib-for-android copied to clipboard

Path issue while compiling the script

Open ghost opened this issue 4 years ago • 8 comments

Screenshot (330)

Any idea what is might be?

ghost avatar Sep 09 '19 06:09 ghost

Hi, can you tell me the path whence you execute the script?

Luca96 avatar Sep 09 '19 20:09 Luca96

Hello ! I've got exactly the same issue ... I tried with both relative path and absolute path ... I don't know what to do more ....

PicoisCharlotte avatar Dec 31 '19 18:12 PicoisCharlotte

same issue i got

harishkandekar avatar Oct 12 '20 07:10 harishkandekar

any solution ?? in my project even ccp folder also not getting generated

harishkandekar avatar Oct 12 '20 07:10 harishkandekar

Try to make sure that the path where the .so get created is the same of the script. If not, adjust accordingly.

Luca96 avatar Oct 17 '20 13:10 Luca96

I run into the same problem after compile dlib. The problem is in this line. @Luca96 change the working directory when compiling dlib but he forgets to undo it after the compiled finish.

To quick fix, you can comment this line Compile-Dlib and re-run the setup.ps1 again to copy the lib to Android Studio Project.

ninh-huynh avatar Dec 04 '20 08:12 ninh-huynh

Hi @kim-ninh , thank you very much for the suggestion.

Could you check if the following code solves the issue (replace this code-block):

# Dlib library path:
$DLIB_PATH = 'dlib'

function Compile-Dlib {
    $CWD = Get-Location
    Set-Location $DLIB_PATH
    Make-Dir 'build'

    Write-Host '=> Compiling Dlib...'
    sleep 0.5

    ForEach ($abi in $ABIs) {
        Write-Host
        Write-Host "=> Compiling Dlib for ABI: '$abi'..."
        sleep 0.5

        Make-Dir "build\$abi"
        Set-Location "build\$abi"

        $cmakeArguments = @(
                "-DBUILD_SHARED_LIBS=1",
                "-DANDROID_NDK=$NDK",
                "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN",
                "-GNinja",
                "-DCMAKE_BUILD_TYPE=Release",
                "-DCMAKE_CXX_FLAGS=-std=c++11 -frtti -fexceptions",
                "-DCMAKE_C_FLAGS=-O3",
                "-DANDROID_ABI=$abi",
                "-DANDROID_PLATFORM=android-$MIN_SDK",
                "-DANDROID_TOOLCHAIN=clang",
                "-DANDROID_STL=c++_shared",
                "-DANDROID_CPP_FEATURES=rtti exceptions",
                "-DCMAKE_PREFIX_PATH=..\..\",
                "..\..\"
        )

        $stripArguments = @(
                "--strip-unneeded",
                "dlib/libdlib.so"
        )

        & $AndroidCmake $cmakeArguments
        sleep 0.5

        Write-Host "=> Generating the 'dlib/libdlib.so' for ABI: '$abi'..."
        & $AndroidCmake --build .
        sleep 0.5

        Write-Host "=> Stripping libdlib.so for ABI: '$abi'to reduce space..."
        & $STRIPPERS[$abi] $stripArguments
        sleep 0.5

        Write-Host '=> done.'
        Set-Location $CWD
        sleep 0.5
    }    
}

Thanks in advance

Luca96 avatar Dec 04 '20 15:12 Luca96

Hi @kim-ninh , thank you very much for the suggestion.

Could you check if the following code solves the issue (replace this code-block):

# Dlib library path:
$DLIB_PATH = 'dlib'

function Compile-Dlib {
    $CWD = Get-Location
    Set-Location $DLIB_PATH
    Make-Dir 'build'

    Write-Host '=> Compiling Dlib...'
    sleep 0.5

    ForEach ($abi in $ABIs) {
        Write-Host
        Write-Host "=> Compiling Dlib for ABI: '$abi'..."
        sleep 0.5

        Make-Dir "build\$abi"
        Set-Location "build\$abi"

        $cmakeArguments = @(
                "-DBUILD_SHARED_LIBS=1",
                "-DANDROID_NDK=$NDK",
                "-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN",
                "-GNinja",
                "-DCMAKE_BUILD_TYPE=Release",
                "-DCMAKE_CXX_FLAGS=-std=c++11 -frtti -fexceptions",
                "-DCMAKE_C_FLAGS=-O3",
                "-DANDROID_ABI=$abi",
                "-DANDROID_PLATFORM=android-$MIN_SDK",
                "-DANDROID_TOOLCHAIN=clang",
                "-DANDROID_STL=c++_shared",
                "-DANDROID_CPP_FEATURES=rtti exceptions",
                "-DCMAKE_PREFIX_PATH=..\..\",
                "..\..\"
        )

        $stripArguments = @(
                "--strip-unneeded",
                "dlib/libdlib.so"
        )

        & $AndroidCmake $cmakeArguments
        sleep 0.5

        Write-Host "=> Generating the 'dlib/libdlib.so' for ABI: '$abi'..."
        & $AndroidCmake --build .
        sleep 0.5

        Write-Host "=> Stripping libdlib.so for ABI: '$abi'to reduce space..."
        & $STRIPPERS[$abi] $stripArguments
        sleep 0.5

        Write-Host '=> done.'
        Set-Location $CWD
        sleep 0.5
    }    
}

Thanks in advance

Sound great 👌

ninh-huynh avatar Dec 04 '20 15:12 ninh-huynh