Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 637
    • Merge requests 637
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21972

Error when building GHC on macOS 12.3.1: "unsupported relocation with subtraction expression"

Summary

I can't get GHC HEAD to build on macOS. First I tried the make build system but got an error I unfortunately didn't write down and don't remember. When I try hadrian it builds for a while and I eventually get:

...
| Run Ghc CompileHs Stage1: utils/hsc2hs/src/DirectCodegen.hs => _build/stage1/utils/hsc2hs/build/DirectCodegen.o
| Run Ghc CompileHs Stage1: libraries/text/src/Data/Text/Internal/Builder.hs => _build/stage1/libraries/text/build/Data/Text/Internal/Builder.p_o
Command line: _build/stage0/bin/ghc -Wall -Wcompat -dynamic-too -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-env -' '-package-db _build/stage1/lib/package.conf.d' '-package-id base-4.17.0.0' '-package-id containers-0.6.5.1' '-package-id directory-1.3.7.1' '-package-id filepath-1.4.2.2' '-package-id process-1.6.14.0' -i -i/Users/agrue/Developer/Projects/ghc/_build/stage1/utils/hsc2hs/build -i/Users/agrue/Developer/Projects/ghc/_build/stage1/utils/hsc2hs/build/hsc2hs/autogen -i/Users/agrue/Developer/Projects/ghc/utils/hsc2hs/src/ -Irts/include -I_build/stage1/utils/hsc2hs/build -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/process-1.6.14.0/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/unix-2.7.2.2/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/time-1.12.2/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/bytestring-0.11.3.0/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/base-4.17.0.0/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/ghc-bignum-1.3/include -I/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/x86_64-osx-ghc-9.5.20220806/rts-1.0.2/include -optP-include -optP_build/stage1/utils/hsc2hs/build/hsc2hs/autogen/cabal_macros.h -optc--target=x86_64-apple-darwin -optP-DIN_GHC_TREE -outputdir _build/stage1/utils/hsc2hs/build -fdiagnostics-color=always -Wnoncanonical-monad-instances -optc-Wno-unknown-pragmas -optP-Wno-nonportable-include-path -c utils/hsc2hs/src/DirectCodegen.hs -o _build/stage1/utils/hsc2hs/build/DirectCodegen.o -O2 -H32m -Wall -XHaskell2010 -no-global-package-db -package-db=/Users/agrue/Developer/Projects/ghc/_build/stage1/lib/package.conf.d -ghcversion-file=rts/include/ghcversion.h -ghcversion-file=rts/include/ghcversion.h
===> Command failed with error code: 1

/var/folders/yx/k08_sv315tg4nttf4tlt45gh0000gn/T/ghc4870_0/ghc_3.s:334:8: error:
     error: unsupported relocation with subtraction expression, symbol '_base_GHCziUnicodeziInternalziCharziUnicodeDataziSimpleUpperCaseMapping_zdwtoSimpleUpperCase_info' can not be undefined in a subtraction expression
            .quad   _base_GHCziUnicodeziInternalziCharziUnicodeDataziSimpleUpperCaseMapping_zdwtoSimpleUpperCase_info-(Ln3Ie)+0
                    ^
    |
334 |         .quad   _base_GHCziUnicodeziInternalziCharziUnicodeDataziSimpleUpperCaseMapping_zdwtoSimpleUpperCase_info-(Ln3Ie)+0
    |        ^
... (error repeats for other lines in the same file)

The only similar issue I was able to find is bgamari/ghc@bf10456e, which is ancient and seems unrelated.

Steps to reproduce

  • Checkout git commit f8bec4e37827bc8ff77a00773692fea4e7193af4

  • Run:

% ./boot
% ./configure CC=clang --with-intree-gmp
% hadrian/build -j

At first I tried just ./configure and then ./configure CC=clang but it doesn't make a difference.

Expected behavior

Successful GHC build

Environment

  • GHC version used: 9.2.3

Optional:

  • Operating System: macOS Monterey 12.3.1
  • System Architecture: Darwin (?)

This is on a MacBook Pro (15-inch, 2017) (Intel CPU)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking