Opened 4 years ago
Closed 3 years ago
#61628 closed defect (fixed)
git @2.29 +credential_osxkeychain+diff_highlight+pcre+perl5_28: cannot build when libarchive is active ("implicit declaration of function…")
Reported by: | jamadden (Jason Madden) | Owned by: | ci42 |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.4 |
Keywords: | Cc: | ||
Port: | git |
Description
(macOS 10.15.7; xcode 12.2)
Building builtin/archive.c
fails:
/usr/bin/clang -o builtin/archive.o -c -MF builtin/.depend/archive.o.d -MQ builtin/archive.o -MMD -MP -I/opt/local/include -I. -Wall -O2 -I/opt/local/include -arch x86_64 -I. -DPRECOMPOSE_UNICODE -DPROTECT_HFS_DEFAULT=1 -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/opt/local/include -I/opt/local/include -DUSE_CURL_FOR_IMAP_SEND -DNO_OPENSSL -I/opt/local/include -DUSE_ST_TIMESPEC -DSHA1_APPLE -DSHA256_BLK -DSHA1_MAX_BLOCK_SIZE="1024L*1024L*1024L" -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_NS_GET_EXECUTABLE_PATH -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DCOMMON_DIGEST_FOR_OPENSSL -DNO_MEMMEM -Icompat/regex -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"' builtin/archive.c builtin/archive.c:48:24: error: implicit declaration of function 'archive_format_from_filename' is invalid in C99 [-Werror,-Wimplicit-function-declaration] const char *format = archive_format_from_filename(name_hint); ^ builtin/archive.c:48:24: note: did you mean 'archive_read_open_filename'? /opt/local/include/archive.h:524:15: note: 'archive_read_open_filename' declared here __LA_DECL int archive_read_open_filename(struct archive *, ^ builtin/archive.c:48:15: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion] const char *format = archive_format_from_filename(name_hint); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ builtin/archive.c:101:2: error: implicit declaration of function 'init_archivers' is invalid in C99 [-Werror,-Wimplicit-function-declaration] init_archivers(); ^ builtin/archive.c:111:9: error: implicit declaration of function 'write_archive' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return write_archive(argc, argv, prefix, the_repository, output, 0); ^ builtin/archive.c:111:9: note: did you mean 'write_or_die'? die(_("git archive: Remote with no URL"));
In turns out that this is because builtin/archive.c
includes the line #include "archive.h"
expecting to get the archive.h
file from the root of the git tree. However, the CFLAGS place /opt/local/include
at the front of the include list, and libarchive supplies /opt/local/include/archive.h
, which overrides git's included archive.h
, leading to these errors.
The solution is to port deactivate libarchive
, upgrade/install git, and then re-activate libarchive.
This was a problem with all git 2.29 versions (I haven't been able to update since git @2.28.0_1+credential_osxkeychain+diff_highlight+pcre+perl5_28).
Change History (2)
comment:1 Changed 4 years ago by jmroot (Joshua Root)
Owner: | set to ci42 |
---|---|
Status: | new → assigned |
comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Priority: | Low → Normal |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Summary: | git @ 2.29 +credential_osxkeychain+diff_highlight+pcre+perl5_28: cannot build when libarchive is active ("implicit declaration of function…") → git @2.29 +credential_osxkeychain+diff_highlight+pcre+perl5_28: cannot build when libarchive is active ("implicit declaration of function…") |
This was fixed somewhere along the way. git @2.35.2 has -I.
preceding -I/opt/local/include
like it should and the build succeeds even if libarchive is installed.
/usr/bin/clang -o builtin/archive.o -c -MF builtin/.depend/archive.o.d -MQ builtin/archive.o -MMD -MP -Os -std=gnu99 -arch x86_64 -I. -DPRECOMPOSE_UNICODE -DPROTECT_HFS_DEFAULT=1 -DGIT_HOST_CPU="\"x86_64\"" -DUSE_LIBPCRE2 -I/opt/local/include -I/opt/local/include -DUSE_CURL_FOR_IMAP_SEND -DNO_OPENSSL -I/opt/local/include -DUSE_ST_TIMESPEC -DSUPPORTS_SIMPLE_IPC -DSHA1_APPLE -DSHA256_BLK -DSHA1_MAX_BLOCK_SIZE="1024L*1024L*1024L" -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_NS_GET_EXECUTABLE_PATH -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DCOMMON_DIGEST_FOR_OPENSSL -DNO_MEMMEM -Icompat/regex -DSHELL_PATH='"/bin/sh"' builtin/archive.c
This is indeed a bug with the ordering of the -I flags.
-I.
should always come before anything externally supplied.