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

ocurl started to fail to install on windows #77

Closed
aryx opened this issue Jun 4, 2024 · 15 comments
Closed

ocurl started to fail to install on windows #77

aryx opened this issue Jun 4, 2024 · 15 comments

Comments

@aryx
Copy link

aryx commented Jun 4, 2024

#=== ERROR while compiling ocurl.0.9.2 ========================================#
# context     2.0.10 | win32/x86_64 | ocaml-variants.4.14.2+mingw64c | git+https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
# path        D:/a/semgrep-proprietary/semgrep-proprietary/_opam/.opam-switch/build/ocurl.0.9.2
# command     D:\cygwin\bin\make.exe
# exit-code   2
# env-file    D:/.opam/log/ocurl-4640-3c14c6.env
# output-file D:/.opam/log/ocurl-4640-3c14c6.out
### output ###
# make[1]: Entering directory '/cygdrive/d/a/semgrep-proprietary/semgrep-proprietary/_opam/.opam-switch/build/ocurl.0.9.2'
# make[1]: Leaving directory '/cygdrive/d/a/semgrep-proprietary/semgrep-proprietary/_opam/.opam-switch/build/ocurl.0.9.2'
# make[1]: Entering directory '/cygdrive/d/a/semgrep-proprietary/semgrep-proprietary/_opam/.opam-switch/build/ocurl.0.9.2'
# ocamlc.opt -c -g -bin-annot curl.mli -o curl.cmi
# ocamlc.opt -c -g -bin-annot curl.ml -o curl.cmo
# ocamlc.opt -c -ccopt "-g -O2  -DHAVE_CONFIG_H -Wall -Wundef" curl-helper.c
# In file included from curl-helper.c:23:
# curl-helper.c: In function 'handle_15':
# curl-helper.c:1654:59: error: 'CURLOPT_15' undeclared (first use in this function); did you mean 'CURLOPT_ECH'?
#  1654 | #define SETOPT_VAL(name, conv) SETOPT_VAL_(handle_##name, CURLOPT_##name, conv)
#       |                                                           ^~~~~~~~
# curl-helper.c:1654:32: note: in expansion of macro 'SETOPT_VAL_'
#  1654 | #define SETOPT_VAL(name, conv) SETOPT_VAL_(handle_##name, CURLOPT_##name, conv)
#       |                                ^~~~~~~~~~~
# curl-helper.c:1655:27: note: in expansion of macro 'SETOPT_VAL'
#  1655 | #define SETOPT_BOOL(name) SETOPT_VAL(name, Bool_val)
#       |                           ^~~~~~~~~~
# curl-helper.c:2794:1: note: in expansion of macro 'SETOPT_BOOL'
#  2794 | SETOPT_BOOL( TCP_FASTOPEN)
#       | ^~~~~~~~~~~
# curl-helper.c:1654:59: note: each undeclared identifier is reported only once for each function it appears in
#  1654 | #define SETOPT_VAL(name, conv) SETOPT_VAL_(handle_##name, CURLOPT_##name, conv)
#       |                                                           ^~~~~~~~
# curl-helper.c:1654:32: note: in expansion of macro 'SETOPT_VAL_'
#  1654 | #define SETOPT_VAL(name, conv) SETOPT_VAL_(handle_##name, CURLOPT_##name, conv)
#       |                                ^~~~~~~~~~~
# curl-helper.c:1655:27: note: in expansion of macro 'SETOPT_VAL'
#  1655 | #define SETOPT_BOOL(name) SETOPT_VAL(name, Bool_val)
#       |                           ^~~~~~~~~~
# curl-helper.c:2794:1: note: in expansion of macro 'SETOPT_BOOL'
#  2794 | SETOPT_BOOL( TCP_FASTOPEN)
#       | ^~~~~~~~~~~
# curl-helper.c: At top level:
# curl-helper.c:3291:22: error: 'handle_TCP_FASTOPEN' undeclared here (not in a function)
#  3291 | #define HAVE(name) { handle_ ## name, "CURLOPT_"#name }
#       |                      ^~~~~~~
# curl-helper.c:3291:22: note: in definition of macro 'HAVE'
#  3291 | #define HAVE(name) { handle_ ## name, "CURLOPT_"#name }
#       |                      ^~~~~~~
# curl-helper.c:1654:44: warning: 'handle_15' defined but not used [-Wunused-function]
#  1654 | #define SETOPT_VAL(name, conv) SETOPT_VAL_(handle_##name, CURLOPT_##name, conv)
#       |                                            ^~~~~~~
# curl-helper.c:1641:13: note: in definition of macro 'SETOPT_VAL_'
#  1641 | static void func_name(Connection *conn, value option) \
#       |             ^~~~~~~~~
# curl-helper.c:1655:27: note: in expansion of macro 'SETOPT_VAL'
#  1655 | #define SETOPT_BOOL(name) SETOPT_VAL(name, Bool_val)
#       |                           ^~~~~~~~~~
# curl-helper.c:2[794](https://github.com/semgrep/semgrep-proprietary/actions/runs/9368254072/job/25789817055?pr=1644#step:9:795):1: note: in expansion of macro 'SETOPT_BOOL'
#  2794 | SETOPT_BOOL( TCP_FASTOPEN)
#       | ^~~~~~~~~~~
# make[1]: *** [Makefile:128: curl-helper.o] Error 2
# make[1]: Leaving directory '/cygdrive/d/a/semgrep-proprietary/semgrep-proprietary/_opam/.opam-switch/build/ocurl.0.9.2'
# make: *** [Makefile:61: all] Error 2



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build ocurl 0.9.2
+- 
+
@aryx
Copy link
Author

