[MacPorts] #71162: xar @1.8.0.501_0: error: implicit declaration of function 'xar_prop_get_expect_notnull' is invalid in C99 [-Werror, -Wimplicit-function-declaration]
MacPorts
noreply at macports.org
Thu Oct 24 00:53:04 UTC 2024
#71162: xar @1.8.0.501_0: error: implicit declaration of function
'xar_prop_get_expect_notnull' is invalid in C99 [-Werror,-Wimplicit-
function-declaration]
-------------------------+------------------------------
Reporter: ryandesign | Owner: Schamschula
Type: defect | Status: assigned
Priority: High | Milestone:
Component: ports | Version: 2.10.2
Resolution: | Keywords: bigsur, monterey
Port: xar |
-------------------------+------------------------------
Changes (by ryandesign):
* keywords: monterey => bigsur, monterey
Comment:
Replying to [ticket:71162 ryandesign]:
> {{{
> src/xar.c:678:11: error: implicit declaration of function
'xar_prop_get_expect_notnull' is invalid in C99 [-Werror,-Wimplicit-
function-declaration]
> if( 0 != xar_prop_get_expect_notnull((xar_file_t)x,
"checksum/offset" ,&value) ) {
> ^
> }}}
`xar_prop_get_expect_notnull` is declared in xar.h and defined in xar.c.
xar.c does `#include "xar.h"` thanks to patch-stdout.diff. Seems like that
should be enough.
However, I see that
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/xar/xar.h
also exists and it does not declare `xar_prop_get_expect_notnull`. It
seems to be including this file instead of the one included with the xar
source. I'm not sure why. The command looks right to me:
{{{
/usr/bin/clang -pipe -Os
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch
x86_64 -Iinclude -Iinclude -I/opt/local/include
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
-I/opt/local/include/libxml2 -c src/xar.c -o src/xar.o
}}}
I thought `-I` paths would be looked in first, before `-isysroot` and
`-isystem` paths. But the log shows it is accessing the file from the SDK:
{{{
src/xar.c:186:6: warning: 'xar_open' is deprecated: first deprecated in
macOS 12.0 - xar is a deprecated file format and should not be used.
[-Wdeprecated-declarations]
x = xar_open(filename, WRITE);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/xar/xar.h:158:7:
note: 'xar_open' has been explicitly marked deprecated here
}}}
Different OS versions including different versions of xar.h would
certainly account for why this problem occurs on some OS versions and not
others, but I don't think we want to use the OS version of xar.h on any OS
version.
I see that xar.c does also `#include "xar_internal.h"`, before including
xar.h. xar_internal.h does this:
{{{#!c
#ifdef XARSIG_BUILDING_WITH_XAR
#include "xar.h"
#else
#include <xar/xar.h>
#endif // XARSIG_BUILDING_WITH_XAR
}}}
So if `XARSIG_BUILDING_WITH_XAR` is defined then we wouldn't need to patch
xar.c to include xar.h. And if `XARSIG_BUILDING_WITH_XAR` is not defined
then the include of `<xar/xar.h>` will certainly find the system version,
not the one in the xar source.
xar.xcodeproj/project.pbxproj defines `XARSIG_BUILDING_WITH_XAR`:
{{{
OTHER_CFLAGS =
"-DXARSIG_BUILDING_WITH_XAR";
}}}
Maybe all we need to do is define that in the portfile as well, since the
portfile doesn't build using the Xcode project. I can try it in a moment.
--
Ticket URL: <https://trac.macports.org/ticket/71162#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list