ekmett / folds

Folds and sequence algebras
Other
18 stars 11 forks source link

ghc_30.ldscript: file not recognized #7

Closed peti closed 7 years ago

peti commented 10 years ago

Do you have any idea what might be causing the compiler/linker at the end of this snippet?

Configuring folds-0.6.2...
Flags chosen: optimize=True, test-hlint=True, test-doctests=True
Dependency base ==4.*: using base-4.7.0.1
Dependency comonad ==4.*: using comonad-4.2.2
Dependency contravariant >=0.4.2 && <2: using contravariant-1.1
Dependency lens ==4.*: using lens-4.3.3
Dependency pointed ==4.*: using pointed-4.1
Dependency profunctors ==4.*: using profunctors-4.2.0.1
Dependency reflection >=1.3 && <2: using reflection-1.5.1
Dependency semigroupoids ==4.*: using semigroupoids-4.2
Dependency tagged >=0.7 && <1: using tagged-0.7.2
Dependency transformers >=0.3 && <0.5: using transformers-0.3.0.0
Dependency vector ==0.10.*: using vector-0.10.11.0
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc --info
Using Cabal-1.18.1.3 compiled by ghc-7.8
Using compiler: ghc-7.8.3
Using install prefix:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared
Binaries installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/bin
Libraries installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/lib/ghc-7.8.3/folds-0.6.2
Private binaries installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/libexec
Data files installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/share/x86_64-linux-ghc-7.8.3/folds-0.6.2
Documentation installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/share/doc/x86_64-linux-ghc-7.8.3/folds-0.6.2
Configuration files installed in:
/nix/store/w2r51k0qwbl1vdxjqaj8dgi6hvrid6ci-haskell-folds-ghc7.8.3-0.6.2-shared/etc
No alex found
Using ar found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.8.3 found on system at:
/nix/store/085j31s6pfdwn6xl1g0x3i4pjcn2wvwf-gcc-wrapper-4.8.3/bin/gcc
Using ghc version 7.8.3 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc
Using ghc-pkg version 7.8.3 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc-pkg
No greencard found
Using haddock version 2.14.3 found on system at:
/nix/store/kb4kpcvmiiacvfabjldk7590js6v1f41-ghc-7.8.3/bin/haddock
No happy found
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/hpc
Using hsc2hs version 0.67 found on system at:
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/hsc2hs
Using hscolour version 1.20 found on system at:
/nix/store/02wqac6yyanhmhhzyy0f8vamk0b681br-haskell-hscolour-ghc7.8.3-1.20.3-shared/bin/HsColour
No hugs found
No jhc found
Using ld found on system at:
/nix/store/085j31s6pfdwn6xl1g0x3i4pjcn2wvwf-gcc-wrapper-4.8.3/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/ranlib
Using strip found on system at:
/nix/store/ngsbygsjzv0fbj1543306l0a48qqy1vs-binutils-2.23.1/bin/strip
Using tar found on system at:
/nix/store/jff4a6zqi0yrladx3kwy4v6844s3swpc-gnutar-1.27.1/bin/tar
No uhc found
building
Building folds-0.6.2...
Preprocessing library folds-0.6.2...
[ 1 of 11] Compiling Data.Fold.Internal ( src/Data/Fold/Internal.hs, dist/build/Data/Fold/Internal.o )
[ 2 of 11] Compiling Data.Fold.Class  ( src/Data/Fold/Class.hs, dist/build/Data/Fold/Class.o )
[ 3 of 11] Compiling Data.Fold.L      ( src/Data/Fold/L.hs, dist/build/Data/Fold/L.o )
[ 4 of 11] Compiling Data.Fold.L'     ( src/Data/Fold/L'.hs, dist/build/Data/Fold/L'.o )
/tmp/nix-build-haskell-folds-ghc7.8.3-0.6.2-shared.drv-0/ghc303_0/ghc303_26.ldscript: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
peti commented 10 years ago

Note: the error disappears when I pass --disable-split-objs in the configure stage.

glguy commented 10 years ago

Just as a data-point the package builds on OS X using GHC 7.8.3 using the latest libraries on hackage using the default flags as of the time of this response.

peti commented 8 years ago

Still happens with folds-0.7 and GHC 7.10.3:

building
Building folds-0.7...
Preprocessing library folds-0.7...
[ 1 of 11] Compiling Data.Fold.Internal ( src/Data/Fold/Internal.hs, dist/build/Data/Fold/Internal.o )
[ 2 of 11] Compiling Data.Fold.Class  ( src/Data/Fold/Class.hs, dist/build/Data/Fold/Class.o )
[ 3 of 11] Compiling Data.Fold.L      ( src/Data/Fold/L.hs, dist/build/Data/Fold/L.o )

src/Data/Fold/L.hs:28:1: Warning:
    The import of ‘Data.Profunctor.Closed’ is redundant
      except perhaps to import instances from ‘Data.Profunctor.Closed’
    To import instances alone, use: import Data.Profunctor.Closed()
[ 4 of 11] Compiling Data.Fold.L'     ( src/Data/Fold/L'.hs, dist/build/Data/Fold/L'.o )

src/Data/Fold/L'.hs:28:1: Warning:
    The import of ‘Data.Profunctor.Closed’ is redundant
      except perhaps to import instances from ‘Data.Profunctor.Closed’
    To import instances alone, use: import Data.Profunctor.Closed()
/tmp/nix-build-folds-0.7.drv-0/ghc551_0/ghc_30.ldscript: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
RyanGlScott commented 8 years ago

@peti, I discovered why this is happening by sheer accident. It turns out that ld is sensitive to (unquoted) apostrophes in filenames (e.g., src/Data/Fold/L'.hs), so as a result, any file compiled with GHC 7.10.3 and earlier that contains an apostrophe will fail to link correctly when --enable-split-objs is on. (https://github.com/NixOS/nixpkgs/issues/15916 documents another instance of this problem.)

GHC 8.0.1 starting quoting files before passing them to ld, so that version of GHC doesn't suffer from this issue. But if you care about --enable-split-objs backwards compatibility, sadly, I don't think you can use apostrophes in any module names. (In generic-deriving, I ended up renaming a module named Pre4'9 to Pre4_9 to work around this issue.)

RyanGlScott commented 7 years ago

I'm opting to close this, since the issue isn't present in recent enough GHCs (8.0.1 or later), and fixing the issue for older GHCs would require an uncomfortable amount of breaking API changes.