Opened 5 months ago

Last modified 4 months ago

#72975 new defect

git fails to build if libarchive is active: error: implicit declaration of function 'archive_format_from_filename' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.11.5
Keywords: catalina Cc: ryandesign (Ryan Carsten Schmidt), herbygillot (Herby Gillot)
Port: git

Description

Could someone confirm this?

/usr/bin/clang -o builtin/archive.o -c -MF builtin/.depend/archive.o.d -MQ builtin/archive.o -MMD -MP    -I/opt/local/include -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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/archive.c
/usr/bin/clang -o builtin/backfill.o -c -MF builtin/.depend/backfill.o.d -MQ builtin/backfill.o -MMD -MP    -I/opt/local/include -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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/backfill.c
/usr/bin/clang -o builtin/bisect.o -c -MF builtin/.depend/bisect.o.d -MQ builtin/bisect.o -MMD -MP    -I/opt/local/include -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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/bisect.c
/usr/bin/clang -o builtin/blame.o -c -MF builtin/.depend/blame.o.d -MQ builtin/blame.o -MMD -MP    -I/opt/local/include -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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/blame.c
builtin/archive.c:43: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:43:24: note: did you mean 'archive_read_open_filename'?
/opt/local/include/archive.h:569:15: note: 'archive_read_open_filename' declared here
__LA_DECL int archive_read_open_filename(struct archive *,
              ^
builtin/archive.c:43: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:100:2: error: implicit declaration of function 'init_archivers' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        init_archivers();
        ^
builtin/archive.c:112:8: error: implicit declaration of function 'write_archive' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = write_archive(argc, argv, prefix, repo, output, 0);
              ^
1 warning and 3 errors generated.
make: *** [builtin/archive.o] Error 1
make: *** Waiting for unfinished jobs....

Change History (1)

comment:1 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

No, I do not see this on my (macOS 15 x86_64) system.

Your log (I'm not sure what version you were building but 2.51.0 was current when you filed this ticket) has -I/opt/local/include before -I. which causes the problem:

/usr/bin/clang -o builtin/archive.o -c -MF builtin/.depend/archive.o.d -MQ builtin/archive.o -MMD -MP    -I/opt/local/include -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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/archive.c

Mine (2.51.1) doesn't:

/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_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"git-compat-util.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_DEV_TTY -DHAVE_BSD_SYSCTL -DHAVE_GETDELIM -DHAVE_ARC4RANDOM  -DAPPLE_COMMON_CRYPTO -DFREAD_READS_DIRECTORIES -DOPEN_RETURNS_EINTR -DNO_MEMMEM -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS -DHAVE_FSMONITOR_DAEMON_BACKEND -DHAVE_FSMONITOR_OS_SETTINGS -DSHELL_PATH='"/bin/sh"'  builtin/archive.c

The port file says:

set CFLAGS          "${configure.cflags} -std=gnu99 [get_canonical_archflags cc]"

It doesn't use ${configure.cppflags} which is where -I/opt/local/include would come from. So if your Portfile is the same as ours, this shouldn't be happening.

Note: See TracTickets for help on using tickets.