ygrek / ocurl

OCaml bindings to libcurl
https://ygrek.org/p/ocurl
MIT License
60 stars 32 forks source link

libcurl 7.29.0 build failure #63

Closed psafont closed 2 years ago

psafont commented 2 years ago

When building ocurl 0.9.2 with libcurl 0.29.0 (in a centos 7 environment) I get:

$ cat /usr/lib64/opamroot/log/ocurl-117-dba6d7.out
make[1]: Entering directory `/usr/lib64/opamroot/ocaml-system/.opam-switch/build/ocurl.0.9.2'
make[1]: Leaving directory `/usr/lib64/opamroot/ocaml-system/.opam-switch/build/ocurl.0.9.2'
make[1]: Entering directory `/usr/lib64/opamroot/ocaml-system/.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 /usr/lib64/ocaml/caml/alloc.h:23:0,
                 from curl-helper.c:25:
/usr/lib64/ocaml/caml/misc.h:40:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1310
       ^
/usr/lib64/ocaml/caml/misc.h:67:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
/usr/lib64/ocaml/caml/misc.h:110:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
/usr/lib64/ocaml/caml/misc.h:138:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
In file included from curl-helper.c:26:0:
/usr/lib64/ocaml/caml/memory.h:330:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
curl-helper.c:1269:1: error: unknown type name 'curl_sslbackend'
 curl_sslbackend sslBackendMap[] = {
 ^
In file included from curl-helper.c:23:0:
curl-helper.c: In function 'handle_XFERINFOFUNCTION':
curl-helper.c:1552:45: error: 'CURLOPT_XFERINFOFUNCTION' undeclared (first use in this function)
     result = curl_easy_setopt(conn->handle, CURLOPT_##name##FUNCTION, cb_##name##suffix); \
                                             ^
curl-helper.c:1559:31: note: in expansion of macro 'SETOPT_FUNCTION_'
 #define SETOPT_FUNCTION(name) SETOPT_FUNCTION_(name,FUNCTION)
                               ^
curl-helper.c:1568:1: note: in expansion of macro 'SETOPT_FUNCTION'
 SETOPT_FUNCTION( XFERINFO)
 ^
curl-helper.c:1552:45: note: each undeclared identifier is reported only once for each function it appears in
     result = curl_easy_setopt(conn->handle, CURLOPT_##name##FUNCTION, cb_##name##suffix); \
                                             ^
curl-helper.c:1559:31: note: in expansion of macro 'SETOPT_FUNCTION_'
 #define SETOPT_FUNCTION(name) SETOPT_FUNCTION_(name,FUNCTION)
                               ^
curl-helper.c:1568:1: note: in expansion of macro 'SETOPT_FUNCTION'
 SETOPT_FUNCTION( XFERINFO)
 ^
curl-helper.c:1554:45: error: 'CURLOPT_XFERINFODATA' undeclared (first use in this function)
     result = curl_easy_setopt(conn->handle, CURLOPT_##name##DATA, conn); \
                                             ^
curl-helper.c:1559:31: note: in expansion of macro 'SETOPT_FUNCTION_'
 #define SETOPT_FUNCTION(name) SETOPT_FUNCTION_(name,FUNCTION)
                               ^
curl-helper.c:1568:1: note: in expansion of macro 'SETOPT_FUNCTION'
 SETOPT_FUNCTION( XFERINFO)
 ^
curl-helper.c: In function 'caml_curl_easy_getinfo':
curl-helper.c:4256:9: note: #pragma message: libcurl does not provide CURLINFO_ACTIVESOCKET
 #pragma message("libcurl does not provide CURLINFO_ACTIVESOCKET")
         ^
curl-helper.c:4270:9: note: #pragma message: libcurl does not provide CURLINFO_HTTP_VERSION
 #pragma message("libcurl does not provide CURLINFO_HTTP_VERSION")
         ^
curl-helper.c: At top level:
curl-helper.c:2511:13: warning: 'ocaml_HTTP_VERSION' defined but not used [-Wunused-function]
 static long ocaml_HTTP_VERSION(long curl_version)
             ^
make[1]: *** [curl-helper.o] Error 2
make[1]: Leaving directory `/usr/lib64/opamroot/ocaml-system/.opam-switch/build/ocurl.0.9.2'
make: *** [all] Error 2

The two errors I see are:

nojb commented 2 years ago

I believe this is a bug in the OCaml header <caml/misc.h>: instead of #elif __MSC_VER >= ... it should be #elif defined(__MSC_VER) && __MSC_VER >= ....

psafont commented 2 years ago

Thanks for looking into this!

ygrek commented 2 years ago

MSC_VER is noisy, but the errors are actually in ocurl code, can you please try the latest git if it works for you (opam pin add ocurl --dev-repo)

psafont commented 2 years ago

Thanks for looking into this, unfortunately compilation still fails on the missing curl_sslbackend type:

$ cat /usr/lib64/opamroot/log/curl-117-2f78b5.out
         gcc curl-helper.o (exit 1)
(cd _build/default && /usr/bin/gcc -DHAVE_CONFIG_H -std=gnu99 -O2 -fno-strict-aliasing -fwrapv -fno-builtin-memcmp -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -pthread -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_FILE_OFFSET_BITS=64 -g -I /usr/lib64/ocaml -o curl-helper.o -c curl-helper.c)
curl-helper.c:1269:1: error: unknown type name 'curl_sslbackend'
 curl_sslbackend sslBackendMap[] = {
 ^
curl-helper.c: In function 'caml_curl_easy_getinfo':
curl-helper.c:4262:9: note: #pragma message: libcurl does not provide CURLINFO_ACTIVESOCKET
 #pragma message("libcurl does not provide CURLINFO_ACTIVESOCKET")
         ^
curl-helper.c:4276:9: note: #pragma message: libcurl does not provide CURLINFO_HTTP_VERSION
 #pragma message("libcurl does not provide CURLINFO_HTTP_VERSION")
         ^
curl-helper.c: At top level:
curl-helper.c:996:12: warning: 'cb_XFERINFOFUNCTION' defined but not used [-Wunused-function]
 static int cb_XFERINFOFUNCTION(void *data,
            ^
curl-helper.c:2513:13: warning: 'ocaml_HTTP_VERSION' defined but not used [-Wunused-function]
 static long ocaml_HTTP_VERSION(long curl_version)
ygrek commented 2 years ago

My bad, I assumed it was fixed in previous fixes in git. Please check master again.

psafont commented 2 years ago

That worked!

TheRealMattLear commented 1 year ago

I'm struggling with this issue, cloning and pinning the master branch results in

The following dependencies couldn't be met:
  - ocurl → curl >= 0.9.2
      no matching version

Tried the following, also tried opam pin add ocurl --dev-repo with same result:

git clone https://github.com/ygrek/ocurl.git;
cd ocurl
opam pin .;

Any assistance here would be very much appreciated

psafont commented 1 year ago

I believe that's a different issue. The repository now provides the package curl as well as ocurl, install it as well