[Bug 273091] lang/ghc 9.4.6 fails to build without the addition of iconv configure flags

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 14 Aug 2023 21:19:39 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273091

--- Comment #20 from Kevin Reinholz <kreinholz@gmail.com> ---
(In reply to Kevin Reinholz from comment #11)

OK, now I think we're getting somewhere! I deleted all instances of GCC from my
system in order to force use of the base system LLVM. ghc-9.4.6 builds
perfectly fine from the vanilla Port files, no edits to the Makefile or feeding
of extra configure options required.

Glancing at the logs, I think this is the issue: with lang/gcc12 installed, the
following check occurs on line 1996 of "ghc_build_failure_part01.log" (the
first attachment to this bug report):

1996 checking for gcc... /usr/local/bin/gcc^M
1997 checking for g++... /usr/local/bin/g++^M

Contrast this with line 1990 of "ghc_llvm_build_log-part1.log" (first part of
the most recent series of 4 attachments):

1990 checking for gcc... clang^M
1991 checking for g++... clang++^M

It seems that if GCC is installed, ghc's configure script finds it and selects
it as the compiler. If GCC is not installed, it reverts of LLVM/clang as a
backup.

I have no flags set in /etc/make.conf that should cause Ports to prefer GCC
over LLVM:

DEFAULT_VERSIONS+=ssl=base

MAKE_JOBS_UNSAFE=yes
DISABLE_VULNERABILITIES=yes

NO_SENDMAIL=true

OPTIONS_FILE_UNSET+=GTK2
OPTIONS_FILE_SET+=GTK3

DEFAULT_VERSIONS+=perl5=5.34

WITHOUT_WARNS=yes

Maybe ghc should check for the presence of clang, rather than gcc, and select
that as its compiler if found?

STEPS TO REPRODUCE REPORTED BUG:

sudo pkg install gcc12

After which attempt to build ghc-9.4.6 from Ports. It will erroneously select
GCC as the compiler over base system LLVM, and then fail to find inconv in
/usr/include and /usr/lib. (But can still build successfully if told to look
for iconv in /usr/local/include and /usr/local/lib).

I suspect GCC's issue might be the inconsistent naming of the base system iconv
libs vice those found in /usr/local/lib:

% ls /usr/include | grep iconv 
iconv.h

% ls /usr/lib | grep iconv
libkiconv_p.a
libkiconv.a
libkiconv.so

% ls /usr/local/include | grep iconv
iconv.h
uniconv.h

% ls /usr/local/lib | grep iconv   
libiconv.a
libiconv.so
libiconv.so.2
libiconv.so.2.6.1
libsiconv.a
libsiconv.so
libsiconv.so.1.0

-- 
You are receiving this mail because:
You are the assignee for the bug.