|Summary:||ASTERISK-11540: curl does not seem to work when cross-compiling|
|Date Opened:||2008-02-28 13:26:16.000-0600||Date Closed:||2008-03-01 00:56:10.000-0600|
|Description:||I am trying to get curl available under astlinux - but there seems to be a problem when cross-compiling curl_lib. |
the error is :
[LD] func_curl.o -> func_curl.so
/usr/src/astlinux/build_i586/staging_dir/bin-ccache/../lib/gcc/i586-linux-uclibc/4.1.2/../../../../i586-linux-uclibc/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
make: *** [func_curl.so] Error 1
Please see additional info for more info
****** ADDITIONAL INFORMATION ******
this is a conversation with one of the developers of astlinux:
I missed the conversation on this a few days ago, but Julian brought up some issues with cross-compiling Curl w/ Asterisk.
I'm trying to help out with that, and from what I can tell, Asterisk's "configure" file will run curl-config locally, even if $cross_compiling is "yes".
There doesn't seem to be an easy way (that I can tell, anyway, but I'm no autoconf expert) Asterisk to use a given path for curl libraries when cross-compiling.
|Comments:||By: Russell Bryant (russell) 2008-02-28 15:38:07.000-0600|
It is correct behavior to run curl-config locally. We have to run it to get the right CFLAGS and LDFALGS to build against curl.
In this build environment, what do you get for:
$ which curl-config
? You should get the one that is going to return the right flags for the _target_ build environment.
The results of curl-config --cflags and curl-config --libs are the CFLAGS and LDFLAGS used.
By: jmls (jmls) 2008-02-28 15:43:35.000-0600
okay, noob question:
if you are building on a AMD64, but targeting an i586, shouldn't the curl-config be run against the target-environment, not locally ?
By: Russell Bryant (russell) 2008-02-28 16:07:49.000-0600
No. curl-config is not a run-time tool. It is a _build time_ tool that tells you how to compile against the library.
By: Darrick Hartman (dhartman) 2008-02-29 22:25:48.000-0600
Actually, curl-config works as expected. The path to the libraries must be explicitly passed to the compiler as curl-config simply reports the library, but not the path. Simple fix and we have this working.
(which is correct)
(which is also correct, but meaningless unless the compiler knows to look in /home/dhartman/astlinux/trunk/build_i586/usr/lib for libcurl)
Please consider this closed.
By: Philip Prindeville (pprindeville) 2008-02-29 23:05:51.000-0600
I would be that unnamed developer above.
The issue is the following. When you're cross-compiling, the whole notion of something like "curl-config" is just plain wrong.
The host system's curl-config can give correct results when *not* cross-compiling (i.e. for a local build).
The target system's curl-config will give correct results *when run on the target system*, and they will be correct relative to the target system's root filesystem.
However, you simply can't run "curl-config" (host or target) because neither versus is appropriate in a cross-compilation setting.
So, the only way about this is to allow passing in explicit paths via ac_cv_* variables, or else add a few more --with-curl-* arguments (--with-curl-include, --with-curl-libs, --with-curl-libdir, etc).
These options should work both in native compilation and cross-compilation modes.
But under no circumstances should curl-config ever be used in cross-compilation.
By: Tilghman Lesher (tilghman) 2008-03-01 00:53:37.000-0600
In fact, the developers of libcurl suggest using curl-config, even when it comes to autoconf: http://cool.haxx.se/cvs.cgi/curl/docs/libcurl/libcurl.m4?rev=HEAD&content-type=text/vnd.viewcvs-markup
If you have an issue with their suggestion, then you should take it up with them. At this time, we are not prepared to supercede the official method of configuring libcurl, so as a result, you are advised not to use libcurl for cross-compiling.
If you would like us to use a method that will work for both native compiling as well as cross-compiling, my suggestion is that you contribute that back upstream to the libcurl project. When they have that capability, we'll be happy to add it here, as well.
By: Tilghman Lesher (tilghman) 2008-03-01 00:56:10.000-0600
Not supported by the library vendor.