Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal-install can't link pandoc-types #189336

Closed
mhwombat opened this issue Sep 1, 2022 · 8 comments
Closed

cabal-install can't link pandoc-types #189336

mhwombat opened this issue Sep 1, 2022 · 8 comments
Labels
0.kind: bug Something is broken

Comments

@mhwombat
Copy link
Contributor

mhwombat commented Sep 1, 2022

Describe the bug

Today I ran sudo nixos-rebuild switch --upgrade, and suddenly none of the pandoc filters that I have developed will build.

Steps To Reproduce

Steps to reproduce the behavior:

  1. In an empty directory, create a simple Haskell program that uses pandoc-types.
cat Main.hs
module Main where

import qualified Text.Pandoc      as P
import Text.Pandoc.JSON            (toJSONFilter)

formatColumns :: P.Block -> P.Block
formatColumns = id

main :: IO ()
main = toJSONFilter formatColumns
  1. Create a simple cabal file.
cat cabal-pandoc-issue.cabal
cabal-version:      3.0
name:               cabal-pandoc-issue
version:            0.1.0.0
category:           Text
build-type:         Simple
extra-doc-files:    CHANGELOG.md

executable cabal-pandoc-issue
    main-is:          Main.hs
    build-depends:
        base ^>=4.15.1.0,
        pandoc,
        pandoc-types
    default-language: Haskell2010
  1. Try to build the program.
nix-shell -p "haskellPackages.ghcWithPackages (p: [p.pandoc p.pandoc-types])"cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - cabal-pandoc-issue-0.1.0.0 (exe:cabal-pandoc-issue) (first run)
Configuring executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Preprocessing executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Building executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
[1 of 1] Compiling Main             ( Main.hs, /home/amy/cabal-pandoc-issue/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue-tmp/Main.o )
Linking /home/amy/cabal-pandoc-issue/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue ...
/nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1/lib/ghc-9.0.2/x86_64-linux-ghc-9.0.2/pandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs/libHSpandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs.a(Definition.o)(.text..Lr1pVA_info+0x22): error: relocation overflow: reference to local symbol 833 in /nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1/lib/ghc-9.0.2/x86_64-linux-ghc-9.0.2/pandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs/libHSpandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs.a(Definition.o)
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)

Expected behavior

Cabal-install should be able to link this.

Screenshots

Not applicable.

Additional context

Not applicable.

Notify maintainers

