Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] AC_CHECK_LIB doesn't work for cross-compiling
Date: Fri, 26 Dec 2014 15:31:07 +0100	[thread overview]
Message-ID: <20141226153107.6402246e@free-electrons.com> (raw)
In-Reply-To: <549C0B06.60808@infipwr.com>

Dear Adam Jiang,

On Thu, 25 Dec 2014 22:03:02 +0900, Adam Jiang wrote:

> > 	AC_CHECK_LIB([fcgi], [FCGX_InitRequest], [LIBS="$LIBS -lfcgi],
> > 		[AC_MSG_WARN("unable to find the FCGX_InitRequest() function")],
> > 		[-lm])
> 
> Em...I can understand the issue now. However, would it be possible for 
> libfcgi to resolve its dependency somehow?

For dynamic linking, this should happen automatically, provided libfcgi
is properly linked against libm. But indeed, after a quick look, it
turns out that libfcgi uses frexp() but isn't linked against libm:

$ readelf -a libfcgi.so.0.0.0
[...]
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libnsl.so.0]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]
 0x0000000e (SONAME)                     Library soname: [libfcgi.so.0]
[...]
   176: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND frexp

To me, this looks like a bug in libfcgi build system.

However, even if libfcgi is linked against libm, this will not solve
the case of static linking. In this case, the only proper solution
would be to extend libfcgi to install a .pc (pkg-config) file, and have
your package use PKG_CHECK_MODULES() instead of AC_CHECK_LIB().

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2014-12-26 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-25  4:34 [Buildroot] AC_CHECK_LIB doesn't work for cross-compiling Adam Jiang
2014-12-25  4:47 ` Baruch Siach
2014-12-25  6:27   ` Adam Jiang
2014-12-25  6:49     ` Baruch Siach
2014-12-25 13:03       ` Adam Jiang
2014-12-26 14:31         ` Thomas Petazzoni [this message]
2014-12-25 13:25       ` Adam Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141226153107.6402246e@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox