ygrek / ocurl

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

CentOS 7 Build issue #65

Closed TheRealMattLear closed 5 months ago

TheRealMattLear commented 1 year ago

Having difficulty installing ocurl on CentOS 7 (as a dependency of liquidsoap 2.1.3). Here's the results from a new blank switch (4.12.1)

bash-4.2$ opam install ocurl
The following actions will be performed:
  ∗ install ocamlfind    1.9.5 [required by ocurl]
  ∗ install conf-libcurl 2     [required by ocurl]
  ∗ install ocurl        0.9.2
===== ∗ 3 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocurl.0.9.2] downloaded from cache at https://opam.ocaml.org/cache
[ocamlfind.1.9.5] downloaded from cache at https://opam.ocaml.org/cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed conf-libcurl.2
∗ installed ocamlfind.1.9.5
[ERROR] The compilation of ocurl failed at "/usr/local/mediacp/.opam/opam-init/hooks/sandbox.sh build make".

#=== ERROR while compiling ocurl.0.9.2 ========================================#
# context     2.0.9 | linux/x86_64 | ocaml-base-compiler.4.12.1 | https://opam.ocaml.org#750de479
# path        ~/.opam/4.12.1/.opam-switch/build/ocurl.0.9.2
# command     ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code   2
# env-file    ~/.opam/log/ocurl-22838-326a35.env
# output-file ~/.opam/log/ocurl-22838-326a35.out
### output ###
# curl-helper.c:4256:9: note: #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/local/mediacp/.opam/4.12.1/.opam-switch/build/ocurl.0.9.2'
# make: *** [all] Error 2

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ocurl 0.9.2
└─
┌─ The following changes have been performed
│ ∗ install conf-libcurl 2
│ ∗ install ocamlfind    1.9.5
└─
# Run eval $(opam env) to update the current shell environment

The former state can be restored with:
    opam switch import "/usr/local/mediacp/.opam/4.12.1/.opam-switch/backup/state-20221220003654.export"

I've attempted to pin the latest as suggested from #63 but this has resulted in another problem:

The following dependencies couldn't be met:
  - ocurl → curl >= 0.9.2
      no matching version
ygrek commented 1 year ago

what is libcurl version?

ygrek commented 1 year ago

can you share the full output file (output-file ~/.opam/log/ocurl-22838-326a35.out) because what is shown above is warnings, shouldn't be the reason of failure

TheRealMattLear commented 1 year ago

Thanks for the response! libcurl 7.29.0, output below:

