typelead / eta

The Eta Programming Language, a dialect of Haskell on the JVM
https://eta-lang.org
BSD 3-Clause "New" or "Revised" License
2.61k stars 145 forks source link

Fails to build several packages on a windows machine #856

Open ShrykeWindgrace opened 6 years ago

ShrykeWindgrace commented 6 years ago

Description

A project with dependencies optparse-applicative, typed-process, and bytestring fails to compile, even thought all three packages are supported.

Expected Behavior

Should compile

Actual Behavior

Compilation fails with

Failed to build Win32-2.5.4.1.
Build log (
$HOME\AppData\Roaming\etlas\logs\eta-0.8.6.1\Win32-2.5.4.1-9cc8841f700f911d30ab8e466141e88446ae3aea.log
):
Preprocessing library for Win32-2.5.4.1..
etlas.exe: can't find source for Graphics\Win32\GDI\Bitmap in .,
dist\build\autogen, dist\build\global-autogen

Failed to build text-1.2.2.2.
Build log (
$HOME\AppData\Roaming\etlas\logs\eta-0.8.6.1\text-1.2.2.2-6846aca30bea6e13082eb524bf01f848503cef2e.log
):
Preprocessing library for text-1.2.2.2..
Building library for text-1.2.2.2..

.DataText.hs:252:18: error:
    Could not find module ‘Java.StringUtils’
    Use -v to see a list of the files searched for.

Failed to build transformers-0.5.4.0.
Build log (
$HOME\AppData\Roaming\etlas\logs\eta-0.8.6.1\transformers-0.5.4.0-d9713018751b241fbacba388b07c1d0656081af6.log
):
Preprocessing library for transformers-0.5.4.0..
Building library for transformers-0.5.4.0..
[25 of 29] Compiling Data.Functor.Constant
.DataFunctorConstant.hs:109:10: error:
    Could not deduce (Semigroup (Constant a b))
      arising from the superclasses of an instance declaration
    from the context (Monoid a)
      bound by the instance declaration
      at .DataFunctorConstant.hs:109:10-44
    In the instance declaration for ‘Monoid (Constant a b)’

Failed to build zlib-0.6.1.2.
Build log (
$HOME\AppData\Roaming\etlas\logs\eta-0.8.6.1\zlib-0.6.1.2-a5e171c7eff9a3a8bc0c867eade06f71c061dd3c.log
):
Preprocessing library for zlib-0.6.1.2..
etlas.exe: can't find source for Codec\Compression\Zlib\Stream in .,
dist\build\autogen, dist\build\global-autogen
etlas.exe: Failed to build Win32-2.5.4.1 (which is required by exe:eta-tst
from eta-tst-0.1.0.0). See the build log above for details.
Failed to build text-1.2.2.2 (which is required by exe:eta-tst from
eta-tst-0.1.0.0). See the build log above for details.
Failed to build transformers-0.5.4.0 (which is required by exe:eta-tst from
eta-tst-0.1.0.0). See the build log above for details.
Failed to build zlib-0.6.1.2 (which is required by exe:eta-tst from
eta-tst-0.1.0.0). See the build log above for details.

Steps to Reproduce

  1. Relevant part of the cabal file: build-depends: base >=4.11 && <4.12 , optparse-applicative , typed-process , bytestring
  2. Main.hs - regular helloworld with imports:
    
    module Main where

import Options.Applicative import Control.Applicative import System.Process.Typed import Data.ByteString.Lazy.Char8

main :: IO () main = putStrLn "Hello, Eta!"



## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Did you install an older version of Eta/Etlas before? No
* Current Eta & Etlas version: `etlas` 1.5.0.0, `eta` 0.8.6b1.
* Operating System and version: Windows 10
jneira commented 6 years ago

Hi, i've just test a project with those dependencies and it worked for me. However it has picked different versions of packages. Moreover, it doesnt build zlib :

Resolving dependencies...
In order, the following will be built (use -v for more details):
 - colour-2.3.4 (lib) (requires build)
 - fail-4.9.0.0 (lib) (requires build)
 - process-1.6.2.0 (lib) (requires build)
 - semigroups-0.18.5 (lib) (requires build)
 - stm-2.4.5.0 (lib) (requires build)
 - text-1.2.3.0 (lib) (requires build)
 - transformers-0.5.5.0 (lib:transformers) (requires build)
 - ansi-terminal-0.8.0.4 (lib) (requires build)
 - hashable-1.2.6.1 (lib) (requires build)
 - transformers-compat-0.5.1.4 (lib) (requires build)
 - ansi-wl-pprint-0.6.8.2 (lib) (requires build)
 - async-2.2.1 (lib) (requires build)
 - optparse-applicative-0.14.0.0 (lib) (requires build)
 - typed-process-0.2.2.0 (lib) (requires download & build)
 - eta-test-0.1.0.0 (lib) (first run)
 - eta-test-0.1.0.0 (exe:eta-test-prog) (first run)
