Opened 6 weeks ago

Last modified 4 weeks ago

#63678 new defect

mdbtools @1.0.0: error: implicit declaration of function 'mdb_set_repid_fmt' is invalid in C99

Reported by: greeneg (Gary Greene) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: catalina bigsur monterey Cc: mascguy (Christopher Nielsen), evanmiller (Evan Miller)
Port: mdbtools

Description (last modified by greeneg (Gary Greene))

Build fails with an error due to C99 constraints against implicit declarations:

:info:build   CC       sargs.lo
:info:build file.c:133:5: error: implicit declaration of function 'mdb_set_repid_fmt' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     mdb_set_repid_fmt(mdb, MDB_BRACES_4_2_2_8);
:info:build     ^

Change History (10)

comment:1 Changed 6 weeks ago by greeneg (Gary Greene)

Description: modified (diff)

comment:2 Changed 6 weeks ago by evanmiller (Evan Miller)

Thanks, I will investigate.

comment:3 Changed 6 weeks ago by evanmiller (Evan Miller)

Do you have mdbtools installed outside of MacPorts?

comment:4 Changed 6 weeks ago by ryandesign (Ryan Schmidt)

I have disabled the port's silent rules so that we can see the real compile commands.

The compilation of file.c looks like:

/usr/bin/clang [...] -I. -I/opt/local/include -I../../include [...] -c file.c [...]

In other words, a system include path -I/opt/local/include is erroneously appearing before a local include path -I../../include. ../../include is where mdbtools.h is located which contains the prototype for mdb_set_repid_fmt, but if a user already has mbdtools instaled with MacPorts then the copy of mdbtools.h in /opt/local/include will be found first. According to the NEWS file, mdb_set_repid_fmt was newly added in version 1.0.0. Therefore any user upgrading from a previous version to 1.0.0 will encounter this error. The fix is for the developers of mbdtools to ensure that the include flags for local directories always precede any system directories. This bug should be reported to the developers of the software. A workaround until the developers fix it could be to replace -I$(prefix}/include with -isystem${prefix}/include in configure.cppflags since -isystem paths are checked after all -I paths.

comment:5 Changed 6 weeks ago by ryandesign (Ryan Schmidt)

Keywords: catalina bigsur monterey added
Summary: mdbtools port fails to build on macOS Catalinamdbtools @1.0.0: error: implicit declaration of function 'mdb_set_repid_fmt' is invalid in C99

Implicit declaration of functions is reported as an error by Xcode 12 and later, so this affects Catalina and later.

Last edited 6 weeks ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:6 in reply to:  4 Changed 6 weeks ago by ryandesign (Ryan Schmidt)

Replying to ryandesign:

any user upgrading from a previous version to 1.0.0 will encounter this error

However after writing up that diagnosis I am unable to reproduce the issue on my own system. Still, I'll commit the workaround and you can check -- in an hour, and after running sudo port selfupdate -- whether you can now build it. If not, please attach the new main.log file.

comment:7 Changed 6 weeks ago by ryandesign (Ryan Schmidt)

In dc9820f7f93336bfa25df8ce7483cef0873d09d1/macports-ports (master):

mdbtools: Work around wrong include path order

See: #63678

comment:8 Changed 6 weeks ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 5 weeks ago by mascguy (Christopher Nielsen)

I'm curious whether reversing the include path order alone, fixes the issue: We tried something similar with notmuch, but it looks like we may have to reverse the link order too. See issue:63274

comment:10 Changed 4 weeks ago by evanmiller (Evan Miller)

Cc: evanmiller added
Note: See TracTickets for help on using tickets.