armnn icon indicating copy to clipboard operation
armnn copied to clipboard

Help wanted Armnn build failed for Android

Open Saikatsaha1996 opened this issue 3 years ago • 38 comments

error: variable 'numOutputElements' set but not used [-Werror,-Wunused-but-set-variable]

Screenshot_2022-04-03-18-13-38-664_com termux

Saikatsaha1996 avatar Apr 03 '22 12:04 Saikatsaha1996

Hi @Saikatsaha1996, which version of armnn and android-nn-driver are you using? Regards

TeresaARM avatar Apr 05 '22 12:04 TeresaARM

Hi @Saikatsaha1996, which version of armnn and android-nn-driver are you using? Regards

Hi @Saikatsaha1996, which version of armnn and android-nn-driver are you using? Regards

22.02 v i am using..

I am building in my own device.. compute library with OpenCL successfully build but i can't build ArmNN without tensorflow

Screenshot_2022-04-02-20-10-19-505_com termux Screenshot_2022-04-02-20-17-56-085_com termux

Saikatsaha1996 avatar Apr 05 '22 14:04 Saikatsaha1996

Hi,

are you following this guide: https://github.com/ARM-software/armnn/blob/branches/armnn_22_02/BuildGuideAndroidNDK.md ?

TeresaARM avatar Apr 05 '22 15:04 TeresaARM

Hi,

are you following this guide: https://github.com/ARM-software/armnn/blob/branches/armnn_22_02/BuildGuideAndroidNDK.md ?

Yes i am following this guide

Saikatsaha1996 avatar Apr 05 '22 15:04 Saikatsaha1996

Hi,

are you following this guide: https://github.com/ARM-software/armnn/blob/branches/armnn_22_02/BuildGuideAndroidNDK.md ?

Can you tell me exactly why i am getting this error ? Any dependency problem ?

Saikatsaha1996 avatar Apr 05 '22 16:04 Saikatsaha1996

Hi,

are you following this guide: https://github.com/ARM-software/armnn/blob/branches/armnn_22_02/BuildGuideAndroidNDK.md ?

@TeresaARM waiting for solution.. any solution please

Saikatsaha1996 avatar Apr 09 '22 16:04 Saikatsaha1996

Hi,

please try this patch: https://review.mlplatform.org/c/ml/armnn/+/7393

Regards

TeresaARM avatar Apr 11 '22 10:04 TeresaARM

Hi,

please try this patch: https://review.mlplatform.org/c/ml/armnn/+/7393

Regards

Okay trying thank you for your response!

Saikatsaha1996 avatar Apr 11 '22 10:04 Saikatsaha1996

Hi,

please try this patch: https://review.mlplatform.org/c/ml/armnn/+/7393

Regards

@TeresaARM Fast error solved thank you for your help 😃

Getting new error ArmNN && ComputeLibrary v22.02

cmake .. -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz"

make -j(nrproc)

Screenshot_2022-04-11-18-13-51-190_com termux

Saikatsaha1996 avatar Apr 11 '22 12:04 Saikatsaha1996

Hi, that got fixed here: https://review.mlplatform.org/c/ml/armnn/+/7336 (this is already merged in the main branch, but not part of 22.02, it will be part of 22.05)

Could you please apply that patch as well?

Regards

TeresaARM avatar Apr 11 '22 13:04 TeresaARM

Hi, that got fixed here: https://review.mlplatform.org/c/ml/armnn/+/7336

Could you please apply that patch as well?

Regards

Okay 👌👌 trying

Saikatsaha1996 avatar Apr 11 '22 13:04 Saikatsaha1996

Hi, that got fixed here: https://review.mlplatform.org/c/ml/armnn/+/7336 (this is already merged in master, but not part of 22.02, it will be part of 22.05)

Could you please apply that patch as well?

Regards

How to build without tensorflow ? -DTENSORFLOW=0 ?

Saikatsaha1996 avatar Apr 11 '22 13:04 Saikatsaha1996

Hi @Saikatsaha1996 ,

