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

"stack install libssh2-0.2.0.7" for lts-16.4 #57

Open
oshyshko opened this issue Jul 10, 2020 · 4 comments
Open

"stack install libssh2-0.2.0.7" for lts-16.4 #57

oshyshko opened this issue Jul 10, 2020 · 4 comments

Comments

@oshyshko
Copy link

oshyshko commented Jul 10, 2020

I'd like to use the library in my project that uses stack lts-16.4 (ghc-8.8.3).

Here's what I get when trying to install it (I am on macos 10.15.5):

$ brew install openssl libssh2
...
$ export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

$ stack install libssh2-0.2.0.7
libssh2> configure
libssh2> Configuring libssh2-0.2.0.7...
libssh2> build
libssh2> Preprocessing library for libssh2-0.2.0.7..
libssh2> Building library for libssh2-0.2.0.7..
libssh2> [1 of 5] Compiling Network.SSH.Client.LibSSH2.Types
libssh2> 
libssh2> /private/var/folders/qk/vw0nqkz90cz52plb04b416fh0000gn/T/stack-008b142a03477e0c/libssh2-0.2.0.7/src/Network/SSH/Client/LibSSH2/Types.chs:46:1: warning: [-Wunused-imports]
libssh2>     The import of ‘Foreign.C.Types’ is redundant
libssh2>       except perhaps to import instances from ‘Foreign.C.Types’
libssh2>     To import instances alone, use: import Foreign.C.Types()
libssh2>    |
libssh2> 46 | import Network.Socket
libssh2>    | ^^^^^^^^^^^^^^^^^^^^^^
libssh2> [2 of 5] Compiling Network.SSH.Client.LibSSH2.WaitSocket
libssh2> 
libssh2> /private/var/folders/qk/vw0nqkz90cz52plb04b416fh0000gn/T/stack-008b142a03477e0c/libssh2-0.2.0.7/src/Network/SSH/Client/LibSSH2/WaitSocket.hs:29:41: error:
libssh2>     • Couldn't match type ‘IO Foreign.C.Types.CInt’
libssh2>                      with ‘Foreign.C.Types.CInt’
libssh2>       Expected type: Socket -> Foreign.C.Types.CInt
libssh2>         Actual type: Socket -> IO Foreign.C.Types.CInt
libssh2>     • In the second argument of ‘(.)’, namely ‘fdSocket’
libssh2>       In the second argument of ‘(.)’, namely ‘Fd . fdSocket’
libssh2>       In the expression: threadWaitRead_ . Fd . fdSocket
libssh2>    |
libssh2> 29 | threadWaitRead = threadWaitRead_ . Fd . fdSocket
libssh2>    |                                         ^^^^^^^^
libssh2> 
libssh2> /private/var/folders/qk/vw0nqkz90cz52plb04b416fh0000gn/T/stack-008b142a03477e0c/libssh2-0.2.0.7/src/Network/SSH/Client/LibSSH2/WaitSocket.hs:32:43: error:
libssh2>     • Couldn't match type ‘IO Foreign.C.Types.CInt’
libssh2>                      with ‘Foreign.C.Types.CInt’
libssh2>       Expected type: Socket -> Foreign.C.Types.CInt
libssh2>         Actual type: Socket -> IO Foreign.C.Types.CInt
libssh2>     • In the second argument of ‘(.)’, namely ‘fdSocket’
libssh2>       In the second argument of ‘(.)’, namely ‘Fd . fdSocket’
libssh2>       In the expression: threadWaitWrite_ . Fd . fdSocket
libssh2>    |
libssh2> 32 | threadWaitWrite = threadWaitWrite_ . Fd . fdSocket
libssh2>    |                                           ^^^^^^^^

--  While building package libssh2-0.2.0.7 using:
      /Users/oshyshko/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build --ghc-options ""
    Process exited with code: ExitFailure 1

How do I get it work?

@oshyshko oshyshko changed the title stack install for lts-16.4 "stack install libssh2-0.2.0.7" for lts-16.4 Jul 10, 2020
@vst
Copy link

vst commented Aug 12, 2020

As far as I understand, libssh2-hs uses network >= 2.3 && < 3.0 dependency as of now. But your lts has network >= 3.

I am personally relying on lts-14.27 for the moment.

There is a fork of @chessai which mentions network-v3:

https://github.com/chessai/libssh2-hs/tree/network-v3

I did not have time to check that, though. It might be in progress.

@hkailahi
Copy link

+1. I am seeing the same failure on lts-17.9 (ghc-8.10.4), which has network-3.1.1.1.

I tried with the above fork and latest commit with more recent network3 PR - #58.

@vst
Copy link

vst commented Apr 23, 2021

Somewhere, sometime ago, I tried to add this very git repository as an extra-deps in my stack.yaml with lts-16.x. And I recall that it did the job.

Something like this:

extra-deps:
- git: https://github.com/portnov/libssh2-hs.git
  commit: d8a20f072f99aa2c415748734dac8225c74b45cc
  subdirs:
  - libssh2

@hkailahi
Copy link

hkailahi commented Apr 27, 2021

That works, thanks! Hmm I was using the same incantation in my stack.yaml except without subdirs: - libssh2.

I'm surprised these give different results. My guess as to why is that it was there's a top level stack.yaml here using network-2.6.3.6 (via lts-12.14), which isn't available in the subdirectory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants