Closed peti closed 7 years ago
Note: the error disappears when I pass --disable-split-objs
in the configure stage.
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.
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
@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.)
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.
Do you have any idea what might be causing the compiler/linker at the end of this snippet?