ygrek / ocurl

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

clibs.sexp fails with "This atom must be quoted ..." #83

Open jonahbeckford opened 1 month ago

jonahbeckford commented 1 month ago

I'm using the latest master branch with MSVC on Windows. I had ocurl working in release 0.9.2.

$ opam exec --switch dkml dune build
File "_build/default/clibs.sexp", line 3, characters 1-93:
3 | (Y:/source/dksdk-coder/.ci/o/dkml/share/dkcoder-c/debug/lib/pkgconfig/../../lib/libcurl-d.lib)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This atom must be quoted because it is the first element of a list and
doesn't start with - or:

This is from clibs.sexp.in that has:

;; @configure_input@

(@CURLLIBS@)

with the parameters from config.log:

CURLLIBS='Y:/source/dksdk-coder/.ci/o/dkml/share/dkcoder-c/debug/lib/pkgconfig/../../lib/libcurl-d.lib'

and that is from libcurl.pc:

exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/../include
supported_protocols="DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS IPFS IPNS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP WS WSS"
supported_features="SSL IPv6 UnixSockets libz brotli zstd AsynchDNS IDN Largefile SSPI alt-svc HSTS SPNEGO Kerberos NTLM HTTP2 HTTPS-proxy unicode threadsafe"

Name: libcurl
URL: https://curl.se/
Description: Library to transfer files with ftp, http, etc.
Version: 8.6.0-DEV
Libs: "${libdir}/libcurl-d.lib"
Libs.private:  cares.lib iphlpapi.lib ws2_32.lib bcrypt.lib zlibd.lib brotlidec.lib brotlicommon.lib zstd.lib nghttp2.lib normaliz.lib advapi32.lib crypt32.lib
Cflags: "-I${includedir}" 

Double-quoting CURLLIBS is sufficient to fix my problem, but I doubt that works when CURLLIBS has multiple terms like -L/some/where -lcurl.

Anyway, simply sticking the output of pkg-config into a Dune s-exp does not guarantee a valid Dune s-exp. Dune has a Dune Configurator that handles generating s-exp correctly, but sadly that is an overhaul of the build system for ocurl.

jonahbeckford commented 1 month ago

Oh, I just saw https://github.com/ygrek/ocurl/pull/81 ... I will test if that fixes this issue.

EDIT: Yes, the PR fixes this issue.