ZABBIX BUGS AND ISSUES

compilation with --enable-static exits with "Curl library not found"

Details

  • Zabbix ID:
    Reviewed 2.0

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.
  1. config.log
    2011 Dec 28 15:17
    253 kB
    Robert Jerzak
  2. config.log
    2011 Nov 23 17:34
    310 kB
    Robert Jerzak

Activity

Hide
Igor Danoshaites added a comment -

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

Show
Igor Danoshaites added a comment - 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
Hide
dimir added a comment -

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.

Show
dimir added a comment - 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.
Hide
Robert Jerzak added a comment -

config.log from failed enable-static compilation

Show
Robert Jerzak added a comment - config.log from failed enable-static compilation
Hide
dimir added a comment -

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.

Show
dimir added a comment - 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.
Hide
Igor Danoshaites added a comment -

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.

Show
Igor Danoshaites added a comment - 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.
Hide
dimir added a comment -

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

Show
dimir added a comment - Fixed in pre-1.8.10 r23802, pre-1.9.9 r23803.
Hide
Robert Jerzak added a comment -

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

Show
Robert Jerzak added a comment - 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
Hide
Robert Jerzak added a comment -

config.log from arch linux

Show
Robert Jerzak added a comment - config.log from arch linux
Hide
Robert Jerzak added a comment -

I tested it on zabbix 1.8.10.

Show
Robert Jerzak added a comment - I tested it on zabbix 1.8.10.
Hide
dimir added a comment -

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.

Show
dimir added a comment - 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.
Hide
Walter Heck added a comment -

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

Show
Walter Heck added a comment - 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
Hide
richlv added a comment -

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

Show
richlv added a comment - it would make sense, but please open a new issue about it
Hide
dimir added a comment -

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

Show
dimir added a comment - I agree on adding that note. Please mention the new issue number here.
Hide
Jason Markowitz added a comment -

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

Show
Jason Markowitz added a comment - I was able to work around this issue by installing glibc-static packages.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: