Created attachment 202671 [details] patch GCC architectures currently use GNU ld 2.17 (no lld). Linking some hs- ports fails, because of too large TOC. In case of C or C++ programs, you can usually add -mminimal-toc to CFLAGS or CXXFLAGS to mitigate it, but I didn't find a similar option for GHC. Thus, use GNU ld from ports to fix build. Tested on powerpc64 and amd64. Hardware sponsored by IntegriCloud.
Created attachment 202674 [details] v2 Fix some more ports. Add support to define some options only for some architectures to bsd.cabal.options.mk. This is needed to use integer-gmp and SSE only on amd64 and i386.
I don't have these errors on ppc64, ghc is supposed to use binutils:ld on ppc64, what's the result of grep "ld command" /usr/local/lib/ghc-8.6.4/settings?
(In reply to mikael.urankar from comment #2) root@talos:$~$ grep "ld command" /usr/local/lib/ghc-8.6.3/settings ("ld command", "/usr/local/bin/ld"), But some ports still need USE_BINUTILS anyway. E.g. another failing port: root@talos:$/usr/ports/devel/hs-free$ make -V LD ld
(In reply to Piotr Kubaj from comment #3) Ok, I'm seeing that too with DYNAMIC option on (I turned it off to do some quick test and forgot to update my option) I think we can use devel/binutils by default on ppc64 since it's kind of mandatory on ppc64: Index: bsd.cabal.mk =================================================================== --- bsd.cabal.mk (revision 495702) +++ bsd.cabal.mk (working copy) @@ -54,7 +54,7 @@ CABAL_LIBDIR= ${PREFIX}/lib/cabal/ghc-${GHC_VERSION} CABAL_LIBSUBDIR= ${PACKAGE} -CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/} +CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/:S/powerpc64/ppc64/} CABAL_ARCHSUBDIR= ${CABAL_ARCH}-freebsd-ghc-${GHC_VERSION} CABAL_LIBDIR_REL= ${CABAL_LIBDIR:S,^${PREFIX}/,,} @@ -93,6 +93,9 @@ BUILD_DEPENDS+= ghc>=${GHC_VERSION}:lang/ghc .endif +.if ${ARCH} == powerpc64 +USE_BINUTILS= yes +.endif CONFIGURE_ARGS+= --with-gcc=${CC} --with-ld=${LD} --with-ar=${AR}
(In reply to mikael.urankar from comment #4) Only the CABAL_ARCH part is needed.
I have the default configuration with DYNAMIC off, though: root@talos:$~$ pkg options ghc ghc - BOOT: off ghc - DOCS: off ghc - DYNAMIC: off ghc - GMP: off ghc - PROFILE: off
(In reply to Piotr Kubaj from comment #6) I confirm the issue with all options off, it's fixed by adding these lines to bsd.cabal.mk +.if ${ARCH} == powerpc64 +USE_BINUTILS= yes +.endif
(In reply to mikael.urankar from comment #7) Thanks for confirming it. @haskell Can you commit this patch to bsd.cabal.mk and the part with SSE2?
(In reply to Piotr Kubaj from comment #8) Thanks, for this. Could you create a unified diff for the whole change?
Created attachment 203021 [details] v3 Sure, attached.
(In reply to Piotr Kubaj from comment #10) There is already .if ${ARCH} == powerpc64 block on 134 line. Please add USE_BINUTILS knob there. Other than that, the patch looks OK.
(In reply to Gleb Popov from comment #11) There is, but not in bsd.cabal.mk, only in bsd.ghc.mk. I tested that adding USE_BINUTILS to bsd.ghc.mk doesn't change LD of hs-* ports.
Oh, you're right. I'm OK with the patch, then.
A commit references this bug: Author: arrowd Date: Thu Mar 21 17:38:11 UTC 2019 New revision: 496481 URL: https://svnweb.freebsd.org/changeset/ports/496481 Log: bsd.cabal.mk: Add USE_BINUTILS for powerpc64 arch and add support for FLAGS_DEFAULT_${ARCH} variables. PR: 236346 Submitted by: Piotr Kubaj <pkubaj@anongoth.pl> Reviewed by: Mikael Urankar <mikael.urankar@gmail.com> Approved by: tcberner (mentor) Changes: head/devel/hs-hashable/Makefile head/lang/ghc/bsd.cabal.mk head/lang/ghc/bsd.cabal.options.mk
Thanks everyone for your input.