Opened 2 years ago

Closed 2 years ago

#63678 closed defect (fixed)

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

Reported by: greeneg (Gary Greene) Owned by: ryandesign (Ryan Carsten Schmidt)
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 (12)

comment:1 Changed 2 years ago by greeneg (Gary Greene)

Description: modified (diff)

comment:2 Changed 2 years ago by evanmiller (Evan Miller)

Thanks, I will investigate.

comment:3 Changed 2 years ago by evanmiller (Evan Miller)

Do you have mdbtools installed outside of MacPorts?

comment:4 Changed 2 years ago by ryandesign (Ryan Carsten 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 2 years ago by ryandesign (Ryan Carsten 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 an error in Xcode 12 and later, so this affects Catalina and later.

Version 0, edited 2 years ago by ryandesign (Ryan Carsten Schmidt) (next)

comment:6 in reply to:  4 Changed 2 years ago by ryandesign (Ryan Carsten 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 2 years ago by ryandesign (Ryan Carsten Schmidt)

In dc9820f7f93336bfa25df8ce7483cef0873d09d1/macports-ports (master):

mdbtools: Work around wrong include path order

See: #63678

comment:8 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 2 years 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 2 years ago by evanmiller (Evan Miller)

Cc: evanmiller added

comment:11 in reply to:  9 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Status: newassigned

Replying to mascguy:

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

It is possible that that is also necessary. Who knows, without further investigation, whether they made the flag ordering mistake only with CPPFLAGS or also with LDFLAGS.

comment:12 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Given that there has been no further response in this ticket I will assume that my previous change fixed the problem. If not, please reopen.

Note: See TracTickets for help on using tickets.