I encountered a bug in darcs --flags=curl configuration which I
documented in https://github.com/haskell/cabal/issues/7020 and also
quoted below. A potential fix is:
--- hscurl.c~ Tue Aug 25 14:35:12 2020
+++ hscurl.c Tue Aug 25 15:06:20 2020
@@ -1,4 +1,5 @@
#include "hscurl.h"
+#include "cabal_macros.h"
#include <curl/curl.h>
#include <errno.h>
@@ -47,7 +48,7 @@
static int debug = 0;
#ifndef _WIN32
static const char user_agent[] =
- "darcs/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
+ "darcs/" CURRENT_PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
#else
static const char user_agent[] =
"darcs/unknown libcurl/" LIBCURL_VERSION;
Describe the bug
This bug is similar in flavor to http://bugs.darcs.net/issue1824 but seems
different enough to be a separate issue.
My workaround was to add this trivial patch to darcs.cabal:
--- darcs.cabal.orig
+++ darcs.cabal
@@ -467,7 +467,7 @@ Library
other-modules: Darcs.Util.Download.Curl
cpp-options: -DHAVE_CURL
c-sources: src/hscurl.c
- cc-options: -DHAVE_CURL
+ cc-options: -DHAVE_CURL -DPACKAGE_VERSION="unknown"
if flag(pkgconfig)
pkgconfig-depends: libcurl
else
To Reproduce
Steps to reproduce the behavior:
cabal get darcs
cd darcs-2.16.2
cabal v2-build --flags='curl -library'
...
[240 of 240] Compiling Darcs.UI.Commands.Help (
src/Darcs/UI/Commands/Help.hs,
/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2
.16.2/build/Darcs/UI/Commands/Help.o,
/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build/Darcs/UI/Commands/Help.dyn_o
) [flags changed]
src/hscurl.c:50:11: error:
error: expected ';' after top level declarator
"darcs/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
^
;
|
50 | "darcs/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
| ^
1 error generated.
Expected behavior
Successful compilation.
System information
OpenBSD 6.7-current-amd64
cabal-install version 3.4.0.0 compiled using version 3.4.0.0 of the Cabal
library
The Glorious Glasgow Haskell Compilation System, version 8.10.2
Additional context
Source code in question expects -DPACKAGE_VERSION="foo-bar" to be passed to
the compiler:
static int debug = 0;
#ifndef _WIN32
static const char user_agent[] =
"darcs/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
#else
static const char user_agent[] =
"darcs/unknown libcurl/" LIBCURL_VERSION;
#endif
That's not what happens, as this v2-build -v shows (notice the lack of
-optc-DPACKAGE_VERSION)
creating
/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build
/usr/local/bin/ghc -c -fPIC -odir
/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build
-I/home/greg/s/darcs-2.16.2/dist-
newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build/autogen
-I/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/bui
ld/global-autogen
-I/home/greg/s/darcs-2.16.2/dist-newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build
-Isrc -I/home/greg/s/darcs-2.16.2/dist-newstyle
/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build/src -optc-O2
-optc-D_REENTRANT -optc-DHAVE_CURL -hide-all-packages -no-user-package-db
-package-db /home/g
reg/.cabal/store/ghc-8.10.2/package.db -package-db
/home/greg/s/darcs-2.16.2/dist-newstyle/packagedb/ghc-8.10.2 -package-db
/home/greg/s/darcs-2.16.2/dist-new
style/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/package.conf.inplace
-package-id array-0.5.4.0 -package-id
async-2.2.2-b8d2555724a27ef351a0e96faed4684be787
8bf924425b999a276ee737d3b03c -package-id
attoparsec-0.13.2.4-c774b8582949035a8a382f1006915faad827a4b5052d8d97ed7af883751a4231
-package-id base-4.14.1.0 -packa
ge-id
base16-bytestring-0.1.1.7-bc0d4404809f600d6c05220cd9205d953c5e9bd9b1c830fef888061fa3c0fede
-package-id binary-0.8.8.0 -package-id bytestring-0.10.10.0 -
package-id
conduit-1.3.2-de3c42f2b38d3b1f930a962f0ca541859ee3e077b5c9304303757101dde2992b
-package-id constraints-0.12-2723a2a6e33b3c2803349605ec1d40f7ce6d618
7dec8abd17849b2322f431df1 -package-id containers-0.6.2.1 -package-id
cryptonite-0.27-3ef0550b0ddb14c7c1e391c7c0a64eb5d7b8a87de24641bd4baca77093217415
-package
-id
data-ordlist-0.4.7.0-cfa6fe00536e4558b1af57b6f7afa5611cf60664fa1bfcfff86f98bf65983090
-package-id directory-1.3.6.0 -package-id fgl-5.7.0.3-bd3b3c84ca301a
836637a1e82f08c6d830351ac2619837cd17fddcdc699714b1 -package-id
filepath-1.4.2.1 -package-id
hashable-1.3.0.0-c0ade97a4c26b47e825aed344ac70eb2a4c3b05de0fbc1cca
6278832cb38403e -package-id haskeline-0.8.0.1 -package-id
html-1.0.1.2-8703e94a31122ab9bcc9871d1de503edb962af27eb4c91b568259e205f33d0d0
-package-id http-condu
it-2.3.7.3-72e7eefa8369d3db875ad0d6fef14c8abe20ab81903699dcf53033f2ebdca7d3
-package-id
http-types-0.12.3-ca86ec2481a13f71ee7850f112fb42e2624503a6b6092db770bd
41c195b6152c -package-id
memory-0.15.0-43aa09481377872a2f29972dcea38323922a21dfc698fe6566af373ad85f42c7
-package-id mmap-0.5.9-e2e6deb25cb757fb35983d4df90fb90
27b265a6def02ceee8560745a5d166f8b -package-id mtl-2.2.2 -package-id
network-3.1.2.0-08c5c81fb930fd4d99c14298a448c9063a43a691b7d0ca5ec4a6fe5023afb292
-package-
id
network-uri-2.6.3.0-2bf17fc534cbe2039d6eec1dd458aada013e028aaad226ab812bb4791da4c5d6
-package-id old-time-1.1.0.3-a683a63559c158aa0891ad175ba084b40e88e106d
ad80040bb6f4a2fdf479633 -package-id parsec-3.1.14.0 -package-id
process-1.6.9.0 -package-id
regex-applicative-0.3.4-aa2c19034c739a68ebdbda677a8339e3a131a846e7
614079663ca4ea5f0fd28c -package-id
regex-compat-tdfa-0.95.1.4-54e62a5f646006704280a5c5d7d7a242039d6ab40eb8f8688fc863d9bf081e63
-package-id sandi-0.5-eda026aed
1bb83c4cbfc2f8d1f02ad96b58139489a3d50a9c760a2cd1c924b61 -package-id
stm-2.5.0.0 -package-id
tar-0.5.1.1-650f128d4a24459a601a645a7655f9aff443e929a57d8f9b853471
debc3b7114 -package-id
temporary-1.3-60264428500ee76a2025934c7fb124739e6493b510de283f9869a97efa325e44
-package-id terminfo-0.4.1.4 -package-id text-1.2.3.2 -p
ackage-id time-1.9.3 -package-id transformers-0.5.6.2 -package-id
unix-2.7.2.2 -package-id
unix-compat-0.5.2-f81c542b9354c0fb715a2e42b13a5112fcfb753a07db47d94
0888985f8e6ff43 -package-id
utf8-string-1.0.1.1-3fd8e7eabdaa03bf7463fecdb0ed45c86c1d346d68908c99c56b3aafba2dea72
-package-id vector-0.12.1.2-81f2042bf395943ac
cd20a9baf3afee3af5dd45c04818c637d954dce8ba878e5 -package-id
zip-archive-0.4.1-e48834851c9951953deb5ca163bcb74a10992114a46af3b5808f2bc6274e6449
-package-id zli
b-0.6.2.2-71bb64106f66962574819cd9153c95ebea09e828503e37c378347a49608227e2
src/hscurl.c -hide-all-packages
@phadej
Collaborator
phadej commented 14 minutes ago
The -I/home/greg/s/darcs-2.16.2/dist-
newstyle/build/x86_64-openbsd/ghc-8.10.2/darcs-2.16.2/build/autogen is in
the path. Do you #include "cabal_macros.h"?
@blackgnezdo
Author
blackgnezdo commented 4 minutes ago •
It didn't before, but it does now. Is CURRENT_PACKAGE_VERSION the official
contract?
--- hscurl.c~ Tue Aug 25 14:35:12 2020
+++ hscurl.c Tue Aug 25 15:06:20 2020
@@ -1,4 +1,5 @@
#include "hscurl.h"
+#include "cabal_macros.h"
#include <curl/curl.h>
#include <errno.h>
@@ -47,7 +48,7 @@
static int debug = 0;
#ifndef _WIN32
static const char user_agent[] =
- "darcs/" PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
+ "darcs/" CURRENT_PACKAGE_VERSION " libcurl/" LIBCURL_VERSION;
#else
static const char user_agent[] =
"darcs/unknown libcurl/" LIBCURL_VERSION;
Yes, this does fix the problem. Thank you!
--
nest.cx is Gmail hosted, use PGP:
https://pgp.key-server.io/0x0B1542BD8DF5A1B0
Fingerprint: 5E2B 2D0E 1E03 2046 BEC3 4D50 0B15 42BD 8DF5 A1B0
Attachments
|