darcs

Issue 2345 misleading error from -liconv check in Setup.lhs

Title misleading error from -liconv check in Setup.lhs
Priority Status resolved
Milestone Resolved in 2.10.0
Superseder Nosy List DaniilFrumin, int-e
Assigned To DaniilFrumin
Topics

Created on 2013-09-22.17:56:06 by int-e, last changed 2014-04-23.17:48:45 by noreply.

Files
File name Uploaded Type Edit Remove
resolve-issue2345_-solution-using-cabal_s-checkforeigndeps.dpatch DaniilFrumin, 2014-01-20.22:14:00 application/octet-stream
Messages
msg17040 (view) Author: int-e Date: 2013-09-22.17:56:04
1. Summarise the issue (what were doing, what went wrong?)

Here is what I see:

> cabal configure -ftest
Resolving dependencies...
Configuring darcs-2.9.7...
checking whether to use -liconv... setup: Unable to link against the
iconv library.

However, compiling the test program with gcc works, without -liconv:
> cat i.c
#include <iconv.h>
int main(void) {
    iconv_t t = iconv_open("UTF-8", "UTF-8");
    return 0;
}
> gcc i.c

Looking closer (cabal configure -ftest -v) reveals that the program
is linked against libcurl, and this does indeed fail:

> gcc -lcurl i.c
/usr/bin/ld: cannot find -lcurl
collect2: error: ld returned 1 exit status

Obviously this has nothing to do with the -liconv flag.

Finally, disabling libcurl helps:

> cabal configure -ftest -f-curl
Resolving dependencies...
Configuring darcs-2.8.4...
checking whether to use -liconv... not needed.


2. What behaviour were you expecting instead?

Ideally, Setup.lhs would detect that libcurl is missing and suggest that
I should configure with -f-curl (or clear the flag on its own.)

I suppose that a minimal solution would be to filter out the curl extra
library when compiling the iconv test program.


3. What darcs version are you using? (Try: darcs --exact-version)

2.8.4 from hackage.
(This still happens with the development version as of today.)


4. What operating system are you running?

Debian Linux on x86_64. libcurl is installed, but the development package
is missing, so the linker doesn't find it:

> ls /usr/lib/x86_64-linux-gnu/libcurl.*
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0
msg17136 (view) Author: DaniilFrumin Date: 2014-01-20.22:14:00
Possible solution to the issue.

I was not sure about getting rid of the `postConf` hook altogether.
Right now, the default `postConf` hook contains just that: an external
dependency check; however, they might arrive at the stage when they want
to add something else to that hook.

Here is some sample output from my Linux system without the libcurl-dev
package:

----------------------------------------------
[0] % cabal configure -fforce-char8-encoding
Resolving dependencies...
[1 of 1] Compiling Main             ( Setup.lhs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring darcs-2.9.8...
setup: Missing dependency on a foreign library:
* Missing (or bad) header file: curl/curl.h
* Missing C library: curl
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by
the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

[1] % cabal configure -fforce-char8-encoding -f-curl
Resolving dependencies...
Configuring darcs-2.9.8...
checking whether to use -liconv... not needed.

----------------------------------------------
Attachments
msg17390 (view) Author: noreply Date: 2014-04-23.17:48:44
The following patch sent by Dan Frumin <difrumin@gmail.com> updated issue issue2345 with
status=resolved;resolvedin=2.10.0 HEAD

* resolve issue2345: solution using cabal's checkForeignDeps 
Ignore-this: 57f9b20bdd5ec2973f9ddbb87f394513

Usually, Cabal performs the external dependencies check after the
configuration phase, in the `postConf` hook. This patch moves this
check into the configure section.
History
Date User Action Args
2013-09-22 17:56:06int-ecreate
2014-01-20 21:48:52DaniilFruminsetstatus: unknown -> (no value)
nosy: + DaniilFrumin
assignedto: DaniilFrumin
2014-01-20 22:14:02DaniilFruminsetstatus: has-patch
files: + resolve-issue2345_-solution-using-cabal_s-checkforeigndeps.dpatch
messages: + msg17136
2014-04-23 17:48:45noreplysetstatus: has-patch -> resolved
messages: + msg17390
resolvedin: 2.10.0