Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 512738 - dev-libs/yajl-2.0.3 with sys-libs/uclibc - ../yajl-2.0.3/lib/libyajl.so.2.0.3: undefined reference to `__isnan'
Summary: dev-libs/yajl-2.0.3 with sys-libs/uclibc - ../yajl-2.0.3/lib/libyajl.so.2.0.3...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Michael Weber (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 664216
Blocks: uclibc-porting
  Show dependency tree
 
Reported: 2014-06-08 12:42 UTC by René Rhéaume
Modified: 2018-08-21 19:52 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
yajl-add_libm.patch (yajl-add_libm.patch,853 bytes, patch)
2014-06-08 12:43 UTC, René Rhéaume
Details | Diff
yajl-2.0.3.ebuild.patch (yajl-2.0.3.ebuild.patch,240 bytes, patch)
2014-06-08 12:44 UTC, René Rhéaume
Details | Diff
build.log (build.log,16.18 KB, text/plain)
2014-06-08 13:51 UTC, René Rhéaume
Details
emerge --info output (file_512738.txt,5.31 KB, text/plain)
2014-06-08 13:54 UTC, René Rhéaume
Details
yajl-add_libm-r1.patch (yajl-add_libm-r1.patch,293 bytes, patch)
2015-09-14 09:48 UTC, René Rhéaume
Details | Diff
yajl-add_libm-r2.patch (yajl-add_libm-r2.patch,562 bytes, patch)
2016-04-28 10:29 UTC, René Rhéaume
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description René Rhéaume 2014-06-08 12:42:48 UTC
yajl does not build  on uclibc because it uses math functions without linking to libm. The patch adds -lm to the compile command line

Reproducible: Always

Steps to Reproduce:
1. Install lilblue
2. emerge -1 dev-libs/yajl
Actual Results:  
emake failed (compile phase)

Expected Results:  
yajl installed on system
Comment 1 René Rhéaume 2014-06-08 12:43:36 UTC
Created attachment 378474 [details, diff]
yajl-add_libm.patch
Comment 2 René Rhéaume 2014-06-08 12:44:42 UTC
Created attachment 378476 [details, diff]
yajl-2.0.3.ebuild.patch
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-06-08 12:50:42 UTC
Comment on attachment 378474 [details, diff]
yajl-add_libm.patch

(In reply to René Rhéaume from comment #0)
> yajl does not build  on uclibc because it uses math functions without
> linking to libm. The patch adds -lm to the compile command line

That would apply equally to building against glibc or any other C library implementation that splits off libm.

Injecting -lm into CFLAGS isn't the proper place, either.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2014-06-08 12:54:24 UTC
1) Please post your `emerge --info' output in a comment.
2) Please attach the entire build log to this bug report.
Comment 5 René Rhéaume 2014-06-08 13:51:28 UTC
Created attachment 378494 [details]
build.log
Comment 6 René Rhéaume 2014-06-08 13:54:24 UTC
Created attachment 378496 [details]
emerge --info output
Comment 7 René Rhéaume 2014-08-12 11:15:16 UTC
Should this bug added as one blocking bug 372079?
Comment 8 Anthony Basile gentoo-dev 2015-04-21 16:46:45 UTC
(In reply to Jeroen Roovers from comment #3)
> Comment on attachment 378474 [details, diff] [details, diff]
> yajl-add_libm.patch
> 
> (In reply to René Rhéaume from comment #0)
> > yajl does not build  on uclibc because it uses math functions without
> > linking to libm. The patch adds -lm to the compile command line
> 
> That would apply equally to building against glibc or any other C library
> implementation that splits off libm.
> 
> Injecting -lm into CFLAGS isn't the proper place, either.

I've reproduced this:

emerge -1 dev-libs/yajl              #fails
LDFLAGS=-lm emerge -1 dev-libs/yajl  #works

So I suspect there is some problem with automatically linking against libm because I've seen this issue with some other packages too, nettle comes to mind.  Adding LDFLAGS=-lm is harmless enough but its only a workaround, not a fix.  I'm going to have to learn what makes -lm automatic.
Comment 9 René Rhéaume 2015-09-14 09:48:40 UTC
Created attachment 411882 [details, diff]
yajl-add_libm-r1.patch

A better patch, in which -lm is prepended to linker flags.

Another thing to note is that on glibc, the isnan symbol is inside libc.so even though the manual page states "Link with -lm"
Comment 10 Jörg Krause 2016-04-19 19:23:03 UTC
(In reply to René Rhéaume from comment #9)
> Created attachment 411882 [details, diff] [details, diff]
> yajl-add_libm-r1.patch
> 
> A better patch, in which -lm is prepended to linker flags.
> 
> Another thing to note is that on glibc, the isnan symbol is inside libc.so
> even though the manual page states "Link with -lm"

This patch does not fix static build. Furthermore, TARGET_LINK_LIBRARIES is a better place for specifying libraries to use for linking.
Comment 11 René Rhéaume 2016-04-28 04:37:56 UTC
(In reply to Jörg Krause from comment #10)
> This patch does not fix static build. Furthermore, TARGET_LINK_LIBRARIES is
> a better place for specifying libraries to use for linking.

Can you provide a patch?
Comment 12 René Rhéaume 2016-04-28 10:29:03 UTC
Created attachment 432412 [details, diff]
yajl-add_libm-r2.patch

(In reply to René Rhéaume from comment #11)
> (In reply to Jörg Krause from comment #10)
> > This patch does not fix static build. Furthermore, TARGET_LINK_LIBRARIES is
> > a better place for specifying libraries to use for linking.
> 
> Can you provide a patch?

Well, I am providing a new patch, after reading how to use TARGET_LINK_LIBRARIES. However, when someone already knows how to make the patch, I prefer that the person makes it. It means a quicker resolution of the bug.
Comment 13 Larry the Git Cow gentoo-dev 2018-08-19 21:26:10 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e0a99479df558044065d9040b535bd7068981c1

commit 8e0a99479df558044065d9040b535bd7068981c1
Author:     Michael Weber <xmw@gentoo.org>
AuthorDate: 2018-08-19 21:25:43 +0000
Commit:     Michael Weber <xmw@gentoo.org>
CommitDate: 2018-08-19 21:25:43 +0000

    dev-libs/yajl: Use EAPI=6, fix build with uclibc (bug 512738).
    
    Thanks a17r and René Rhéaume.
    
    Closes: https://github.com/gentoo/gentoo/pull/9620
    Closes: https://bugs.gentoo.org/512738
    Package-Manager: Portage-2.3.45, Repoman-2.3.10

 dev-libs/yajl/files/yajl-2.1.0-uclibc.patch | 14 +++++++++++
 dev-libs/yajl/yajl-2.1.0-r1.ebuild          | 38 +++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)