[pybsddb] berkelydb 18.1.6 compiler error with Clang

Jesus Cea jcea at jcea.es
Mon Aug 14 04:33:25 CEST 2023


On 14/8/23 3:58, Jesus Cea wrote:
> On 10/8/23 4:39, Himanshu Gohel wrote:
>> Gramps <https://gramps-project.org/blog/>[1] software is a consumer of 
>> bsddb3 6.2.9 package via MSYS2 <https://www.msys2.org/> [2]. The 
>> Windows build of Gramps is stuck because the package isn't available 
>> on MSYS2 at the moment. The maintainers at MSYS2 have removed it from 
>> the package repo because it fails to compile with Clang. The issue is 
>> documented in PR #17871 
>> <https://github.com/msys2/MINGW-packages/pull/17871> [3] specifically 
>> this error 
>> <https://github.com/msys2/MINGW-packages/pull/17871#issuecomment-1653908229> [4].
> 
> I find the discussion confusing and somewhat misleading. I would guess 
> the issue is that a pointer to a function is required and we are 
> providing a "function", not a pointer to it.

There is also an issue with a missing parameter. I can't understand how 
can that be possible when compiling against Oracle BDB 6.2, since my 
code reads as:

"""
static int
_db_compareCallback(DB* db,
             const DBT *leftKey,
             const DBT *rightKey
#if (DBVER >= 62)
           , size_t *locp
#endif
             )
"""

That is, if compiled under Berkeley DB 6.2, the extra parameter "locp" 
should be added to the function type definition. Could you possibly 
print the value of "DBVER" when trying to compile the failing code?

In fact, commenting out that preprocessor code, GCC refuses to compile 
and produces a similar error your are seeing, as expected:

"""
src/Module/berkeleydb.c:2850:46: note: expected ‘int (*)(DB *, const DBT 
*, const DBT *, size_t *)’ {aka ‘int (*)(struct __db *, const struct 
__db_dbt *, const struct __db_dbt *, long unsigned int *)’} but argument 
is of type ‘int (*)(DB *, const DBT *, const DBT *)’ {aka ‘int 
(*)(struct __db *, const struct __db_dbt *, const struct __db_dbt *)’}
"""

So, looks like something is going on with the "DBVER" value.

That value is defined in "berkeleydb.h", as

"""
#define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR)
"""

"DB_VERSION_MAJOR" and "DB_VERSION_MINOR" comes from BerkeleyDB header 
files. Maybe you have several BDB releases installed and compilation is 
mixing them?

Please, patch your code to provide values for "DB_VERSION_MAJOR", 
"DB_VERSION_MINOR" and "DBVER".

For example, before the line aborting the compilation you could do 
something like:

"""
#define STRINGIFY(s) XSTRINGIFY(s)
#define XSTRINGIFY(s) #s
#pragma message ("DBVER: " STRINGIFY(DBVER))
#pragma message ("DB_VERSION_MAJOR: " STRINGIFY(DB_VERSION_MAJOR))
#pragma message ("DB_VERSION_MINOR: " STRINGIFY(DB_VERSION_MINOR))
"""

It should print something like this when compiled against BDB 6.2:

"""
src/Module/berkeleydb.c:2747:9: note: #pragma message: DBVER: (6 * 10 + 2)
  2747 | #pragma message ("DBVER: " STRINGIFY(DBVER))
       |         ^~~~~~~
src/Module/berkeleydb.c:2748:9: note: #pragma message: DB_VERSION_MAJOR: 6
  2748 | #pragma message ("DB_VERSION_MAJOR: " STRINGIFY(DB_VERSION_MAJOR))
       |         ^~~~~~~
src/Module/berkeleydb.c:2749:9: note: #pragma message: DB_VERSION_MINOR: 2
  2749 | #pragma message ("DB_VERSION_MINOR: " STRINGIFY(DB_VERSION_MINOR))
       |         ^~~~~~~
"""

-- 
Jesús Cea Avión                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - https://www.jcea.es/    _/_/    _/_/  _/_/    _/_/  _/_/
Twitter: @jcea                        _/_/    _/_/          _/_/_/_/_/
jabber / xmpp:jcea at jabber.org  _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz


More information about the pybsddb mailing list