Skip to content

depends bdb -Werror=format-security "format not a string literal and no format arguments" #25211

@ryanofsky

Description

@ryanofsky

Running make -C depends on nixos with gcc 10.3.0 results in

libtool: compile:  gcc -c -I. -I../dist/./.. -I/home/russ/work/bitcoin/depends/x86_64-pc-linux-gnu/include -D_GNU_SOURCE -D_REENTRANT -pipe -O2 -Wno-error=implicit-function-declaration ../dist/./../txn/txn.c  -fPIC -DPIC -o txn.o
../dist/./../txn/txn.c: In function ‘__txn_begin’:
../dist/./../txn/txn.c:171:3: error: format not a string literal and no format arguments [-Werror=format-security]
  171 |   __db_errx(env, TxnAlloc);
      |   ^~~~~~~~~
../dist/./../txn/txn.c: In function ‘__txn_compensate_begin’:
../dist/./../txn/txn.c:318:3: error: format not a string literal and no format arguments [-Werror=format-security]
  318 |   __db_errx(env, TxnAlloc);
      |   ^~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [Makefile:1980: txn.o] Error 1
make[1]: Leaving directory '/home/russ/work/bitcoin/depends/work/build/x86_64-pc-linux-gnu/bdb/4.8.30-1205703c56a/build_unix'
make: *** [funcs.mk:288: /home/russ/work/bitcoin/depends/work/build/x86_64-pc-linux-gnu/bdb/4.8.30-1205703c56a/build_unix/.stamp_built] Error 2
make: Leaving directory '/home/russ/work/bitcoin/depends'

I could work around it with

diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk
index dc536fd3991..b69276cb154 100644
--- a/depends/packages/bdb.mk
+++ b/depends/packages/bdb.mk
@@ -14,7 +14,7 @@ $(package)_config_opts_freebsd=--with-pic
 $(package)_config_opts_netbsd=--with-pic
 $(package)_config_opts_openbsd=--with-pic
 $(package)_config_opts_android=--with-pic
-$(package)_cflags+=-Wno-error=implicit-function-declaration
+$(package)_cflags+=-Wno-error=implicit-function-declaration -Wno-error=format-security
 $(package)_cxxflags+=-std=c++17
 $(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
 endef

But I don't know if this is the right fix or if there possibly is a real bug in the code causing the warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions