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

Fixed build on MSYS (Windows) 64-bit #22

Merged
merged 1 commit into from Oct 10, 2015
Merged

Conversation

@donkeybonks
Copy link
Contributor

donkeybonks commented Sep 24, 2014

@ForNeVeR
Copy link

ForNeVeR commented Jul 26, 2015

@kvanberendonck, thank you for that request and sorry for the long delay with merging this.

Currently I'm trying to follow your blog post and build this with msys2.

At first, I had to pacman -S gcc (otherwise it won't build without sys/stat.h etc).

After that I'm still getting the wrong definition of libssh2_session_handshake in Foreign.hs:

foreign import ccall safe "Network\\SSH\\Client\\LibSSH2\\Foreign.chs.h libssh2_session_handshake"
  handshake_'_ :: ((Ptr ()) -> (CInt -> (IO CInt)))

(but it should say CULLong instead of CInt on a 64-bit Windows OS)

I think that it's due to c2hs not passing _WIN32 and WIN32 defines to libssh2.h. But if I try to pass them, it getting worse and start complaining about some absolutely unrelated header files such as /usr/lib/gcc/x86_64-pc-msys/4.9.2/include/bmi2intrin.h.

I can fix that errors with some additional defines (such as #define __int128 int) although it comes to the ultimate error:

In file included from C:\Program Files\Haskell Platform\2014.2.0.0\lib/include/rts/Threads.h:19:0,
                from C:\Program Files\Haskell Platform\2014.2.0.0\lib/include/Rts.h:206,
                from T:\Temp\ghc21572_0\ghc21572_5.c:2:
e:\Programs\msys2\usr\include/sys/types.h:124:18: error: conflicting types for 'time_t'
c:\program files\haskell platform\2014.2.0.0\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/include/_mingw.h:488:20: note: previous declaration of 'time_t' was here

I'm obviously doing something wrong, but what exactly? Could we easily fix that?

(If I could build that, we'd merge your request and I'd prepare new build instructions for those brave souls willing to use libssh2 on Windows.)

@donkeybonks
Copy link
Contributor Author

donkeybonks commented Jul 26, 2015

Did you patch in the last snippet from #21 ?

The blog post assumes you perform some manual patching of libssh2-hs, and I had assumed that these would eventually get merged but they never did. Blog post was a very long time ago, may no longer be relevant.

@ForNeVeR
Copy link

ForNeVeR commented Jul 26, 2015

Yeah, I've used the patched version from your fork. Note that I had problems not with ssh2socket function you patched, but with handshake_'_ automatically generated by c2hs from libssh2_session_handshake.

@donkeybonks
Copy link
Contributor Author

donkeybonks commented Jul 26, 2015

Looks like the issue may be able to be fixed in a very similar way to the original ssh2socket issue, but adapted for handshake_'_.

I actually got really frustrated and now dev from a mac, so I can't really provide support for this patch anymore, sorry.

@ForNeVeR
Copy link

ForNeVeR commented Jul 26, 2015

Okay, thanks for elaboration anyway!

@nitrix
Copy link

nitrix commented Oct 9, 2015

This patch solved the issue for me and I'd like to see it upstream. +1

portnov added a commit that referenced this pull request Oct 10, 2015
Fixed build on MSYS (Windows) 64-bit
@portnov portnov merged commit 91dc0b9 into portnov:master Oct 10, 2015
@donkeybonks
Copy link
Contributor Author

donkeybonks commented Oct 11, 2015

The gift that keeps on giving

Just past the anniversary of the original patch :)

@portnov portnov mentioned this pull request Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.