Downloading [source] typed-process-0.2.2.0...
Configuring colour-2.3.4 (lib)...
Found patch in eta-hackage for fail-4.9.0.0
Found patch in eta-hackage for semigroups-0.18.5
Found patch in eta-hackage for process-1.6.2.0
Configuring fail-4.9.0.0 (lib)...
Configuring semigroups-0.18.5 (lib)...
Configuring process-1.6.2.0 (lib)...
Building colour-2.3.4 (lib)...
Building fail-4.9.0.0 (lib)...
Building process-1.6.2.0 (lib)...
Building semigroups-0.18.5 (lib)...
Configuring stm-2.4.5.0 (lib)...
Building stm-2.4.5.0 (lib)...
Found patch in eta-hackage for text-1.2.3.0
Configuring text-1.2.3.0 (lib)...
Building text-1.2.3.0 (lib)...
Found patch in eta-hackage for transformers-0.5.5.0
Configuring transformers-0.5.5.0 (all, legacy fallback)...
Found patch in eta-hackage for ansi-terminal-0.8.0.4
Configuring ansi-terminal-0.8.0.4 (lib)...
Building transformers-0.5.5.0 (all, legacy fallback)...
Building ansi-terminal-0.8.0.4 (lib)...
Configuring ansi-wl-pprint-0.6.8.2 (lib)...
Building ansi-wl-pprint-0.6.8.2 (lib)...
Configuring transformers-compat-0.5.1.4 (lib)...
Building transformers-compat-0.5.1.4 (lib)...
Found patch in eta-hackage for optparse-applicative-0.14.0.0
Configuring optparse-applicative-0.14.0.0 (lib)...
Building optparse-applicative-0.14.0.0 (lib)...
Found patch in eta-hackage for hashable-1.2.6.1
Configuring hashable-1.2.6.1 (lib)...
Building hashable-1.2.6.1 (lib)...
Configuring async-2.2.1 (lib)...
Building async-2.2.1 (lib)...
Found patch in eta-hackage for typed-process-0.2.2.0
Configuring typed-process-0.2.2.0 (lib)...
Building typed-process-0.2.2.0 (lib)...
Configuring library for eta-test-0.1.0.0..
Preprocessing library for eta-test-0.1.0.0..
Building library for eta-test-0.1.0.0..
 ✓ Successfully built 1 module. Keep Hustling!

 Configuring executable 'eta-test-prog' for eta-test-0.1.0.0..
Preprocessing executable 'eta-test-prog' for eta-test-0.1.0.0..
Building executable 'eta-test-prog' for eta-test-0.1.0.0..
 ✓ Successfully built 1 module. Great Hustle!

My versions of eta and etlas are the same but built from source, so i had preinstalled some packages, including bytestring:

C:\>eta-pkg list
C:\Users\user\AppData\Roaming\eta\0.8.6.2\package.conf.d
    array-0.5.2.0
    base-4.11.1.0
    binary-0.8.5.1
    bytestring-0.10.8.2
    containers-0.5.10.2
    deepseq-1.4.3.0
    directory-1.3.1.0
    eta-boot-0.8.6
    eta-boot-meta-0.8.6
    eta-java-interop-0.1.5.0
    eta-meta-0.8.6.2
    eta-repl-0.8.6.2
    filepath-1.4.1.2
    ghc-prim-0.4.0.0
    integer-0.5.1.0
    pretty-1.1.3.6
    rts-0.1.0.0
    template-haskell-2.11.1.0
    time-1.8.0.3

Maybe the errors could be related with the issue with long paths in windows so i would change the project and the store-dir entry in $HOME\AppData\Roaming\etlas\config to a shorter path. F.e. my entry is:

store-dir: D:\sd

After the change etlas should create the directory and put the packages in.

rahulmutt commented 6 years ago

@jneira It looks like the Win32 package was being built so I don't think it's a long paths problem this time. It may be that both of you have different index states. Maybe both of you need to run etlas update and try again?

ShrykeWindgrace commented 6 years ago

Thanks for looking into this issue!

@jneira it seems that your test project uses eta-0.8.6.2 - (judging by the line C:\Users\user\AppData\Roaming\eta\0.8.6.2\package.conf.d); mine is still at 0.8.6b1.

@rahulmutt I deleted folders eta and etlas in $HOME/AppData/Roaming to be sure, run etlas update, and rerun etlas build. The compilation now fails with

Failed to build eta-java-interop-0.1.5.0. The failure occurred during the
final install step.
Build log (
$HOME\AppData\Roaming\etlas\logs\eta-0.8.6.1\eta-java-inte_-0.1.5.0-47b093477d21abd7f0838d4285dc0b8859b615d2.log
):
etlas.exe:
$HOME\AppData\Roaming\etlas\binaries\cdnverify.eta-lang.org\eta-0.8.6.1\binaries\x86_64-windows\eta.exe'
exited with an error:
<command line>: Could not find module `Interop.Java.DateTime'
Use -v to see a list of the files searched for.
etlas.exe: Failed to build eta-java-interop-0.1.5.0 (which is required by
exe:eta-tst from eta-tst-0.1.0.0). See the build log above for details.

I have LongPaths policy enabled, so 260 character limit should not be an issue.

jneira commented 6 years ago

Mmm, not sure if the internal win32 api calls done by etlas use that policy cause it has to work in older windows versions... If i remember correctly i've got that error when building the project (D: in my case) in another drive than the $HOME\AppData\Roaming\etlas one (typically C:). I use as workaround a global install of the package:

etlas old-install eta-java-interop
ShrykeWindgrace commented 6 years ago

@jneira your workaround helped, thank you!

If etlas has the right to ignore LongPaths policy, the 260 char limit could become an issue indeed.

rahulmutt commented 6 years ago

@jneira I remember there was a Cabal fix for this - can you link that here to track it? We'll try to port it sometime.

jneira commented 6 years ago

Oh, i am afraid i dont remember that one and i just look for it in https://github.com/haskell/cabal/issues with no luck