Bug 256605 - lang/ghc: Fails to build on aarch64
Summary: lang/ghc: Fails to build on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Mikael Urankar
URL: https://cloud.zyxst.net/~john/FreeBSD...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-14 16:55 UTC by tech-lists
Modified: 2021-06-25 07:54 UTC (History)
1 user (show)

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


Attachments
v0 (1.59 KB, patch)
2021-06-15 18:00 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tech-lists 2021-06-14 16:55:48 UTC
Hi,

context:
arm64 bare metal
poudriere-devel-3.3.99.20210521

installed llvm:

# pkg info -x llvm
llvm10-10.0.1_5

in the poudriere host:

# pkg search -x llvm
The provides database is up-to-date.
llvm10-10.0.1_5                LLVM and Clang
llvm90-9.0.1_3                 LLVM and Clang

error building lang/ghc:

[...]
02:21:03] <no location info>: error:
[02:21:03]     Warning: Couldn't figure out LLVM version!
[02:21:03]              Make sure you have installed LLVM between 10 and 12
[02:21:03] 
[02:21:03] <no location info>: error:
[02:21:03]     Warning: Couldn't figure out LLVM version!
[02:21:03]              Make sure you have installed LLVM between 10 and 12
[...]

ending with:

[02:22:03] <no location info>: error:
[02:22:03]     Warning: Couldn't figure out LLVM version!
[02:22:03]              Make sure you have installed LLVM between 10 and 12
[02:22:03] ghc-stage1: could not execute: opt
[02:22:03] gmake[2]: *** [rts/ghc.mk:322: rts/dist/build/Apply.o] Error 1
[02:22:03] gmake[2]: *** Waiting for unfinished jobs....
[02:22:04] gmake[1]: *** [Makefile:128: all] Error 2
[02:22:04] gmake[1]: Leaving directory '/wrkdirs/usr/ports/lang/ghc/work/ghc-8.10.5'
[02:22:04] ===> Compilation failed unexpectedly.
[02:22:04] Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
[02:22:04] the maintainer.
[02:22:04] *** Error code 1
[02:22:04] 
[02:22:04] Stop.
[02:22:04] make: stopped in /usr/ports/lang/ghc
[02:25:53] =>> Cleaning up wrkdir
[02:25:55] ===>  Cleaning for ghc-8.10.5
[02:25:55] build of lang/ghc | ghc-8.10.5 ended at Mon Jun 14 17:07:41 BST 2021
[02:25:55] build time: 02:25:55
[02:25:55] !!! build failure encountered !!!

full log: https://cloud.zyxst.net/~john/FreeBSD/ports/ghc/ghc-8.10.5.log
Comment 1 tech-lists 2021-06-14 19:34:50 UTC
the above was arm64.aarch64, am trying now on amd64
Comment 2 tech-lists 2021-06-14 20:17:24 UTC
(In reply to tech-lists from comment #1)

ok the problem is only on arm64.aarch64 bare metal
Comment 3 Mikael Urankar freebsd_committer 2021-06-15 18:00:25 UTC
Created attachment 225831 [details]
v0

It looks like the binary_alias doesn't work anymore :(
Can you try the attached patch (CONFIGURE_ENV_PRECONF should probably be named differently but couldn't figure out a better name)
Comment 4 tech-lists 2021-06-15 21:08:53 UTC
(In reply to Mikael Urankar from comment #3)
Hi,

I've applied your patch (thank you!) and it's building now, (it'll be a while ;))
Comment 5 tech-lists 2021-06-16 16:09:05 UTC
(In reply to Mikael Urankar from comment #3)
Hi,

Confirmed your patch works, many thanks
Comment 6 commit-hook freebsd_committer 2021-06-24 16:01:10 UTC
A commit in branch main references this bug:

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

commit e099e7c8c360778d6cd73b916fb87e905fbfbd19
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2021-06-20 16:01:39 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2021-06-24 16:00:25 +0000

    lang/ghc: Fix build on aarch64

    BINARY_ALIAS doesn't work anymore.
    Pass the correct environment variables in the pre-configure target instead.

    PR:             256605
    Reported by:    tech-lists@zyxst.net
    Approved by:    arrowd (previous version)

 lang/ghc/Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)