Skip to content

Can't install network through Cabal on Windows #103

Closed

Description

@aalexand

I am trying to run the following command:

cabal -v3 install --with-gcc C:\cygwin\bin\gcc.exe cabal-install

But I get the following build errors at the end:

Created temporary directory: C:\Users\aalexand\AppData\Local\Temp\ghc20528_0
*** C Compiler:
"D:\util\ghc-7.6.3\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--reduce-memory-overheads" "-x" "c" "cbits\ancilData.c" "-o"
"C:\Users\aalexand\AppData\Local\Temp\ghc20528_0\ghc20528_0.s" "-Wimplicit" "-S" "-O" "-D__GLASGOW_HASKELL__=706" "-DTABLES_NEXT_TO_CODE" "-DCALLCONV=ccall
" "-O2" "-I" "dist\build" "-I" "include" "-I" "D:\util\ghc-7.6.3\lib\bytestring-0.10.0.2\include" "-I" "D:\util\ghc-7.6.3\lib\base-4.6.0.1\include" "-I" "D
:\util\ghc-7.6.3\lib/include"

In file included from cbits\ancilData.c:13:0:

include\HsNet.h:77:22:
fatal error: sys/uio.h: No such file or directory
compilation terminated.
*** Deleting temp files:
Deleting: C:\Users\aalexand\AppData\Local\Temp\ghc20528_0\ghc20528_0.s
Warning: deleting non-existent C:\Users\aalexand\AppData\Local\Temp\ghc20528_0\ghc20528_0.s
*** Deleting temp dirs:
Deleting: C:\Users\aalexand\AppData\Local\Temp\ghc20528_0
D:\util\ghc-7.6.3\bin\ghc.exe returned ExitFailure 1
World file is already up to date.
cabal.EXE: Error: some packages failed to install:
HTTP-4000.2.8 depends on network-2.4.1.2 which failed to install.
cabal-install-1.16.0.2 depends on network-2.4.1.2 which failed to install.
network-2.4.1.2 failed during the building phase. The exception was:
ExitFailure 1

Any idea or pointers what might have gone or done here?

