Building can be a bit tricky because of the many dependencies. It is recommended to follow the building locally guide for building the project. However, there is also a provided devcontainer approach that allows for easy development.
For convenient development in VSCode, a devcontainer can be used. Simply open the project in VSCode and hit F1
, type Remote-Containers: Reopen in Container
and wait for the container to build.
The provided .devcontainer/devcontainer.json
contains all required dependencies and also mounts the source code into the container, so one can immediately start coding. When the container starts, a development server is started that can be reached at localhost:8080. The server automatically reloads the application on any code changes.
Note: Ensure Docker and VSCode with Remote Development extension are installed.
Download precompiled TensorFlow Lite C library for Linux from https://github.com/tphakala/tflite_c/releases/tag/v2.14.0
Copy libtensorflowlite_c.so to /usr/local/lib and run ldconfig
sudo cp libtensorflowlite_c.so /usr/local/lib
sudo ldconfig
Clone tensorflow repository, this is required for header files to be present while compiling with CGO
mkdir ~/src
cd ~/src
git clone https://github.com/tensorflow/tensorflow.git
Checkout TensorFlow v2.14.0 release
cd tensorflow
git checkout tags/v2.14.0
Clone BirdNET-Go repository
git clone https://github.com/tphakala/BirdNET-Go.git
Build BirdNET-Go by make, compiled binary will be placed in go-birdnet/bin directory
cd BirdNET-Go
make
Windows build is cross compiled on Linux, for this you need MinGW-w64 on your build system
sudo apt install mingw-w64-tools gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
Download precompiled TensorFlow Lite C library for Windows from https://github.com/tphakala/tflite_c/releases/tag/v2.14.0
Copy libtensorflowlite_c.dll to /usr/x86_64-w64-mingw32/lib/
sudo cp libtensorflowlite_c.dll /usr/x86_64-w64-mingw32/lib/
Clone tensorflow repository, this is required for header files to be present while compiling with CGO
mkdir ~/src
cd ~/src
git clone https://github.com/tensorflow/tensorflow.git
Clone BirdNET-Go repository
git clone https://github.com/tphakala/BirdNET-Go.git
Build BirdNET-Go by running make windows
cd BirdNET-Go
make windows
Windows executable is in bin/birdnet.exe, copy this and libtensorflowlite_c.so to your Windows system, library file must be in PATH for birdnet.exe to run properly.
Yes it is correct that you need libtensorflowlite_c.dll in /usr/x86_64-w64-mingw32/lib/ for compile process, and on Windows you need libtensorflowlite_c.so for runtime. This sounds backwards but this is how it works.