aryx commented Jun 4, 2024

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.

@ygrek
Copy link
Owner

ygrek commented Jun 4, 2024

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?

@aryx
Copy link
Author

aryx commented Jun 5, 2024

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

@aryx
Copy link
Author

aryx commented Jun 5, 2024

Different error though than the one I had when installing ocurl

@aryx
Copy link
Author

aryx commented Jun 5, 2024

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 $ 

@nojb
Copy link
Contributor

nojb commented Jun 5, 2024

I think you should replace TCP_FASTOPEN by CURLOPT_TCP_FASTOPEN in the test file.

@aryx
Copy link
Author

aryx commented Jun 5, 2024

still, this does not explain the compilation error in windows

@aryx
Copy link
Author

aryx commented Jun 5, 2024

and why suddently ocurl can't be installed under windows (I use fdopen opam for windows)

@nojb
Copy link
Contributor

nojb commented Jun 5, 2024

It is probably related in some way with #52; you may want to downgrade back to 0.9.1.

@nojb
Copy link
Contributor

nojb commented Jun 5, 2024

@ygrek TCP_FASTOPEN is defined in the Windows headers (probably included transitively by unixsupport.h) with the value 15.

@nojb
Copy link
Contributor

nojb commented Jun 5, 2024

@ygrek TCP_FASTOPEN is defined in the Windows headers (probably included transitively by unixsupport.h) with the value 15.

Maybe #undef TCP_FASTOPEN could be a way around.

@aryx
Copy link
Author

aryx commented Jun 5, 2024

oh indeed, I was able to install ocurl 0.9.1 on windows! Thx!

@aryx
Copy link
Author

aryx commented Jun 5, 2024

weird though, 0.9.2 is from 2022 so why suddently it started to fail to install under windows in the last week?

@ygrek
Copy link
Owner

ygrek commented Jun 6, 2024

@ygrek TCP_FASTOPEN is defined in the Windows headers (probably included transitively by unixsupport.h) with the value 15.

that's what i wanted to test with that code, that explains

@ygrek
Copy link
Owner

ygrek commented Jun 6, 2024

@ygrek TCP_FASTOPEN is defined in the Windows headers (probably included transitively by unixsupport.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

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