Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 732686

Summary: dev-lang/ghc-8.0.2: fails to compile with lld: ld.lld: error: unknown argument '-no-relax'
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Gentoo's Haskell Language team <haskell>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 731004, 734886    
Attachments: build.log.bz2
other.tar.bz2

Description Agostino Sarubbo gentoo-dev 2020-07-15 07:06:21 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-lang/ghc fails to compile.
Discovered on: amd64  (internal ref: tinderbox)

NOTE:
This machine uses a clang/LLVM toolchain.
If you think that this issue is strictly related to clang/LLVM please block bug 408963. If you think that this issue isstrictly related to the LLD linker, please block bug 731004.
Comment 1 Agostino Sarubbo gentoo-dev 2020-07-15 07:06:26 UTC
Created attachment 649254 [details]
build.log.bz2

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2020-07-15 07:06:29 UTC
Created attachment 649256 [details]
other.tar.bz2

other logs
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2020-07-15 07:17:02 UTC
<no location info>: error:
    Warning: Couldn't figure out linker information!
             Make sure you're using GNU ld, GNU gold or the built in OS X linker, etc.
ld.lld: error: unknown argument '-no-relax'
collect2: error: ld returned 1 exit status
`x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
make[1]: *** [libraries/ghc-prim/ghc.mk:4: libraries/ghc-prim/dist-install/build/GHC/Types.o] Error 1

It's caused by /ghc-8.0.2-no-relax-everywhere.patch patch that fails to detect that linker is not a GNU linker:

index acd0d61..5830517 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2172,5 +2172,3 @@ joinObjectFiles dflags o_files output_fn = do
                         -- disable --relax explicitly.
-                     ++ (if platformArch (targetPlatform dflags)
-                                `elem` [ArchSPARC, ArchSPARC64]
-                         && ldIsGnuLd
+                     ++ (if ldIsGnuLd
                             then [SysTools.Option "-Wl,-no-relax"]

Probably because driver is called via -fuse-ld=lld. Or probably because bootstrap ghc was built using GNU linker.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-06 08:15:18 UTC
https://gitlab.haskell.org/ghc/ghc/-/commit/53ce0db5a06598c88c6b8cb32043b878e7083dd4 removed -no-relax option.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-06 08:15:34 UTC
*** Bug 734886 has been marked as a duplicate of this bug. ***
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 08:29:53 UTC
*** Bug 736104 has been marked as a duplicate of this bug. ***
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 08:30:56 UTC
*** Bug 736100 has been marked as a duplicate of this bug. ***
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 08:34:45 UTC
*** Bug 736018 has been marked as a duplicate of this bug. ***
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 08:40:33 UTC
*** Bug 736016 has been marked as a duplicate of this bug. ***
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 08:46:35 UTC
*** Bug 736010 has been marked as a duplicate of this bug. ***
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 09:28:02 UTC
*** Bug 736004 has been marked as a duplicate of this bug. ***
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-05 09:28:52 UTC
*** Bug 736002 has been marked as a duplicate of this bug. ***
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-09-12 08:28:51 UTC
*** Bug 735988 has been marked as a duplicate of this bug. ***