Bug 258811 - print/texinfo: respect CC
Summary: print/texinfo: respect CC
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-30 16:47 UTC by Ghost
Modified: 2022-07-11 21:55 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
v1 (use "git am") (709 bytes, patch)
2021-09-30 16:47 UTC, Ghost
no flags Details | Diff
v2 ("git am") (835 bytes, patch)
2022-07-09 20:08 UTC, Ghost
2khramtsov: maintainer-approval? (sunpoet)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ghost 2021-09-30 16:47:13 UTC
Created attachment 228290 [details]
v1 (use "git am")

print/texinfo uses both CC values by default:

1. For itself, taken from $CC: https://git.savannah.gnu.org/cgit/texinfo.git/tree/configure.ac?h=texinfo-6.8#n194

2. For Perl extension (XS) modules, taken from Perl, unless PERL_EXT_CC is passed:
https://git.savannah.gnu.org/cgit/texinfo.git/tree/configure.ac?h=texinfo-6.8#n55
https://git.savannah.gnu.org/cgit/texinfo.git/tree/tp/Texinfo/XS/configure.ac?h=texinfo-6.8#n77

If one wants to build a compiler (e.g. devel/llvm13) from ports while not having base compiler (cc) (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257622#c2),
and using Perl built using older compiler which no longer exists (or, while having no base cc when using devel/llvm12 and Perl bootstrapped from pkg.FreeBSD.org), then a mismatch will happen, e.g.:

1:
[...]
checking whether the compiler supports GNU C... yes
checking whether /usr/local/llvm13/bin/clang accepts -g... yes
checking for /usr/local/llvm13/bin/clang option to enable C11 features... none needed
checking whether /usr/local/llvm13/bin/clang understands -c and -o together... yes
checking whether the compiler is clang... yes
[...]

2:
[...]
checking for perl... (cached) /usr/local/bin/perl
checking Perl configuration value cc... /usr/local/llvm12/bin/clang
checking Perl configuration value ccflags... -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DUSE_THREAD_SAFE_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include
checking Perl configuration value cccdlflags... -DPIC -fPIC
checking Perl configuration value optimize... -O2 -pipe -O3 -mtune=skylake -mbranches-within-32B-boundaries -fstack-protector-all -fPIE -fPIC -fno-strict-aliasing
checking Perl configuration value ccdlflags...  -Wl,-R/usr/local/lib/perl5/5.32/mach/CORE
checking Perl configuration value libperl... libperl.so.5.32.1
checking Perl configuration value archlibexp... /usr/local/lib/perl5/5.32/mach
checking Perl configuration value privlibexp... /usr/local/lib/perl5/5.32
checking for gcc... /usr/local/llvm12/bin/clang
checking whether the C compiler works... no
configure: error: in `/wrkdirs/usr/ports/print/texinfo/work/texinfo-6.8/tp/Texinfo/XS':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: error: ./configure failed for tp/Texinfo/XS
configure: building Perl extension (XS) modules will be disabled
[...]

Respect CC using PERL_EXT_CC environment variable to avoid chicken and egg problem.

Sorry for not leaving a short reproducer, I'll get back to submitting a reproducer later after finishing some of my other tasks. I leave this PR here
so the community can find this.
Comment 1 Ghost 2022-07-09 20:08:15 UTC
Created attachment 235153 [details]
v2 ("git am")

Rebase and add a reproducer:

poudriere bulk -j 131 -p main print/texinfo
rm /usr/local/poudriere/data/packages/131-main/All/texinfo*
zfs rename zpool/poudriere/jails/131@clean zpool/poudriere/jails/131@tclean
mv /usr/local/poudriere/jails/131/usr/bin/cc /usr/local/poudriere/jails/131/usr/bin/c
zfs snapshot zpool/poudriere/jails/131@clean
echo 'CC=/usr/bin/c' > /usr/local/etc/poudriere.d/131-main-make.conf
poudriere testport -j 131 -p main print/texinfo
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-07-11 21:55:15 UTC
A commit in branch main references this bug:

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

commit 81c9b39c0ac0e9d708079e2000ae906c50e7a7cf
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-07-11 21:47:44 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-07-11 21:47:44 +0000

    print/texinfo: Respect CC

    Fix build when default cc (/usr/bin/cc) is missing.

    PR:             258811
    Reported by:    Evgeniy Khramtsov <evgeniy@khramtsov.org>

 print/texinfo/Makefile | 1 +
 1 file changed, 1 insertion(+)
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-07-11 21:55:16 UTC
Committed. Thanks!