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

tflite 2.4 build benchmark_model error on ubuntu 16.04 (cmake) #45290

Closed
lxiao217 opened this issue Dec 1, 2020 · 11 comments
Closed

tflite 2.4 build benchmark_model error on ubuntu 16.04 (cmake) #45290

lxiao217 opened this issue Dec 1, 2020 · 11 comments
Assignees
Labels
comp:lite TF Lite related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues

Comments

@lxiao217
Copy link

lxiao217 commented Dec 1, 2020

when i build tflite2.4 on Ubuntu, i encount the problem:
i can success build libtensorflow-lite.a with CMakeLists.txt use CMake, but when i buildbenchmark-model i got these errors:
my build command is : make benchmark-model
errors:

[ 98%] Linking CXX executable benchmark_model
_deps/xnnpack-build/libXNNPACK.a(4x16c8-minmax-avx512skx.c.o): In function xnn_qs8_gemm_minmax_ukernel_4x16c8__avx512skx': 4x16c8-minmax-avx512skx.c:(.text+0x720): undefined reference to _kshiftli_mask64'
4x16c8-minmax-avx512skx.c:(.text+0x753): undefined reference to _kshiftli_mask64' 4x16c8-minmax-avx512skx.c:(.text+0x785): undefined reference to _kshiftli_mask64'
_deps/xnnpack-build/libXNNPACK.a(4x16c8-minmax-avx512skx.c.o): In function xnn_qs8_igemm_minmax_ukernel_4x16c8__avx512skx': 4x16c8-minmax-avx512skx.c:(.text+0x7a2): undefined reference to _kshiftri_mask64'
4x16c8-minmax-avx512skx.c:(.text+0x7d4): undefined reference to _kshiftri_mask64' 4x16c8-minmax-avx512skx.c:(.text+0x80d): undefined reference to _kshiftri_mask64'
collect2: error: ld returned 1 exit status
CMakeFiles/benchmark_model.dir/build.make:382: recipe for target 'benchmark_model' failed
make[3]: *** [benchmark_model] Error 1
CMakeFiles/Makefile2:2012: recipe for target 'CMakeFiles/benchmark_model.dir/all' failed
make[2]: *** [CMakeFiles/benchmark_model.dir/all] Error 2
CMakeFiles/Makefile2:2019: recipe for target 'CMakeFiles/benchmark_model.dir/rule' failed
make[1]: *** [CMakeFiles/benchmark_model.dir/rule] Error 2
Makefile:199: recipe for target 'benchmark_model' failed
make: *** [benchmark_model] Error 2

this puzzled me for a long time , appreciate your reply!

the CMakeLists.txt help me much ,but also has some errors i think , for example the xnnpack delegate switch to control build with xnnpack delegate. i found use TFLITE_ENABLE_XNNPACK to control xnnpack delegate will get errors when i build shared library in windows x64. so i change the source code.

email: lxiao217@163.com

@lxiao217 lxiao217 added the type:build/install Build and install issues label Dec 1, 2020
@ravikyram ravikyram added comp:lite TF Lite related issues subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues TF 2.4 for issues related to TF 2.4 labels Dec 1, 2020
@ravikyram ravikyram assigned jvishnuvardhan and unassigned ravikyram Dec 1, 2020
@jvishnuvardhan jvishnuvardhan added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Dec 8, 2020
@terryheo
Copy link
Member

terryheo commented Dec 9, 2020

It works well for me with r2.4 branch.
Could you check if you're using up-to-date r2.4 branch?

BTW, here is the official guide on CMake build
https://www.tensorflow.org/lite/guide/build_cmake

@terryheo terryheo changed the title tflite 2.4 build benchmark_model error on ubuntu 16.04 tflite 2.4 build benchmark_model error on ubuntu 16.04 (cmake) Dec 9, 2020
@tensorflowbutler tensorflowbutler removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Dec 11, 2020
@lxiao217
Copy link
Author

