psibi / download

High level download interface for Haskell
https://www.stackage.org/package/download
Other
10 stars 3 forks source link

Compilation error with libio.h #16

Closed muesli4 closed 5 years ago

muesli4 commented 6 years ago

I don't know what the file is for but when I try to build it I get errors by these lines:

https://github.com/psibi/download/blob/98c694c8bcfaff6801158774d1dff80ff3984dee/cbits/ftp.c#L67 https://github.com/psibi/download/blob/98c694c8bcfaff6801158774d1dff80ff3984dee/cbits/http.c#L71

Simply removing both lines leads to successful compilation but then it throws and I get:

> import Network.Download
> openURI "http://haskell.org"
Left "Failed to connect: Success"

I'm using:

Let me know if you need something else.

Murzinio commented 5 years ago

Tried it on Arch and I get the same error too. After some googling it seems it's supposed to be a part of the GNU C library, but it's not there even though glibc is installed. (Arch has it in core packages) Looking at the C headers reference https://en.cppreference.com/w/c/header you can see it's not really guaranteed to be part of the C stdlib so that's where the problem comes from I guess.

muesli4 commented 5 years ago

@Murzinio It worked before. I guess it's not really related to Archlinux in particular. It's not even listed there and in some code I found it says that it should only be included by glibc itself. I'm interested what it's used for but couldn't figure it out without wasting a lot of time.

erikd commented 5 years ago

The <libio.h> header used to be provided by the kernel, but has since been deprecated.

The deprecation warning suggests using <stdio.h> instead.

muesli4 commented 5 years ago

@erikd Compiles but doesn't work:

> openURI "http://haskell.org"
Left "Failed to connect: Success"
erikd commented 5 years ago

@muesli4 I don't think that test failure is due to the my fix, but rather due to flakiness of the test.

psibi commented 5 years ago

A new version has been released in Hackage. Thanks @erikd for the patch.

muesli4 commented 5 years ago

Should I open another issue? The compilation error is gone but it's still not working properly.

psibi commented 5 years ago

Yeah, please open another issue. Thanks.

On Sat, Mar 2, 2019, 9:58 PM Moritz Bruder notifications@github.com wrote:

Should I open another issue? The compilation error is gone but it's still not working properly.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/psibi/download/issues/16#issuecomment-468935666, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtAxZsHogVbMTlSnk8Sy-_gP5DGGAOXks5vSqacgaJpZM4XB3p1 .