Activity

  1. hreinhardt commented on Aug 23, 2013

    @hreinhardt
    Contributor

    Why are you using Cygwin gcc? The easiest way to compile network is to use MSYS and Mingw.
    If you have Git for Windows you can use the included MSYS which is called 'Git bash'.
    Mingw is shipped with GHC so you don't have to install it either.

  2. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    I had another problem with that. If I do just

    cabal -v3 install cabal-install

    then I hit another kind of error:

    ("D:\util\ghc-7.6.3\mingw\bin\gcc.exe",["-Wl,--hash-size=31","-Wl,--reduce-memory-overheads","C:\Users\aale
    "C:\Users\aalexand\AppData\Local\Temp\6012","-LC:\Users\aalexand\AppData\Roaming\cabal\parsec-3.1.3\g
    \Roaming\cabal\text-0.11.3.1\ghc-7.6.3","-LC:\Users\aalexand\AppData\Roaming\cabal\mtl-2.1.2\ghc-7.6.3"
    \cabal\transformers-0.3.0.0\ghc-7.6.3","-LD:\util\ghc-7.6.3\lib\bytestring-0.10.0.2","-LD:\util\ghc-7.6.3
    7.6.3\lib\array-0.4.0.1","-LD:\util\ghc-7.6.3\lib\base-4.6.0.1","-LD:\util\ghc-7.6.3\lib\integer-gmp-0.5
    im-0.3.0.0","-LD:\util\ghc-7.6.3\lib"])
    ("D:\util\ghc-7.6.3\mingw\bin\gcc.exe",["-Wl,--hash-size=31","-Wl,--reduce-memory-overheads","C:\Users\aale
    "C:\Users\aalexand\AppData\Local\Temp\6012","-c","-D__GLASGOW_HASKELL__=706","-Idist\build\autogen","-Iinc
    l\ghc-7.6.3\lib\bytestring-0.10.0.2\include","-ID:\util\ghc-7.6.3\lib\base-4.6.0.1\include","-ID:\util
    "])
    D:\util\ghc-7.6.3\mingw\bin\gcc.exe returned ExitFailure 1 with error
    message:
    In file included from C:\Users\aalexand\AppData\Local\Temp\6012.c:1:0:
    include/HsNet.h:77:22: fatal error: sys/uio.h: No such file or directory
    compilation terminated.
    ("D:\util\ghc-7.6.3\mingw\bin\gcc.exe",["-Wl,--hash-size=31","-Wl,--reduce-memory-overheads","C:\Users\aale
    "C:\Users\aalexand\AppData\Local\Temp\6012","-E","-D__GLASGOW_HASKELL__=706","-Idist\build\autogen","-Iinc
    l\ghc-7.6.3\lib\bytestring-0.10.0.2\include","-ID:\util\ghc-7.6.3\lib\base-4.6.0.1\include","-ID:\util
    D:\util\ghc-7.6.3\mingw\bin\gcc.exe returned ExitFailure 1 with error
    message:
    In file included from C:\Users\aalexand\AppData\Local\Temp\6012.c:1:0:
    include/HsNet.h:77:22: fatal error: sys/uio.h: No such file or directory
    compilation terminated.
    cabal.EXE: Missing dependency on a foreign library:

    • Missing (or bad) header file: HsNet.h
      This problem can usually be solved by installing the system package that
      provides this library (you may need the "-dev" version). If the library is
      already installed but in a non-standard location then you can use the flags
      --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
      If the header file does exist, it may contain errors that are caught by the
      C
      compiler at the preprocessing stage. In this case you can re-run configure
      with the verbosity flag -v3 to see the error messages.
      World file is already up to date.
      cabal.EXE: Error: some packages failed to install:
      HTTP-4000.2.8 depends on network-2.4.1.2 which failed to install.
      cabal-install-1.16.0.2 depends on network-2.4.1.2 which failed to install.
      network-2.4.1.2 failed during the configure step. The exception was:
      ExitFailure 1

    where the main line is:

    include/HsNet.h:77:22: fatal error: sys/uio.h: No such file or directory

    Looking into my C:_D\util\ghc-7.6.3\mingw\include\sys directory I don't
    see sys/uio.h there. This is why I thought maybe I need to switch to a
    more comprehensive Unix-like environment like Cygwin.

    Being able to use the compiler that ships with GHC would be the best
    solution, of course.

    BTW, I don't know if that matters but when configure runs I am seeing a
    bunch of warnings like this:

    configure: WARNING: unrecognized options: --with-compiler, --with-gcc

    On Sat, Aug 24, 2013 at 1:45 AM, Holger Reinhardt
    [email protected]:

    Why are you using Cygwin gcc? The easiest way to compile network is to use
    MSYS and Mingw.
    If you have Git for Windows you can use the included MSYS which is called
    'Git bash'.
    Mingw is shipped with GHC so you don't have to install it either.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23193164
    .

    Alexei Alexandrov

  3. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    Looks like I was able to solve the issue by cleaning up my PATH into just

    set PATH=D:\util\ghc-7.6.3\bin;D:\util\ghc-7.6.3\mingw\bin;C:\Program Files (x86)\Git\bin

    Then running

    cabal -v3 install cabal-install

    was successful. I guess the initial problem had to do with having C:\cygwin\bin in the PATH - even though I didn't ask cabal to use that GCC it looks like it figured it out from PATH and then strange mix of Cygwin and MinGW GCCs came into play. Maybe warning

    configure: WARNING: unrecognized options: --with-compiler, --with-gcc

    has something to do with the mess.

  4. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    I just checked the config.log file. It shows that cabal tries to call:

    configure [...] --with-gcc=c:\ghc-7.6.1\mingw\bin\gcc.exe

    So cabal tries to tell the configure script which gcc to use, but the configure script ignores that. Looking at the configure script it seems that the flag should be --with-cc and not --with-gcc.

  5. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    The configure script is network's, right? If so, it should be easier to
    change the configure script since cabal likely invokes many configure
    scripts (each package has its own?) and it will be hard for it to
    accomodate the specific one.

    But I may be missing some details in the build process here.

    On Sat, Aug 24, 2013 at 1:19 PM, Holger Reinhardt
    [email protected]:

    I just checked the config.log file. It shows that cabal tries to call:

    configure [...] --with-gcc=c:\ghc-7.6.1\mingw\bin\gcc.exe

    So cabal tries to tell the configure script which gcc to use, but the
    configure script ignores that. Looking at the configure script it seems
    that the flag should be --with-cc and not --with-gcc.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23205763
    .

    Alexei Alexandrov

  6. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Yes it would most likely be easier to change network's configure script than changing Cabal itself. I'm just wondering why this issue hasn't been fixed before.

  7. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    I've created a pull-request with the required change. If you want to try it you need to run "autoreconf" which is unfortunately not included with "Git bash", only with a full MSYS installation.

  8. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    I have Cygwin installed which has autoreconf too. But I am not too
    familiar with either autoconf or cabal, so couple of questions. How would
    I use autoreconf? To try your fix I would think I just need to pull your
    change and run "cabal install" somehow pointing it to my location of
    haskell/network. But I guess I am wrong?

    On Sat, Aug 24, 2013 at 4:23 PM, Holger Reinhardt
    [email protected]:

    I've created a pull-request with the required change. If you want to try
    it you need to run "autoreconf" which is unfortunately not included with
    "Git bash", only with a full MSYS installation.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23207875
    .

    Alexei Alexandrov

  9. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Checkout my repository and from within the directory run "autoreconf". It should then produce the "configure" file. Now you can just do "cabal install" and it should hopefully work.

  10. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    Shall I do "cabal install" just from the same directory where the
    "configure" file is or I need to point cabal to the directory somehow?
    I'll try to figure it out myself but hints are appreciated.

    On 8/24/13, Holger Reinhardt [email protected] wrote:

    Checkout my repository and from within the directory run "autoreconf". It
    should then produce the "configure" file. Now you can just do "cabal
    install" and it should hopefully work.


    Reply to this email directly or view it on GitHub:
    #103 (comment)

    Alexei Alexandrov

  11. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Run "cabal install" from the checked out repository. This should be the directory you ran "autoreconf" in.

  12. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    Well, now there is something else. See below. Also, I just pulled your
    branch instead of specific change applied to the master, not sure if that
    can make any difference.

    Resolving dependencies...
    Configuring network-2.4.1.1...
    configure: WARNING: unrecognized options: --with-compiler
    cygwin warning:
    MS-DOS style path detected:
    C:\Users\aalexand\AppData\Roaming\cabal/share/config.site
    Preferred POSIX equivalent is:
    /cygdrive/c/Users/aalexand/AppData/Roaming/cabal/share/config.site
    CYGWIN environment variable option "nodosfilewarning" turns off this
    warning.
    Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    configure: error: cannot run /bin/sh ./config.sub
    Failed to install network-2.4.1.1
    cabal.EXE: Error: some packages failed to install:
    network-2.4.1.1 failed during the configure step. The exception was:
    ExitFailure 2

    On Sat, Aug 24, 2013 at 4:42 PM, Holger Reinhardt
    [email protected]:

    Run "cabal install" from the checked out repository. This should be the
    directory you ran "autoreconf" in.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23208127
    .

    Alexei Alexandrov

  13. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Hm don't know what's going on there. What if you run "autoreconf" inside Cygwin but then use the "git bash" to do the "cabal install"?

  14. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    The issue with "configure: error: cannot run /bin/sh ./config.sub" was
    because the config.sub file (and couple others autoconf-created) were
    somehow created with DOS line endings. I dos2unix-ed them and was able to
    proceed (I think it's safe to ignore this issue because regularly user gets
    the package archive tar-balled with necessary files in needed format).

    Well, after I proceeded there was another issue:

    checking for gcc... d:\util\ghc-7.6.3\mingw\bin\gcc.exe
    checking whether the C compiler works... no
    configure: error: in /cygdrive/d/work/network': configure: error: C compiler cannot create executables Seeconfig.log' for more details
    sh returned ExitFailure 77
    Failed to install network-2.4.1.1
    cabal.EXE: Error: some packages failed to install:
    network-2.4.1.1 failed during the configure step. The exception was:
    ExitFailure 77

    That happens because the full path to GCC is passed by cabal with escaped
    backslashes but then inside configure the backslashes in the path are not
    very well respected and during eval()-s they get literal meaning
    essentially leading to this:

    D:\work\network>sh
    sh-4.1$ d:\util\ghc-7.6.3\mingw\bin\gcc.exe
    sh: d:utilghc-7.6.3mingwbingcc.exe: command not found
    sh-4.1$ exit

    I guess it would be better if cabal would pass the compiler path to
    configure using forward slashes. At least this is what worked finally for
    me:

    cabal -v3 install --with-gcc D:/util/ghc-7.6.3/mingw/bin/gcc.exe
    cabal-install

    This command executes fine with your fix.

    P.S. The "configure: WARNING: unrecognized options: --with-compiler"
    warning is still there but I kind of don't care for now.

    On Sat, Aug 24, 2013 at 5:00 PM, Holger Reinhardt
    [email protected]:

    Hm don't know what's going on there. What if you run "autoreconf" inside
    Cygwin but then use the "git bash" to do the "cabal install"?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23208356
    .

    Alexei Alexandrov

  15. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    But for me the backslashes work correctly. I think the problem may be caused by Cygwin. Or does it happen if you run "cabal install" inside "git bash"?

  16. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    It does actually in both.

    D:\work\network>"C:\Program Files (x86)\Git\bin\bash.exe"
    bash.exe"-3.1$ cabal install
    Resolving dependencies...
    Configuring network-2.4.1.1...
    cygwin warning:
    MS-DOS style path detected: d:/work/network
    Preferred POSIX equivalent is: /cygdrive/d/work/network
    CYGWIN environment variable option "nodosfilewarning" turns off this
    warning.
    Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    configure: WARNING: unrecognized options: --with-compiler
    checking build system type... i686-pc-cygwin
    checking host system type... i686-pc-cygwin
    checking for gcc... d:\util\ghc-7.6.3\mingw\bin\gcc.exe
    checking whether the C compiler works... no
    configure: error: in d:/work/network': configure: error: C compiler cannot create executables Seeconfig.log' for more details
    Failed to install network-2.4.1.1
    cabal.exe: Error: some packages failed to install:
    network-2.4.1.1 failed during the configure step. The exception was:
    ExitFailure 77
    bash.exe"-3.1$ exit
    exit

    D:\work\network>"C:\Program Files (x86)\Git\bin\bash.exe"
    bash.exe"-3.1$ d:\util\ghc-7.6.3\mingw\bin\gcc.exe
    bash.exe": d:utilghc-7.6.3mingwbingcc.exe: command not found
    bash.exe"-3.1$ exit
    exit

    On Sat, Aug 24, 2013 at 6:46 PM, Holger Reinhardt
    [email protected]:

    But for me the backslashes work correctly. I think the problem may be
    caused by Cygwin. Or does it happen if you run "cabal install" inside "git
    bash"?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/103#issuecomment-23209898
    .

    Alexei Alexandrov

  17. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Hm it seems that even when you run Git Bash there's still some cygwin stuff running. Either you have some Cygwin executables in your path or maybe running "autoreconf" from Cygwin messes up the configure file.

  18. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    I do have Cygwin on my PATH. But since explicit path to GCC is passed
    around I wouldn't expect that to matter. And in my second example I
    launched a command with backslashes directly from GIT bash and it
    didn't work which indicates that GIT bash doesn't like backslashes
    either on my machine...

    On 8/24/13, Holger Reinhardt [email protected] wrote:

    Hm it seems that even when you run Git Bash there's still some cygwin stuff
    running. Either you have some Cygwin executables in your path or maybe
    running "autoreconf" from Cygwin messes up the configure file.


    Reply to this email directly or view it on GitHub:
    #103 (comment)

    Alexei Alexandrov

  19. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    Maybe Cygwin has its own sh.exe which would then override the one shipped with Git bash. That could be the reason for the problems.

  20. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    When I don't have Cygwin on PATH, things work as expected. Good to
    know that Cygwin's bin is better be wiped out from PATH when running
    cabal on Windows.

    On 8/24/13, Holger Reinhardt [email protected] wrote:

    Maybe Cygwin has its own sh.exe which would then override the one shipped
    with Git bash. That could be the reason for the problems.


    Reply to this email directly or view it on GitHub:
    #103 (comment)

    Alexei Alexandrov

  21. hreinhardt commented on Aug 24, 2013

    @hreinhardt
    Contributor

    So my patch is probably unnecessary, but I guess it won't hurt either.

  22. aalexand commented on Aug 24, 2013

    @aalexand
    Author

    Right.

    On 8/24/13, Holger Reinhardt [email protected] wrote:

    So my patch is probably unnecessary, but I guess it won't hurt either.


    Reply to this email directly or view it on GitHub:
    #103 (comment)

    Alexei Alexandrov

  23. kazu-yamamoto commented on Dec 15, 2017

    @kazu-yamamoto
    Collaborator

    Since we officially supports MSYS only, I would close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions