The berkeley-db module's configure script adds -Werror to CFLAGS. With recent versions of GCC, this code triggers a warning (and therefore an error) about the use of an uninitialized variable:
DB_ENV dbe; dbe.set_errcall(&dbe,&my_callback);
There are multiple possible fixes. I chose to also add -Wno-uninitialized to CFLAGS in this patch. Not adding -Werror is another option.
Patch to add -Wno-uninitialized to CFLAGS
the configure check is there for a good reason.
this works fine with clang-900.0.38 on x86_64-apple-darwin16.7.0,
I'm not sure what "works fine" means, as this depends on which warning flags you pass to the compiler. With the default flags used by Fedora, namely "-Wall", the configure script incorrectly says:
checking whether DB_ENV->set_errcall() accepts DBE... no
It does, in fact, accept DBE. In config.log I see:
configure:5749: checking whether DB_ENV->set_errcall() accepts DBE
configure:5769: gcc -c -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -Wa,--noexecstack -Werror -I/usr/include/libsvm conftest.c >&5
conftest.c: In function 'main':
conftest.c:51:16: error: 'dbe.set_errcall' is used uninitialized in this function [-Werror=uninitialized]
DB_ENV dbe; dbe.set_errcall(&dbe,&my_callback);
~~~^~~~~~~~~~~~
cc1: all warnings being treated as errors
configure:5769: $? = 1
configure: failed program was:
| / confdefs.h /
...
When building with clang, do you have -Wall in CFLAGS? Is DB_ENV->set_errcall() detected as accepting DBE?
Yes,
DB_ENV->set_errcall()is correctly detected:if your system passes "unusual" options to
gcc, this is probably not the right place to discuss this.Either
autoconfshould handle this, or the system should not modifygcccommand line options.At any rate, please discuss this with the
autoconfmaintainers and bring back their verdict on how this issue is to be handled.Thanks.