'make -C lang/ghc configure' fails if lang/gcc is installed (not just lang/gcc12): error: gcc: error: unrecognized command-line option '--target=x86_64-portbld-freebsd--lflag=--target=x86_64-portbld-freebsd' This has been happening since the update to 9.4.5 in late May. However, I had built 9.2.7 BEFORE the switch to Hadrian. I have not tried building the 9.2.7 port after the switch to Hadrian. This is on stable-12/amd64. I'll attach the build log.
I reproduced the issue, but didn't find an easy fix. Unfortunately, I'm drowned in other work, so will not be able to look at that. You might want try reporting this upstream, as the problem seems to be not in our Ports machinery.
Adding 'CC=cc' to the configure command in pre-configure seems to do the job. I did not have to add CC=cc to the later configure (in pre-install) to get the build to succeed. The pre-install configure DOES still detect gcc ("checking for gcc... gcc"), but I don't know if that will affect anything at run time. It couldn't hurt to add CC=cc to that configure command as well - I just don't know yet if that is necessary. I will also sign up to upstream gitlab, and try to report this.
Created attachment 242878 [details] [patch] explicitly use base cc (clang) - v0 During pre-configure, explicitly specify base CC=cc - cc is clang now in all supported major versions of FreeBSD (even powerpc these days I think, but I have not confirmed that). This works around whatever bootstrap issue is going on with gcc (possibly FreeBSD specific, but not known at this time). With this patch, poudriere now builds lang/ghc if lang/gcc is installed (tested on 12-amd64/stable).
Created attachment 242879 [details] [patch] explicitly use base cc (clang) - v1 v1: Same as v0 (specify CC=cc for pre-configure with default BOOT=off), but add CC=cc for the configure called during pre-install as well. This version is not needed to fix the build problem. One may consider selecting this version at least for consistency. I did not do any extensive run-time testing with either version yet.
Created attachment 242950 [details] Patch CXX as well
I had to patch the `pre-install` target's configure with the CXX compiler in order to get this build, otherwise I ran into problems finding libstdc++, otherwise: […] configure:7672: $CC is not gcc; assuming it's a reasonably new C compiler configure:7678: checking whether CC supports -no-pie configure:7688: result: no configure:7694: checking for extra options to pass gcc when compiling via C configure:7708: result: configure:7716: checking Setting up CFLAGS, LDFLAGS, IGNORE_LINKER_LD_FLAGS and CPPFLAGS configure:7810: result: done configure:7815: checking Setting up CONF_CC_OPTS_STAGE0, CONF_GCC_LINKER_OPTS_STAGE0, CONF_LD_LINKER_OPTS_STAGE0 and CONF_CPP_OPTS_STAGE0 configure:7909: result: done configure:7914: checking Setting up CONF_CC_OPTS_STAGE1, CONF_GCC_LINKER_OPTS_STAGE1, CONF_LD_LINKER_OPTS_STAGE1 and CONF_CPP_OPTS_STAGE1 configure:8008: result: done configure:8014: checking Setting up CONF_CC_OPTS_STAGE2, CONF_GCC_LINKER_OPTS_STAGE2, CONF_LD_LINKER_OPTS_STAGE2 and CONF_CPP_OPTS_STAGE2 configure:8108: result: done configure:8220: checking C++ standard library flavour configure:8233: result: libstdc++ configure:2: checking for linkage against 'stdc++' configure:15: result: failed configure:2: checking for linkage against 'stdc++ supc++' configure:15: result: failed configure:8279: error: Failed to find C++ standard library […]
(In reply to Mark Evenson from comment #6) err the `pre-install` target. The compilation wrt. the invoking ports Makefile itself succeeds.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=57bf75dc7fbd09e9cacfe6f077876b66bca618de commit 57bf75dc7fbd09e9cacfe6f077876b66bca618de Author: Gleb Popov <arrowd@FreeBSD.org> AuthorDate: 2023-06-24 14:17:13 +0000 Commit: Gleb Popov <arrowd@FreeBSD.org> CommitDate: 2023-06-24 15:03:11 +0000 lang/ghc: Pass CC and CXX to Hadrian to fix build in lang/gcc presence. PR: 271928 Reported by: John Hein <jcfyecrayz@liamekaens.com>, Mark Evenson <evenson.not.org@gmail.com> lang/ghc/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Thanks both of you, pushed in.
(In reply to Gleb Popov from comment #9) Gleb and other haskell-aware people, This might be a separate bug / question, but it's loosely related to this bug... When one builds ghc in poudriere, llvm12 is not installed (since it is not a dependency). But there is a configure problem (a couple times during 'make configure' and once during 'make stage') looking for llc12 and opt12. Both of those are explicitly specified in configure args (in lang/ghc/Makefile) when BOOT=off. What is the impact on ghc (build, run, or testing) when missing llc and opt tools? =========== . . ./configure: llc12: not found no configure: We only support llvm 10 to 15 (no version found). ./configure: opt12: not found no configure: We only support llvm 10 to 15 (no version found). . . ===========
LLVM is only required on aarch64. It is perfectly OK that it can't find it on i386 or amd64.