[ZBX-4377] compilation with --enable-static exits with "Curl library not found" Created: 2011 Nov 23  Updated: 2017 May 30  Resolved: 2011 Dec 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I)
Affects Version/s: 1.8.9
Fix Version/s: 1.8.10, 1.9.9 (beta)

Type: Incident report Priority: Minor
Reporter: Robert Jerzak Assignee: dimir
Resolution: Fixed Votes: 0
Labels: static
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 11.10 x86_64


Attachments: Text File config.log     Text File config.log    

 Description   

Compilation with --enable-static exits with:

checking whether libcurl is usable... no
configure: error: Curl library not found

Example:
./configure --prefix=/usr/local/ --bindir=/usr/local/sbin/ --with-mysql=/usr/bin/mysql_config --enable-server --enable-agent --with-net-snmp --with-libcurl --with-openipmi --enable-ipv6

finish with no errors.

./configure --prefix=/usr/local/ --bindir=/usr/local/sbin/ --with-mysql=/usr/bin/mysql_config --enable-server --enable-agent --with-net-snmp --with-libcurl --with-openipmi --enable-ipv6 --enable-static

[...]
checking whether libcurl is usable... no
configure: error: Curl library not found

The issue can be replicated every time on Ubuntu 11.10 x86_64.



 Comments   
Comment by Igor Danoshaites (Inactive) [ 2011 Nov 23 ]

Hi,

I can reproduce the same case on Ubuntu 10.04.3.

When compiling without "enable-static" parameter all is fine, but when using "--enable-static" parameter with the same configure command, appears the following error:

checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.19.7
checking for libcurl >= version 7.13.1... yes
checking for main in -lcurl... yes
checking whether libcurl is usable... no
configure: error: Curl library not found

Comment by dimir [ 2011 Nov 23 ]

Basically the behavior must be correct here. The problem is the error message though. So what configure does in the "checking whether libcurl is usable" check it compiles simple program that uses libcurl and linkes it statically. libcurl requires bunch of other libraries, which, in turn, must be available in a static versions too. I believe this is the problem, not all the required static libraries are installed.

So the fix is probably to report a proper error in this case, that libcurl is not possible to link statically, instead "libary not found".

That would require some work as we currently just have one message if there are any problem with the library - "library not found". I think we should introduce another one here - "Xxx library is not available for static linking" or something. Which would mean the library itself or any other library it depends on.

Robert, would it be possible to attach config.log which is generated right after the error? Something tells me you are missing a lot of needed static libraries.

Comment by Robert Jerzak [ 2011 Nov 23 ]

config.log from failed enable-static compilation

Comment by dimir [ 2011 Nov 25 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-4377

There was incorrect check for static linking of libcurl. Now the error message should clearly state which library is missing.

Comment by Igor Danoshaites (Inactive) [ 2011 Nov 25 ]

Tested that dev branch ZBX-4377, now in case of error appears correct error message: "error: static library gssapi_krb5 required for linking libcurl not found".

Now it is waiting for code review.

Comment by dimir [ 2011 Dec 06 ]

Fixed in pre-1.8.10 r23802, pre-1.9.9 r23803.

Comment by Robert Jerzak [ 2011 Dec 28 ]

I think there is not always correct error message, for example arch (we use it on production systems) linux:

checking for main in -lz ... (cached) yes
checking for main in -lcurl... yes
checking whether libcurl is usable... no
configure: error: libcurl is not available for static linking

Comment by Robert Jerzak [ 2011 Dec 28 ]

config.log from arch linux

Comment by Robert Jerzak [ 2011 Dec 28 ]

I tested it on zabbix 1.8.10.

Comment by dimir [ 2011 Dec 28 ]

I doubt it will be an easy task to compile Zabbix with all these options you chose for configure statically. You realize that in this case you have to have every external library that is needed in a static version? We can't go and check every library if it's available in a static version. The message states that it's not possible to compile a program with librucl (and other things you chose) statically and it is correct.

Compiling statically is not a trivial task. Expecially if you want to have every piece compiled statically. For example it's possible to compile a program linked with libcurl statically and the rest of the libs dynamically, that would be a much easier task but we do not have currently in Zabbix such a way to define which part is to be linked statically and which dynamically. You could do that yourself by playing with Makefiles and gcc options (the position of --static in parameters list to gcc).

Besides, in some cases static linking is not possible at all:

http://stackoverflow.com/questions/3430400/linux-static-linking-is-dead

I'm closing this issue, please re-open if you disagree.

Comment by Walter Heck [ 2012 Aug 14 ]

Would it make sense to reflect in the documentation and in ./configure --help that static linking is not recommended? That could have just saved me a ton of time

Comment by richlv [ 2012 Aug 22 ]

it would make sense, but please open a new issue about it

Comment by dimir [ 2012 Aug 22 ]

I agree on adding that note. Please mention the new issue number here.

Comment by dimir [ 2012 Aug 30 ]

Added a note here:

http://www.zabbix.com/documentation/2.0/manual/installation/install#configure_the_sources

Comment by Jason Markowitz [ 2013 Aug 21 ]

I was able to work around this issue by installing glibc-static packages.

Generated at Thu Apr 25 19:16:56 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.