go-tflite
go-tflite copied to clipboard
tensorflowlite-delegate_xnnpack lib missing
I am trying to get XNNPACK support working but I seem to be missing required libraries
ubuntu:~/src/go-tflite/_example/label_image_xnnpack$ go run main.go
# command-line-arguments
/opt/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -ltensorflowlite-delegate_xnnpack: No such file or directory
collect2: error: ld returned 1 exit status
Where should tensorflowlite-delegate_xnnpack be available? My tflite build produced only libtensorflowlite_c.so.
This seems to be an easy fix for tensorflow lite 2.14.0, just remove -ltensorflowlite-delegate_xnnpack from xnnpack.go
@tphakala How did you remove it? I got a similar error:
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: cannot find -ltensorflowlite-delegate_xnnpack: No such file or directory
/usr/bin/ld: cannot find -lXNNPACK: No such file or directory
collect2: error: ld returned 1 exit status
When I try to remove it from xnnpack.go I still get the same errors. To confirm that my changes are actually used I imported a test.h file within xnnpack.go. I got the corresponding error so it seems that my changes are applied in general. But the error that the two libraries are missing remain. This confuses me as I didn't find any other places where these libraries are importet.
As an alternative any hint on how to build these libraries would be great, too.
I have fixed xnnpack.go in my fork of go-tflite at https://github.com/tphakala/go-tflite/blob/master/delegates/xnnpack/xnnpack.go, maybe I should file a pull request. This "/usr/bin/ld: cannot find -lXNNPACK: No such file or directory" however indicates that you do not have XNNPACK library on your system.
@tphakala thanks for the hint! Could you tell me where to get that XNNPACK library from? Until now I assumed that it was build into libtensorflowlite_c.so and I didn't find any sources on how to build a seperate XNNPACK library.
XNNPACK is a separate library, I don't know which system you are using but on Debian or Ubuntu you can install it by "apt install libxnnpack0 libxnnpack-dev". XNNPACK source is available at https://github.com/google/XNNPACK and it is easy to build if you are on system with no prepackaged library available.
Depending on build method of libtensorflow-lite, the library .a itself might include XNNPACK.