@sternenseemann

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.63, NixOS, 22.11 (Raccoon), 22.11pre405311.97747d3209e`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@mhwombat mhwombat added the 0.kind: bug Something is broken label Sep 1, 2022
@cdepillabout
Copy link
Member

Is it possible you're running into some sort of problem like #169332 (comment) ?

@mhwombat
Copy link
Contributor Author

mhwombat commented Sep 3, 2022

I did rm -rf ~/.cabal (as recommended in #169332) and tried again, but got the same result.

@mhwombat
Copy link
Contributor Author

mhwombat commented Sep 3, 2022

Also, other programs I've written in Haskell (that don't use pandoc) are compiling without problems, so this doesn't seem to be a global issue.

@cdepillabout
Copy link
Member

Huh, that's interesting. I just copied your files locally, did:

$ nix-shell -p "haskellPackages.ghcWithPackages (p: [p.pandoc p.pandoc-types])" -p cabal-install

And then from the shell did:

$ cabal build
Warning: The package list for 'hackage.haskell.org' is 47 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - cabal-pandoc-issue-0.1.0.0 (exe:cabal-pandoc-issue) (first run)
Configuring executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Preprocessing executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Building executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
[1 of 1] Compiling Main             ( Main.hs, /home/illabout/temp/pandoc-types-test/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pan
doc-issue/cabal-pandoc-issue-tmp/Main.o )
Linking /home/illabout/temp/pandoc-types-test/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue ...
$

As you can see, everything appears to be working correctly. This is on 22.05 at c06d5fa on x86_64-linux.

I thought maybe it was a problem with nixos-unstable, so I also tried:

$ nix-shell -p "haskellPackages.ghcWithPackages (p: [p.pandoc p.pandoc-types])" -p cabal-install -I nixpkgs=channel:nixos-unstable

And then did:

$ rm -rf ~/.cabal/{packages,store}
$ cabal update
$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - cabal-pandoc-issue-0.1.0.0 (exe:cabal-pandoc-issue) (first run)
Configuring executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Preprocessing executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Building executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
[1 of 1] Compiling Main             ( Main.hs, /home/illabout/temp/pandoc-types-test/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pan
doc-issue/cabal-pandoc-issue-tmp/Main.o )
Linking /home/illabout/temp/pandoc-types-test/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue ...

Which also works. This is on 2da64a8.

So my best guess is that this is some problem on your system, but if you already tried rm -rf ./dist-newstyle ~/.cabal, I don't have a good idea what could be the problem you're seeing.

@mhwombat
Copy link
Contributor Author

mhwombat commented Sep 3, 2022

Thank you for trying. I'll experiment a bit and see if I can narrow down the problem any further.

In the meantime, just to check my own sanity, here's a test i did just now. As you can see, I removed ~/.cabal and there's no ./dist-newstyle or other build artifacts in the directory.

❯ rm -rf ~/.cabal

~/cabal-pandoc-issue via λ 9.0.2 
❯ ls -a
.  ..  cabal-pandoc-issue.cabal  Main.hs

~/cabal-pandoc-issue via λ 9.0.2 
❯ nix-shell -p "haskellPackages.ghcWithPackages (p: [p.pandoc p.pandoc-types])" -p cabal-install -I nixpkgs=channel:nixos-unstable

~/cabal-pandoc-issue via λ 9.0.2 via ❄️  impure (shell) 
❯ cabal update
Config file path source is default config file.
Config file not found: /home/amy/.cabal/config
Writing default configuration to /home/amy/.cabal/config
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org has been updated.
The index-state is set to 2022-09-03T19:04:13Z.

~/cabal-pandoc-issue via λ 9.0.2 via ❄️  impure (shell) took 20s 
❯ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - cabal-pandoc-issue-0.1.0.0 (exe:cabal-pandoc-issue) (first run)
Configuring executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Preprocessing executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
Building executable 'cabal-pandoc-issue' for cabal-pandoc-issue-0.1.0.0..
[1 of 1] Compiling Main             ( Main.hs, /home/amy/cabal-pandoc-issue/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue-tmp/Main.o )
Linking /home/amy/cabal-pandoc-issue/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-pandoc-issue-0.1.0.0/x/cabal-pandoc-issue/build/cabal-pandoc-issue/cabal-pandoc-issue ...
/nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1/lib/ghc-9.0.2/x86_64-linux-ghc-9.0.2/pandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs/libHSpandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs.a(Definition.o)(.text..Lr1pVA_info+0x22): error: relocation overflow: reference to local symbol 833 in /nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1/lib/ghc-9.0.2/x86_64-linux-ghc-9.0.2/pandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs/libHSpandoc-types-1.22.2.1-DMBE1SgShBR4Tq1LFTfSNs.a(Definition.o)
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)

@mhwombat
Copy link
Contributor Author

mhwombat commented Sep 3, 2022

Curiouser and curiouser! I checked my nix-store, and there seems to be an issue with pandoc-type, among other packages.

❯ nix store verify --all
path '/nix/store/20awaxxy50h9y5kzdxjkakvsyg1p2chq-dependent-map-0.4.0.0' was modified! expected hash 'sha256:1dqis5sniha5gsa6c5802s8qmnhxa3hxiy1j41hnbbb604khir0i', got 'sha256:16bcxv93zdvvwpsdz3h720c6wlpddx49r6mwd4fy2swhpymzlavj'
path '/nix/store/94vpl96y4gdhwz707fnphv780kc2qlr6-hls-graph-1.7.0.0' was modified! expected hash 'sha256:1ivx9hydajxinw4n407l2l39ihm6kcy2yjqk1cdj3gb24pyb2hmi', got 'sha256:0h1x592mva937c6qj71vwy6227m2sx8z6z2jgf61bi79cwl70s3v'
path '/nix/store/rkl2pamdqbxjxqfc1mqsz1ghcpilzn6d-implicit-hie-0.1.2.7' was modified! expected hash 'sha256:16kipikfv9bpnbfqbc1nwahcd0655shnzal9vdqw8avkn8c8ipsk', got 'sha256:02kak0prgjrml4h090ljklq9l61fpjfrhy5wrb9lpdk6m3cyl6r5'
path '/nix/store/mdsb16khv90ddsyxdxr3vncn35afad83-lens-aeson-1.1.3' was modified! expected hash 'sha256:0ac7dblpdr2q9yrhdwxlaj7ps598z9k8kz30xsga2apprbmsij66', got 'sha256:0cxsc9kbd5s6snf71mqjnqcwyl0g3wkv3kv42f0s31sazp9hqhgx'
path '/nix/store/kby3pnhvmypcnkpr3m0pppdhpd5zj47p-hiedb-0.4.1.0' was modified! expected hash 'sha256:03xk4w3qhsrk6scdxr89i5ysbcasxvq0nl4s58ngkf8jpks1hpc2', got 'sha256:0bkqzc0acnzjc41n9cdgbv739l2v5i6jb6il1825278pm9a5r8i5'
path '/nix/store/jx92iiisyqa2xym1v6iw39b8l1k15ajs-hie-bios-0.9.1' was modified! expected hash 'sha256:051dm9fqw0vj84a8f62lrxlad93hmn1312phsmsr68h3s2ya0s2q', got 'sha256:1czgi3asn24f7pccdq8lja1wir05n8k9airg6625k0sxvr19nh8g'
path '/nix/store/966ddyig2ml6x89qma3pflnjafblxvdv-lens-5.0.1' was modified! expected hash 'sha256:0lay7lkmbnan19yrd3rk05kykj1dijivcgv1ycpn8zhn3kafm92h', got 'sha256:1m4llmfk4vg7mzjc6aavanwrydsq8k4hjcllfb15ldwsg4abi4k2'
path '/nix/store/h37rirvbb254yv50p26wc4dr2r4x3wid-retrie-1.1.0.0' was modified! expected hash 'sha256:03sih8c1alcsphy6kvshralmw1wr6lkzhrx3q8x2hckrvmch93wl', got 'sha256:0f765z6l433lr9qgqzjxyll6a92pp7gjf151yhn47nsr6nlchy9j'
path '/nix/store/y6r3a2v8wqs7kh6s85hg54jhsa9azr16-lsp-types-1.4.0.1' was modified! expected hash 'sha256:1jcfndykw3bqxyzibi5qsnpvx99whc8jwrggaqxdh8wdbh7zvyri', got 'sha256:1zmmbr58mr4lb6j9msccdvl6vf5kiin2f6g5m94f7xf8rz6md638'
path '/nix/store/500hgnsk77cs40fmhmq3hv47kyvfaq69-openjdk-17.0.4+8' was modified! expected hash 'sha256:0qrbw37sazn644csn7pyijs43ffjrjl5kc4q3j3vw03vhfqv4ls4', got 'sha256:1daln2z0mllxy6sl91r8zl6qzz9wp4x8ikrx9djhn74n6lprz6h4'
path '/nix/store/fhx4zr0hj4wzkfaj7s9jazjrmfls6pqk-apply-refact-0.9.3.0' was modified! expected hash 'sha256:05idp8lf3kfkljmj2y3wzv0wsg2dm4siix2aq578670j2d9pr92c', got 'sha256:1z1djh71a3ryqi6ly2n80phmd4hkqpfkhw5x4nn133xc57ca31yk'
path '/nix/store/9ncdim7bf8ymmcpm35pvqw1qq5l61sdc-hlint-3.3.6' was modified! expected hash 'sha256:0rp9r675z9jk6fa5w6aqpfdcasmgspna2nm5kj53sj7z2g4bsdjx', got 'sha256:0fpmr7wm4ggqc7ilb82yavry747ydig100xkfxw3a1p1rb80b9c6'
path '/nix/store/w5fd1anzylrwcacr5l2rqnqmsy42dlaz-ghc-lib-parser-9.2.4.20220729' was modified! expected hash 'sha256:0pdzmj1mpihpsrj9yim913vz8gh7flgqk454pdj2ak2cgx99a2sd', got 'sha256:17qmav5dd689qxgnqf5lx2kx7hncnz0hrrl29g525dg4sb1qziq9'
path '/nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1' was modified! expected hash 'sha256:1aqqwqmvflj941z88rr62a7whd22haz1lkm4n0h89vi55nd565iy', got 'sha256:0yfq4d2zla29k1x18g96li1z64ibmnqn5pk627rsqprlx17rk8rv'
path '/nix/store/f4hazqq75dikxa0fb2ys8z00ghcby03h-ghc-lib-parser-9.0.2.20211226' was modified! expected hash 'sha256:15qazv72rvkvqzl2qrhd9d88z8kclr4jm9hcyqmmsqni6ixc1n0a', got 'sha256:0qbf2v0kdf65hij97h5xbyksjq99aayf5a9xxr9ir0ikx8jlr0s8'
path '/nix/store/9qg0slyiaqc4r6cm4375wzb937740alr-xml-conduit-1.9.1.1' was modified! expected hash 'sha256:0s8zq7dmgikn93dl2k6r8s2l9mxry4kbbv0s94wjdapznh0ppr6z', got 'sha256:0k04fzscg6x4lr3bprx4qq4zl3yr7cq3r01ssil6w1mqxg4was90'
path '/nix/store/kp6nr4xg4gvk3zpgxadmpi9x6vr3hpf7-ipynb-0.2' was modified! expected hash 'sha256:0bc1xy24qrzs30yzhmpmlpj3cmar2m5jfc7zff0bmgccazbrday2', got 'sha256:11pn2q1mia67c7prg712yfba1abj66l9w1dlkkr06axkcyhmzvc2'
path '/nix/store/gjw3bq1glyqlmqpnz8wahd43mm0lca7f-pandoc-lua-marshal-0.1.7' was modified! expected hash 'sha256:031wm55i9sd87inkjqbkbvxmxqljiw2xml06c93as5p9pn73arc6', got 'sha256:131vx869km34ag8z4pnizkp34zd8h51ixw7qh01f04hlq2ppzqzd'
path '/nix/store/z7iqdpxhql3pq4vv2qmlsg9kqbaqjp0z-doctemplates-0.10.0.1' was modified! expected hash 'sha256:18nv2kn4fv9qn6xxfs93mgl13z6lwgyx8aqzz38m3ih3wgsh0v83', got 'sha256:1s3gybf080kfagxghr04arzq0705wmkq3b64533jkz52mdf0rzly'
path '/nix/store/y7i3d0fq3n1r9cixkdvi1hw6iknlfrs7-skylighting-core-0.12.3.1' was modified! expected hash 'sha256:1z2rvbhv1326maf8iav0vnz8jkjdf05fag1q0hv8xajdp0dpkvim', got 'sha256:1v17pirjgcm7bmi43hh81hhdqcqq9bcsnlbnzh638n5a43pvqnm9'
path '/nix/store/g85ll1c1pxvxf25dbwmsgq6a68s140hv-citeproc-0.6.0.1' was modified! expected hash 'sha256:1d8xnhg97k2gf8dc5w9mvh2syxh2rbkd0faiv8bdpsg6xvmnwgxb', got 'sha256:1df576dj54kch0840srwv8sl5r64hkhspbl17hjchndqd8c91g48'
path '/nix/store/c6bl5pqwzvz89bd42rxm07cqw4yhkb5c-tls-1.5.8' was modified! expected hash 'sha256:14flxlsk4nmkhxxnk2f8y9m0r7dazxwim437w7xjz8cwqpvnghxk', got 'sha256:19ymhrnzjzqpggjqfhp0idl9m288xr3b6h2jy6k16vcdspi58g2w'
path '/nix/store/ic2r0iwzrh6d990jf47qr0799fzi1x2x-floskell-0.10.6' was modified! expected hash 'sha256:0a3x2a3cqmriz3p5lhmnsbn4w2cqgifl9hka1cpny4xapw057wr8', got 'sha256:1mkh4ka26md1qfjs1y268qpqfz153d83ll2qx4jxpw5h8bph5crq'
path '/nix/store/kkvjrsn6x8h3g0hhfms0g8nhjiibysxd-texmath-0.12.4' was modified! expected hash 'sha256:18pksjw1ps9y1lv22saizhyxh0515fyv3gmh19hiqqnghxrmw62a', got 'sha256:0411fhzjjqjqmx3yhri9d9cb0caqqgbda1iql7a5fmd4j1bk1b2y'
path '/nix/store/30fcccw0pyk9h626sbj75pc3s68k51m0-libreoffice-7.2.6.2' was modified! expected hash 'sha256:100s5fnsih7bk83ljij7kv080ip8j6qxvm0hjdj2s70myb7rsn9r', got 'sha256:01krdnbgvvhksd17kbc6l4l72bvy3w07wh9vyiq4rzrv11lw11j9'

@mhwombat
Copy link
Contributor Author

mhwombat commented Sep 3, 2022

Solved! After checking the store for problems with nix store verify --all, I then repaired each reported problem. For example:

sudo nix store repair /nix/store/bbgmrb37psjkkpxly60zg9w56sfyszrq-pandoc-types-1.22.2.1

And now it builds!

@mhwombat mhwombat closed this as completed Sep 3, 2022
@cdepillabout
Copy link
Member

Oh nice, good solve! I definitely wouldn't have thought to check the health of the /nix/store!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants