Bug 257566

Summary: security/cyrus-sasl2: Fails to configure when CC does not exist (WITHOUT_CLANG): configure:5100: error: no acceptable C compiler found in $PATH
Product: Ports & Packages Reporter: Ghost <2khramtsov>
Component: Individual Port(s)Assignee: Hajimu UMEMOTO <ume>
Status: Closed FIXED    
Severity: Affects Some People CC: 2khramtsov, danfe, ume
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (ume)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v1 (use "git am") 2khramtsov: maintainer-approval? (ume)

Description Ghost 2021-08-02 16:34:21 UTC
Created attachment 226882 [details]
v1 (use "git am")

/usr/bin/cc can be absent due to base built WITHOUT_CLANG,
external toolchain from ports can be installed instead.

Respect $CC from environment, e.g. when
/usr/local/share/toolchains/*.mk gets included:

configure:4847: checking for gcc
configure:4877: result: no
configure:4940: checking for cc
configure:4987: result: no
configure:5043: checking for cl.exe
configure:5073: result: no
configure:5097: error: in `/usr/local/poudriere/ports/ei/security/cyrus-sasl2/work/cyrus-sasl
    -2.1.27':
configure:5100: error: no acceptable C compiler found in $PATH

security/cyrus-sasl2 cannot detect devel/llvm12, at least (and w/ $PATH adjusted)

Tier 1 architectures poudriere:

11.4/i386 OK:
bulk diff https://codeberg.org/ei/misc/commit/ef89234a
pkg diff https://codeberg.org/ei/misc/commit/a53552d4
testport https://codeberg.org/ei/misc/commit/3bc0cd7e

11.4/amd64: OK
bulk diff https://codeberg.org/ei/misc/commit/7aaf154e
pkg diff https://codeberg.org/ei/misc/commit/a85bbbc3
testport https://codeberg.org/ei/misc/commit/6339fe2c

12.2/i386: OK
bulk diff https://codeberg.org/ei/misc/commit/e4971a28
pkg diff https://codeberg.org/ei/misc/commit/767aedd8
testport https://codeberg.org/ei/misc/commit/4915eb70

12.2/amd64: OK
bulk diff https://codeberg.org/ei/misc/commit/07e7716b
pkg diff https://codeberg.org/ei/misc/commit/034da552
testport https://codeberg.org/ei/misc/commit/31c7e883

13.0/amd64: OK
bulk diff https://codeberg.org/ei/misc/commit/ab62c9d1
pkg diff https://codeberg.org/ei/misc/commit/cb8a8da1
testport https://codeberg.org/ei/misc/commit/a4ce4cef

13.0/aarch64 (via qemu-user-static): OK
bulk diff https://codeberg.org/ei/misc/commit/70648b43
pkg diff https://codeberg.org/ei/misc/commit/27b51c86
testport https://codeberg.org/ei/misc/commit/1fcd3d55

Note, now that CC is respected, native-xtoolchain for 13.0/aarch64 gets
used by default, and the build is about ~3 seconds shorter.

Extracted package *contents* (! MANIFEST) ("pkg diff") did not change, PORTREVISION is left intact.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-08-03 03:51:36 UTC
A correctly written autoconf build will see and honour CC from the environment, whether or not specific compiler binaries are specified or searched. The patch set CC_FOR_BUILD to CC, but the next line shows a check for the presence of CC (which ports provides).

Is there something else involved here? I note the port does not currently use autoreconf or similar, is that a factor?
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2021-08-03 03:52:01 UTC
Comment on attachment 226882 [details]
v1 (use "git am")

^Triage: Currently set a maintainer value
Comment 3 Ghost 2021-08-03 05:07:31 UTC
(In reply to Kubilay Kocak from comment #1)

(repost from #ports)

Thanks. autoreconf, and also various workarounds from git log --grep='respect CC' -p don't help. An alternate approach without touching the configure file would be to add BINARY_ALIAS=   cc=${CC} ld=${LD} to the Makefile, but the configure is already being patched in the port, and adjusting just CC_FOR_BUILD also adjusts LD (and likely more if needed).
Comment 4 Ghost 2021-08-05 11:48:08 UTC
Passing CC_FOR_BUILD like ports-mgmt/pkg does via
CONFIGURE_ENV=      CC_FOR_BUILD="${CC}"
also works, patching the configure file is not needed.
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-08-07 03:09:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d4a8178cf538b155170f7e2497fcb57bf95868e2

commit d4a8178cf538b155170f7e2497fcb57bf95868e2
Author:     Hajimu UMEMOTO <ume@FreeBSD.org>
AuthorDate: 2021-08-07 03:01:25 +0000
Commit:     Hajimu UMEMOTO <ume@FreeBSD.org>
CommitDate: 2021-08-07 03:08:29 +0000

    security/cyrus-sasl2: Respect CC.

    PR:             257566

 security/cyrus-sasl2/Makefile.common | 1 +
 1 file changed, 1 insertion(+)
Comment 6 Hajimu UMEMOTO freebsd_committer freebsd_triage 2021-08-07 03:13:33 UTC
Thanks, committed!
Comment 7 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-08-19 10:07:48 UTC
Thank you!  This also allows me to remove the ccache-disabling hack when building this port in the tinderbox.