Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Mauduit" <bmauduit@beneth.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] yajl: fix build with uClibc
Date: Fri, 22 Apr 2016 15:58:26 +0200	[thread overview]
Message-ID: <571A2E02.8010904@beneth.fr> (raw)
In-Reply-To: <1461219335.6388.20.camel@embedded.rocks>

Hi Vicente, J?rg,

On 04/21/2016 08:15 AM, J?rg Krause wrote:
> (...)
> 
> I'm not sure if it's worth, but I would prefer to fix the CMake build
> files of yajl by checking if libm is needed for isnan and it to the
> list of LIBS and let all executables link against LIBS. Thomas
> Petazzoni did this for an autotools package [3]. For CMake it would be
> something like this:
> 
>     # check if isnan needs libm
>     try_compile(ISNAN_NEEDS_LIBM, ...)
>     if (ISNAN_NEEDS_LIBM)
>       set(LIBS ${LIBS} m)
>     endif ()
> 
>     [..]
> 
>     TARGET_LINK_LIBRARIES(${testProg} yajl ${LIBS})
> 

I just encountered this build issue.
I end up with a patch like that, in yasl Top-level CMakeList.txt :

  # uclibc does not provide isnan() & isinf().
  # Symbol are in libm instead.
  INCLUDE(CheckLibraryExists)
  CHECK_LIBRARY_EXISTS(c isnan "" HAVE_LIBC_ISNAN)

  IF (NOT HAVE_LIBC_ISNAN)
    SET(CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
  ENDIF (NOT HAVE_LIBC_ISNAN)


It works with uClibc based toolchain.

But I am not sure about this patch for compatibility with other C
library. I have just test on my host (glibc) with a dummy CMakeList.txt,
and :

CHECK_LIBRARY_EXISTS(c isnan "" HAVE_LIBC_ISNAN)
>>
-- Looking for isnan in c
-- Looking for isnan in c - found

Anyway, looking at the man page for isnan & isinf, we are supposed to
link against libmath... (Link with -lm)

Regards,

-- 
Beno?t Mauduit
Mail : <bmauduit@beneth.fr>
XMPP : <bmauduit@im.beneth.fr>

      reply	other threads:[~2016-04-22 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20  9:38 [Buildroot] [PATCH] yajl: fix build with uClibc Vicente Olivert Riera
2016-04-21  6:15 ` Jörg Krause
2016-04-22 13:58   ` Benoît Mauduit [this message]

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=571A2E02.8010904@beneth.fr \
    --to=bmauduit@beneth.fr \
    --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