First the background to our problem.
We are trying to use `cppcheck` for static code analysis in our prioject. The way to identify all the source file with compilation flags is to use a tool called `bear` to log all compilation commands in `make` and build a database of the commands.
This works fine, for all compilation commands.
The issue is that we need to generate a .dfu using `nrfutil pkg` command, and we do that in our CI environment by running it all in a docker container.
The issue is when running `nrfutil pkg` in a makefile that is running through `bear` on that system, we get the following error:
root@0a85e4983f2c:/# bear -- nrfutil pkg /usr/lib/x86_64-linux-gnu/bear/wrapper: /tmp/_MEID3Luz1/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libspdlog.so.1.10)
But running without `bear` we get a valid output:
root@0a85e4983f2c:/# nrfutil pkg Usage: pc_nrfutil_legacy_v6.1.7 pkg [OPTIONS] COMMAND [ARGS]...
I would have investigated more myself if nrfutil where open source. But now I'm stuck...
Note that this is just to simplify the test. I have one rule in a much bigger set of makefiles that uses nrfutil, that triggers the error. The rest of the rules is the ones I want bear to log.
The `bear` tool can be found here:
https://github.com/rizsotto/Bear
Tried to open an issue to `bear` too, where there response is available:
https://github.com/rizsotto/Bear/issues/556
To reproduce (also available in the ticket linked above):
Easiest is to run via docker. Therefore install docker, and create a directory containing a file called `Dockerfile`:
FROM debian:bookworm-20231120 RUN apt update && apt install -y wget bear ADD https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil /usr/local/bin/nrfutil RUN chmod +x /usr/local/bin/nrfutil && nrfutil install nrf5sdk-tools
When standing in that directory, type:
docker build -t bear_nrfutil_test . docker run --rm -t bear_nrfutil_test bear -- nrfutil pkg # not working docker run --rm -t bear_nrfutil_test nrfutil pkg # working
If you want to enter the docker container interactively, run:
docker run --rm -t -i bear_nrfutil_test
Then you'll get a command prompt having nrfutil available.
I don't really know if this is a bear issue or an nrfutil issue. But I'm having hard time tracking it down, and just want the build to work.