make[1]: Entering directory `/usr/local/mediacp/.opam/4.12.1/.opam-switch/build/ocurl.0.9.2'
make[1]: Leaving directory `/usr/local/mediacp/.opam/4.12.1/.opam-switch/build/ocurl.0.9.2'
make[1]: Entering directory `/usr/local/mediacp/.opam/4.12.1/.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/local/mediacp/.opam/4.12.1/lib/ocaml/caml/alloc.h:23:0,
                 from curl-helper.c:25:
/usr/local/mediacp/.opam/4.12.1/lib/ocaml/caml/misc.h:40:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1310
       ^
/usr/local/mediacp/.opam/4.12.1/lib/ocaml/caml/misc.h:67:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
/usr/local/mediacp/.opam/4.12.1/lib/ocaml/caml/misc.h:110:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
/usr/local/mediacp/.opam/4.12.1/lib/ocaml/caml/misc.h:127:7: warning: "_MSC_VER" is not defined [-Wundef]
 #elif _MSC_VER >= 1500
       ^
In file included from curl-helper.c:26:0:
/usr/local/mediacp/.opam/4.12.1/lib/ocaml/caml/memory.h:332: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/local/mediacp/.opam/4.12.1/.opam-switch/build/ocurl.0.9.2'
make: *** [all] Error 2
TheRealMattLear commented 1 year ago

Happy new year! Do you have any thoughts about this error?

ygrek commented 1 year ago

please check if building from git master works

TheRealMattLear commented 1 year ago

Cloning and pinning seems to result in a curl dependency issue with CentOS Linux release 7.9.2009 (Core), not sure if I'm doing something wrong here?

bash-4.2$ opam switch create 4.12.1;
...
bash-4.2$ git clone https://github.com/ygrek/ocurl.git;
Cloning into 'ocurl'...
remote: Enumerating objects: 1583, done.
remote: Counting objects: 100% (158/158), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 1583 (delta 126), reused 118 (delta 103), pack-reused 1425
Receiving objects: 100% (1583/1583), 1.17 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1122/1122), done.
bash-4.2$ cd ocurl/
bash-4.2$ opam pin .;
This will pin the following packages: ocurl, curl. Continue? [Y/n] Y
[ocurl.0.9.2] synchronised from git+file:///usr/local/mediacp/ocurl#master
[WARNING] ocurl's opam file has uncommitted changes, using the versioned one
ocurl is now pinned to git+file:///usr/local/mediacp/ocurl#master (version 0.9.2)
Package curl does not exist, create as a NEW package? [Y/n] Y
[curl.~dev] synchronised from git+file:///usr/local/mediacp/ocurl#master
curl is now pinned to git+file:///usr/local/mediacp/ocurl#master (version ~dev)
The following dependencies couldn't be met:
  - ocurl → curl >= 0.9.2
      no matching version

[NOTE] Pinning command successful, but your installed packages may be out of sync.
Russsgithub commented 1 year ago

Similar issues here.

libcurl version 7.68 on Debian bullseye. ....... edit ....... This actually seems to be a Mint install as a vm not debian ( not my computer )

The opam package gives this error.

[ERROR] The compilation of conf-libcurl failed at "/home/russ/.opam/opam-init/hooks/sandbox.sh build curl-config --libs".

=== ERROR while compiling conf-libcurl.2 =====================================
 context     2.0.5 | linux/x86_64 | ocaml-base-compiler.4.14.1 | https://opam.ocaml.org#3644be38
 path        ~/.opam/4.14.1/.opam-switch/build/conf-libcurl.2
 command     ~/.opam/opam-init/hooks/sandbox.sh build curl-config --libs
 exit-code   1
 env-file    ~/.opam/log/conf-libcurl-51282-e7966f.env
 output-file ~/.opam/log/conf-libcurl-51282-e7966f.out

 bwrap: execvp curl-config: No such file or directory

┌─ The following actions failed
│ λ build conf-libcurl 2
└─ 
╶─ No changes have been performed

Using the latest git code I get this.

[ocurl.0.9.2] no changes from git+file:///home/russ/ocurl#master

Sorry, no solution found: there seems to be a problem with your request.

No solution found, exiting
TheRealMattLear commented 1 year ago

So sorry to bump this but just wondering if this is something that could still be resolved?

AxisNL commented 1 year ago

Any news here? Running into the same issues as Matthew above. My C++ is non-existent, and I'd rather not manually patch code retrieved from repositories by people way smarter than me ;)

ygrek commented 1 year ago

bwrap: execvp curl-config: No such file or directory

this is unrelated, it means libcurl4-*-dev package is not installed

TheRealMattLear commented 1 year ago

If i pin ocurl to master then i see a dependency issue. Seems to me that it's expecting curl to return a version greater than 0.9.2 but instead its getting ~dev, and failing.

[root@liquidsoap-test ocurl]# opam pin .
[WARNING] Running as root is not recommended
This will pin the following packages: curl, ocurl. Continue? [Y/n] Y
[NOTE] Package curl is already pinned to git+file:///root/ocurl#master (version ~dev).
curl is now pinned to git+file:///root/ocurl#master (version ~dev)
ocurl is now pinned to git+file:///root/ocurl#master (version 0.9.2)

[ERROR] Package conflict!
  * Missing dependency:
    - curl >= 0.9.2
    no matching version

[NOTE] Pinning command successful, but your installed packages may be out of sync.

If i edit the ocurl.opam file, remove the curl version constraint and then install curl first (separately to ocurl) then everything seems to install and work successfully.

  1. Remove dep constraint from ocurl.opam
    opam-version: "2.0"
    name: "ocurl"
    maintainer: "ygrek@autistici.org"
    homepage: "https://ygrek.org/p/ocurl"
    license: "MIT"
    authors: [ "Lars Nilsson" "ygrek" ]
    dev-repo: "git+https://github.com/ygrek/ocurl.git"
    bug-reports: "https://github.com/ygrek/ocurl/issues"
    build: [
    ]
    depends: [
    "curl"
    ]
    synopsis: "Transitional dummy package: ocurl -> curl"
    description: "Use `opam install curl`"
  2. opam pin -y -n --working-dir .
  3. opam install curl;
  4. opam install ocurl

In any other order, or installing curl togethor with ocurl fails with the version matching problem.

Any thoughts?

ygrek commented 5 months ago

OP issue with CentOS is fixed I believe. opam pin issue (with the workaround that works) is tracked in https://github.com/ygrek/ocurl/issues/74 Thanks for reports and investigations!