Last active
January 29, 2024 19:06
-
-
Save wavewave/97c802cb80aecf8146a7d5af21cf4bf1 to your computer and use it in GitHub Desktop.
Segfault with profiledGHC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GHC is built with `--flavour=perf+profiled_ghc+no_dynamic_ghc`. | |
Building this sample will yield segfaults in most cases (but nondeterministic). | |
``` | |
$ cabal build --project-file=ghcHEAD-cabal-profiledGHC.project | |
Build profile: -w ghc-9.9.20240115 -O0 | |
In order, the following will be built (use -v for more details): | |
- myfailure-2.11.0 (lib) (file MyFailure.hs changed) | |
Preprocessing library for myfailure-2.11.0.. | |
Building library for myfailure-2.11.0.. | |
<no location info>: warning: [GHC-42258] [-Wunused-packages] | |
The following packages were specified via -package or -package-id flags, | |
but were not needed for compilation: | |
- bytestring-0.12.0.2 (exposed by flag -package-id bytestring-0.12.0.2-inplace) | |
- http-conduit-2.3.8.3 (exposed by flag -package-id http-cndt-2.3.8.3-68b1c994) | |
- microlens-0.4.13.1 (exposed by flag -package-id mcrlns-0.4.13.1-4239c11e) | |
- aeson-2.2.0.0 (exposed by flag -package-id sn-2.2.0.0-921d37e9) | |
[1 of 1] Compiling MyFailure ( MyFailure.hs, /Users/ianwookim/tmp/profiledGHC/hoauth2-2.11.0/dist-newstyle/build/aarch64-osx/ghc-9.9.20240115/myfailure-2.11.0/noopt/build/MyFailure.o ) [Source file changed] | |
Error: cabal: Failed to build myfailure-2.11.0. The build process segfaulted | |
(i.e. SIGSEGV). | |
``` | |
Sometimes, more useful errors happen: | |
``` | |
$ cabal build --project-file=ghcHEAD-cabal-profiledGHC.project | |
Resolving dependencies... | |
Build profile: -w ghc-9.9.20240115 -O0 | |
In order, the following will be built (use -v for more details): | |
- myfailure-2.11.0 (lib) (first run) | |
Preprocessing library for myfailure-2.11.0.. | |
Building library for myfailure-2.11.0.. | |
<no location info>: warning: [GHC-42258] [-Wunused-packages] | |
The following packages were specified via -package or -package-id flags, | |
but were not needed for compilation: | |
- bytestring-0.12.0.2 (exposed by flag -package-id bytestring-0.12.0.2-inplace) | |
- http-conduit-2.3.8.3 (exposed by flag -package-id http-cndt-2.3.8.3-68b1c994) | |
- microlens-0.4.13.1 (exposed by flag -package-id mcrlns-0.4.13.1-4239c11e) | |
- aeson-2.2.0.0 (exposed by flag -package-id sn-2.2.0.0-921d37e9) | |
[1 of 1] Compiling MyFailure ( src/MyFailure.hs, /Users/ianwookim/tmp/profiledGHC/hoauth2-2.11.0/dist-newstyle/build/aarch64-osx/ghc-9.9.20240115/myfailure-2.11.0/noopt/build/MyFailure.o ) | |
src/MyFailure.hs:5:25: warning: [GHC-38856] [-Wunused-imports] | |
The import of 'unpack' from module 'Data.Text' is redundant | |
| | |
5 | import Data.Text (Text, unpack) | |
| ^^^^^^ | |
<no location info>: warning: [GHC-42258] [-Wunused-packages] | |
The following packages were specified via -package or -package-id flags, | |
but were not needed for compilation: | |
- bytestring-0.12.0.2 (exposed by flag -package-id bytestring-0.12.0.2-inplace) | |
- http-conduit-2.3.8.3 (exposed by flag -package-id http-cndt-2.3.8.3-68b1c994) | |
- microlens-0.4.13.1 (exposed by flag -package-id mcrlns-0.4.13.1-4239c11e) | |
- aeson-2.2.0.0 (exposed by flag -package-id sn-2.2.0.0-921d37e9) | |
[1 of 1] Compiling MyFailure ( src/MyFailure.hs, /Users/ianwookim/tmp/profiledGHC/hoauth2-2.11.0/dist-newstyle/build/aarch64-osx/ghc-9.9.20240115/myfailure-2.11.0/noopt/build/MyFailure.p_o ) | |
ghc: internal error: Relocation out of range for SUBTRACTOR | |
(GHC version 9.9.20240115 for aarch64_apple_darwin) | |
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug | |
Error: cabal: Failed to build myfailure-2.11.0. The build process terminated | |
with exit code -6 | |
``` | |
another case that happened was | |
``` | |
ghc: internal error: Relocation target for PAGE21 out of range. | |
``` | |
so I suspect this is related to a bug in GHC runtime linker doing code relocation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packages: ./myfailure.cabal | |
optimization: False | |
library-profiling: True | |
repository head.hackage.ghc.haskell.org | |
url: https://ghc.gitlab.haskell.org/head.hackage/ | |
secure: True | |
key-threshold: 3 | |
root-keys: | |
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 | |
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d | |
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 | |
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org | |
allow-newer: | |
base, | |
bytestring, | |
deepseq, | |
ghc-prim, | |
semigroupoids, | |
template-haskell, | |
text, | |
th-abstraction, | |
transformers, | |
vector | |
constraints: | |
base installed, | |
ghc installed, | |
ghc-bignum installed, | |
ghc-prim installed, | |
integer-gmp installed, | |
template-haskell installed, | |
text installed, | |
transformers installed | |
constraints: | |
aeson ==2.2.0.0, | |
http-client ==0.7.13.1, | |
th-abstraction ==0.6.0.0, | |
vector ==0.13.0.0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cabal-version: 2.4 | |
name: myfailure | |
-- http://wiki.haskell.org/Package_versioning_policy | |
version: 2.11.0 | |
synopsis: dummy | |
description: dummy | |
homepage: https://dummy.com | |
license: MIT | |
license-file: LICENSE | |
author: None | |
maintainer: None | |
copyright: None | |
category: None | |
build-type: Simple | |
stability: Beta | |
tested-with: GHC <=9.6.1 | |
extra-source-files: README.org | |
source-repository head | |
type: git | |
location: git://dummy.com | |
library | |
hs-source-dirs: . | |
default-language: Haskell2010 | |
exposed-modules: | |
MyFailure | |
default-extensions: | |
DeriveGeneric | |
GeneralizedNewtypeDeriving | |
ImportQualifiedPost | |
InstanceSigs | |
OverloadedStrings | |
PolyKinds | |
RecordWildCards | |
TypeFamilies | |
build-depends: | |
, aeson >=2.0 && <2.3 | |
, base >=4.11 && <5 | |
, bytestring >=0.9 && <0.13 | |
, http-conduit >=2.1 && <2.4 | |
, microlens ^>=0.4.0 | |
, text >=2.0 && <2.3 | |
, uri-bytestring >=0.2.3 && <0.4 | |
ghc-options: | |
-Wall -Wtabs -Wno-unused-do-bind -Wunused-packages -Wpartial-fields | |
-Wwarn -Wwarnings-deprecations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE QuasiQuotes #-} | |
module MyFailure where | |
import Data.Text (Text, unpack) | |
import URI.ByteString | |
import URI.ByteString.QQ | |
-- | Query Parameter Representation | |
data OAuth2 = OAuth2 | |
{ oauth2ClientId :: Text | |
, oauth2ClientSecret :: Text | |
, oauth2AuthorizeEndpoint :: URIRef Absolute | |
, oauth2TokenEndpoint :: URIRef Absolute | |
, oauth2RedirectUri :: URIRef Absolute | |
} | |
deriving (Show, Eq) | |
defOAuth2 :: OAuth2 | |
defOAuth2 = | |
OAuth2 | |
{ oauth2ClientId = "" | |
, oauth2ClientSecret = "" | |
, oauth2AuthorizeEndpoint = [uri|https://www.example.com/|] | |
, oauth2TokenEndpoint = [uri|https://www.example.com/|] | |
, oauth2RedirectUri = [uri|https://www.example.com/|] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment