Closed aryx closed 1 week ago
This used to work fine; not sure what changed recently, but it does not build anymore on windows. I've tried on a fresh cygwin and fresh install of fdopen opam for windows and got the error too.
this looks like C compiler or headers issue/change.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <caml/config.h> /* defines HAS_UNISTD */
#ifdef HAS_UNISTD
#include <unistd.h>
#endif
/* suppress false gcc warning on seekFunction */
#define CURL_DISABLE_TYPECHECK
#include <curl/curl.h>
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/callback.h>
#include <caml/fail.h>
#include <caml/unixsupport.h>
#include <caml/custom.h>
#include <caml/threads.h>
int main()
{
return TCP_FASTOPEN;
}
does this compile and return 15?
It does not compile.
pad@xayr ~/work
$ ocamlc.opt -c -ccopt "-g -O2 -DHAVE_CONFIG_H -Wall -Wundef" test.c
In file included from C:/cygwin64/home/pad/.opam/ocaml-variants.4.14.0+mingw64/lib/ocaml/caml/config.h:45,
from test.c:6:
C:/cygwin64/home/pad/.opam/ocaml-variants.4.14.0+mingw64/lib/ocaml/caml/compatibility.h:71:34: error: expect
ed declaration specifiers or ‘...’ before string constant
71 | #define callback CAML_DEPRECATED("callback", "caml_callback") caml_callback
| ^~~~~~~~~~
C:/cygwin64/home/pad/.opam/ocaml-variants.4.14.0+mingw64/lib/ocaml/caml/compatibility.h:71:46: error: expect
ed declaration specifiers or ‘...’ before string constant
71 | #define callback CAML_DEPRECATED("callback", "caml_callback") caml_callback
| ^~~~~~~~~~~~~~~
pad@xayr ~/work
Different error though than the one I had when installing ocurl
It does not compile either on my arch linux machine though:
/home/pad/work/EXPERIMENTS/ocurl $ ocamlc.opt -c -ccopt "-g -O2 -DHAVE_CONFIG_H -Wall -Wundef" test.c
test.c: In function ‘main’:
test.c:25:8: error: ‘TCP_FASTOPEN’ undeclared (first use in this function); did you mean ‘MSG_FASTOPEN’?
25 | return TCP_FASTOPEN;
| ^~~~~~~~~~~~
| MSG_FASTOPEN
test.c:25:8: note: each undeclared identifier is reported only once for each function it appears in
/home/pad/work/EXPERIMENTS/ocurl $
I think you should replace TCP_FASTOPEN
by CURLOPT_TCP_FASTOPEN
in the test file.
still, this does not explain the compilation error in windows
and why suddently ocurl can't be installed under windows (I use fdopen opam for windows)
It is probably related in some way with #52; you may want to downgrade back to 0.9.1.
@ygrek TCP_FASTOPEN
is defined in the Windows headers (probably included transitively by unixsupport.h
) with the value 15.
@ygrek
TCP_FASTOPEN
is defined in the Windows headers (probably included transitively byunixsupport.h
) with the value 15.
Maybe #undef TCP_FASTOPEN
could be a way around.
oh indeed, I was able to install ocurl 0.9.1 on windows! Thx!
weird though, 0.9.2 is from 2022 so why suddently it started to fail to install under windows in the last week?
@ygrek
TCP_FASTOPEN
is defined in the Windows headers (probably included transitively byunixsupport.h
) with the value 15.
that's what i wanted to test with that code, that explains
@ygrek
TCP_FASTOPEN
is defined in the Windows headers (probably included transitively byunixsupport.h
) with the value 15.Maybe
#undef TCP_FASTOPEN
could be a way around.
short term yes, but meh long term should generate code with something better than cpp