to build without tensorflow, you should do what you are doing, it is the default. to build with tensorflow, you could use the script get_tensorflow.sh and set the -DTENSORFLOW_ROOT= to the path where tensorflow is.

could you send us a log/show us the error message you are seeing now?

Regards

TeresaARM avatar Apr 11 '22 14:04 TeresaARM

Hi @Saikatsaha1996 ,

to build without tensorflow, you should do what you are doing, it is the default. to build with tensorflow, you could use the script get_tensorflow.sh and set the -DTENSORFLOW_ROOT= to the path where tensorflow is.

could you send us a log/show us the error message you are seeing now?

Regards

Hello @TeresaARM

getting this error

Screenshot_2022-04-11-20-29-17-292_com termux

Saikatsaha1996 avatar Apr 11 '22 15:04 Saikatsaha1996

Hi @Saikatsaha1996 ,

to build without tensorflow, you should do what you are doing, it is the default. to build with tensorflow, you could use the script get_tensorflow.sh and set the -DTENSORFLOW_ROOT= to the path where tensorflow is.

could you send us a log/show us the error message you are seeing now?

Regards

Screenshot_2022-04-11-20-38-07-240_com termux

Saikatsaha1996 avatar Apr 11 '22 15:04 Saikatsaha1996

Hi @Saikatsaha1996,

so, your last screenshot is setting -DTENSORFLOW_ROOT= and your second last, uses the same command but without setting -DTENSORFLOW_ROOT= ? or you changed something different?

are you unblocked now?

Regards

TeresaARM avatar Apr 11 '22 15:04 TeresaARM

Hi @Saikatsaha1996,

so, your last screenshot is setting -DTENSORFLOW_ROOT= and your second last, uses the same command but without setting -DTENSORFLOW_ROOT= ? or you changed something different?

are you unblocked now?

Regards

No same error getting with tensorflow root ..i already mentioned tensorflow root path...

Getting error like this Screenshot_2022-04-11-21-11-44-329_com termux

Saikatsaha1996 avatar Apr 11 '22 15:04 Saikatsaha1996

Hi,

Please have a look at BuildGuideAndroidNDK.md and search for -fpic

The error message is asking you to recompile with -fPIC

please let us know how it goes

Thank you for your messages Kind Regards

TeresaARM avatar Apr 11 '22 15:04 TeresaARM

Hi,

Please have a look at BuildGuideAndroidNDK.md and search for -fpic

The error message is asking you to recompile with -fPIC

please let us know how it goes

Thank you for your messages Kind Regards

CFLAGS="-fPIE -fPIC" cmake .. -DCMAKE_SYSTEM_NAME=Android -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" -DTENSORFLOW_ROOT=$HOME/armnn-devenv/tensorflow

make -j8

Getting same error

Screenshot_2022-04-11-21-11-44-329_com termux

Saikatsaha1996 avatar Apr 11 '22 16:04 Saikatsaha1996

@TeresaARM tried to build with , but same error..

cmake .. -DARMCOMPUTE_ROOT=$HOME/armnn-devenv/ComputeLibrary -DARMCOMPUTE_BUILD_DIR=$HOME/armnn-devenv/ComputeLibrary/build -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXE_LINKER_FLAGS="-pie -llog -lz" -DTENSORFLOW_ROOT=$HOME/armnn-devenv/tensorflow-protobuf/tensorflow -DCMAKE_CXX_FLAGS="-fPIE -fPIC" -DCMAKE_POSITION_INDEPENDENT_CODE=ON

Saikatsaha1996 avatar Apr 11 '22 19:04 Saikatsaha1996

Hi @Saikatsaha1996,

which command have you used to build Compute Library?

TeresaARM avatar Apr 12 '22 10:04 TeresaARM

Hi @Saikatsaha1996,

which command have you used to build Compute Library?

@TeresaARM hi!

scons Werror=0 -j8 debug=0 neon=1 opencl=1 os=android arch=arm64-v8a asserts=0 extra_link_flags=" -fPIC -fopenmp -static-openmp" benchmark_tests=0