It works well for me with r2.4 branch.
Could you check if you're using up-to-date r2.4 branch?

BTW, here is the official guide on CMake build
https://www.tensorflow.org/lite/guide/build_cmake

thanks for your reply, the reason for this problem is my gcc/g++ version too low, avx512 is supported after 6.x, but mine is 5.x, so i upgrade it to 9.0 and this problem solved.

but this build also has problem when i build dynamic libraries in ubuntu/windows et.
test_delegate_providers.cpp in line 29 and 40 throw errors with unrecognized reference of Merge and Parse.

@terryheo
Copy link
Member

@lxiao217 could you share the command you used to build dynamic libraries?

@lxiao217
Copy link
Author

@lxiao217 could you share the command you used to build dynamic libraries?

i added "shared" in CMakeLists.txt like this:

TFLite library

add_library(tensorflow-lite SHARED
${TFLITE_CORE_API_SRCS}

and then" cmake ./ -B ./build ", then errors up thrown. i annotated those code at last, i dont know if this action will have other bad influence. though this code in test file.

copybara-service bot pushed a commit that referenced this issue Dec 15, 2020
- Filtered Flex relate files
- Filtered Kernel test files

This patch may fix the GitHub issue #45290.

PiperOrigin-RevId: 347527218
Change-Id: I3442dd0f4d1e939787f4fb31c576f3a4368160bb
@terryheo
Copy link
Member

Could you try if the patch 9455057 helps?

@lxiao217
Copy link
Author

Could you try if the patch 9455057 helps?

thanks very much! i will try later.
when i build so in ubuntu16.04, i get the dynamic library libtensorflow-lite.so, but when i use it in my demo , errors were thrown like this:

/tmp/cifar10-d10aa3.o: In function cv::String::operator=(cv::String const&)': /usr/include/opencv2/core/cvstd.hpp:656: undefined reference to cv::String::deallocate()'
/home/xiaoling/tf_build/tflite_test/libs/x86_64/libtensorflow-lite.so: undefined reference to TfLiteXNNPackDelegateOptionsDefault' /home/xiaoling/tf_build/tflite_test/libs/x86_64/libtensorflow-lite.so: undefined reference to TfLiteXNNPackDelegateCreate'
/home/xiaoling/tf_build/tflite_test/libs/x86_64/libtensorflow-lite.so: undefined reference to `TfLiteXNNPackDelegateDelete'
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

when i build so, i close the switch to build with xnnpack:

option(TFLITE_ENABLE_XNNPACK "Enable XNNPACK backend" OFF)

this option is set ON default.

otherwise, seek for some helps:
when i build tflite, many thirdparty will be pull but the network speed is limited here, so i want to copy those 3rdparty to new folder where i want to save my building files. but the build script will delete files in these folder like eigen, and pull it from remote server in gitlab. this will waste me much time.
where i can set use local 3rdparty files, please give me some advise, i search in the build scripts will need much time. thanks for your help!

@banditopazzo
Copy link

when i build so in ubuntu16.04, i get the dynamic library libtensorflow-lite.so, but when i use it in my demo

Hi, we had the same problem (undefined reference to TfLiteXNNPackDelegateCreate, `TfLiteXNNPackDelegateDelete, also Parse and Merge problem).

The patch 9455057 seems to solve our issue, but it's not present in the r2.4 branch and we had to pull directly from the master

@sanatmpa1 sanatmpa1 self-assigned this Sep 1, 2021
@sanatmpa1
Copy link

@lxiao217,

Can you update to the latest stable version i.e 2.6.0 and let us know if the issue still persists? Thanks!

@sanatmpa1 sanatmpa1 added the stat:awaiting response Status - Awaiting response from author label Sep 1, 2021
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Sep 8, 2021
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite TF Lite related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype: ubuntu/linux Ubuntu/Linux Build/Installation Issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

7 participants