Saikatsaha1996 avatar Apr 12 '22 11:04 Saikatsaha1996

@TeresaARM scons build complete without any error..

But you should edit "SConstruct" after that you can able to compile Computlibrary

line 325 and 326

env['CC'] = env['compiler_cache'] + c_compiler env['CXX'] = env['compiler_cache'] + cpp_compiler

Build done..

Saikatsaha1996 avatar Apr 12 '22 11:04 Saikatsaha1996

Hi @Saikatsaha1996 ,

could you please try to build with a command more similar to the one in the guide?

scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
 benchmark_tests=0 validation_tests=0 os=android -j16

You are using, extra_link_flags, instead of extra_cxx_flags="-fPIC"

SConstruct file is correct, I checked with the Compute Library team, who are the owners of the file. But removing the part you have removed, instead of giving a prefix should be ok as well.

Regards

TeresaARM avatar Apr 13 '22 12:04 TeresaARM

Hi @Saikatsaha1996 ,

could you please try to build with a command more similar to the one in the guide?

scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
 benchmark_tests=0 validation_tests=0 os=android -j16

You are using, extra_link_flags, instead of extra_cxx_flags="-fPIC"

SConstruct file is correct, I checked with the Compute Library team, who are the owners of the file. But removing the part you have removed, instead of giving a prefix should be ok as well.

Regards

Okay trying..

Saikatsaha1996 avatar Apr 13 '22 13:04 Saikatsaha1996

Hi @Saikatsaha1996 ,

could you please try to build with a command more similar to the one in the guide?

scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
 benchmark_tests=0 validation_tests=0 os=android -j16

You are using, extra_link_flags, instead of extra_cxx_flags="-fPIC"

SConstruct file is correct, I checked with the Compute Library team, who are the owners of the file. But removing the part you have removed, instead of giving a prefix should be ok as well.

Regards

@TeresaARM Hi!

😃👌🤩

Ultimately build done without warning, errors full green build with cmake and without android ndk && with your , @Computelibrary team's support..

Build complete with Android mobile, not used any pc desktop...

Thank you so much!

Screenshot_2022-04-13-21-22-40-999_com termux

Saikatsaha1996 avatar Apr 13 '22 15:04 Saikatsaha1996

Solution is if you are build with mobile..

scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 os=android extra_link_flags="-fopenmp -static-openmp" Werror=0 asserts=0 -j8

Saikatsaha1996 avatar Apr 13 '22 16:04 Saikatsaha1996

Solution is if you are build with mobile..

scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0 os=android extra_link_flags="-fopenmp -static-openmp" Werror=0 asserts=0 -j8

@TeresaARM

UnitTests faild because it is tensorflow problem.. when you clone tensorflow with get-tensoflow.sh please use chrrypik patch.. i am not use this patch that's why getting segmentation fault.. but it is ok .. i will re-compile with tensorflow patch version r2.5

Screenshot_2022-04-13-21-37-54-992_com termux

Saikatsaha1996 avatar Apr 13 '22 16:04 Saikatsaha1996

Hi @Saikatsaha1996,

glad you hear it is working now. Here you can find the versions of the build dependencies for Arm NN: https://github.com/ARM-software/armnn/releases/tag/v22.02

Tensorflow needs to be 2.5.

Please let me know how it goes.

Kind Regards

TeresaARM avatar Apr 13 '22 18:04 TeresaARM

Hi @Saikatsaha1996,

glad you hear it is working now. Here you can find the versions of the build dependencies for Arm NN: https://github.com/ARM-software/armnn/releases/tag/v22.02

Tensorflow needs to be 2.5.

Please let me know how it goes.

Kind Regards

Full build done .. with termux.. and now i need to test but my pc GPU gone for RMA so i can't test with adb push && pull for 2 or 3 days ..

Screenshot_2022-04-14-02-39-13-548_com termux

Saikatsaha1996 avatar Apr 13 '22 21:04 Saikatsaha1996