Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 585264 - sys-libs/uclibc-0.9.33.2-r15: does not provide full C99 floating point environment (fenv.h)
Summary: sys-libs/uclibc-0.9.33.2-r15: does not provide full C99 floating point enviro...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: uclibc-porting
  Show dependency tree
 
Reported: 2016-06-07 08:57 UTC by tt_1
Modified: 2021-11-18 12:33 UTC (History)
3 users (show)

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


Attachments
build.log (perl-uclibc.log.gz,6.17 KB, application/octet-stream)
2016-06-07 08:57 UTC, tt_1
Details
output of emerge --info (emerge-info,4.33 KB, text/plain)
2016-06-07 09:05 UTC, tt_1
Details
proposed patch (perl-5.22.2-uclibc.diff,328 bytes, patch)
2016-06-07 09:07 UTC, tt_1
Details | Diff
uclibc config (uclibc-0.9.33.2-r15,5.68 KB, text/plain)
2016-06-07 09:28 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2016-06-07 08:57:24 UTC
Created attachment 436742 [details]
build.log

quote from the build log

POSIX.xs: In function 'my_fegetround':
POSIX.xs:992:18: error: 'FE_TOWARDZERO' undeclared (first use in this function)
   case 0: return FE_TOWARDZERO;
                  ^
POSIX.xs:992:18: note: each undeclared identifier is reported only once for each function it appears in
POSIX.xs:994:18: error: 'FE_UPWARD' undeclared (first use in this function)
   case 2: return FE_UPWARD;
                  ^
POSIX.xs:995:18: error: 'FE_DOWNWARD' undeclared (first use in this function)
   case 3: return FE_DOWNWARD;



It seems as if uclibc does not provide fenv.h, therefore the build fails. I can confirm this bug for arm, but I have not tested any other arch. 5.22.2 is not yet stable on x86/amd64 anyway, so it won't break stages, won't it?
Comment 1 tt_1 2016-06-07 09:05:03 UTC
Created attachment 436744 [details]
output of emerge --info
Comment 2 tt_1 2016-06-07 09:07:26 UTC
Created attachment 436746 [details, diff]
proposed patch

Compilation is fixed by commenting out this section. There may be some more convenient solution though.
Comment 3 Anthony Basile gentoo-dev 2016-06-07 09:15:15 UTC
You need to turn on the option UCLIBC_HAS_FENV=y.  If you have that on and its still failing, then reopen this bug.
Comment 4 tt_1 2016-06-07 09:28:57 UTC
Created attachment 436750 [details]
uclibc config

cat /etc/portage/savedconfig/uclibc/uclibc-0.9.33.2-r15 | grep FENV
UCLIBC_HAS_FENV=y

I'm using the savedconfig useflag for uclibc, hence fenv.h is activated.
Comment 5 Anthony Basile gentoo-dev 2016-06-07 11:34:43 UTC
(In reply to tt_1 from comment #4)
> Created attachment 436750 [details]
> uclibc config
> 
> cat /etc/portage/savedconfig/uclibc/uclibc-0.9.33.2-r15 | grep FENV
> UCLIBC_HAS_FENV=y
> 
> I'm using the savedconfig useflag for uclibc, hence fenv.h is activated.

comment #0 says "uclibc does not provide fenv.h", so i assumed you had it off.  can you give me the results to `find /usr/include -iname fenv.h`.  if you find fenv.h, then can you test the following program. you need to compile it with

gcc -o test test.c -lm



#include <stdio.h>
#include <fenv.h>

int main() {
	int m, c, f;
	double d = 2.0;

	printf("Enter an int. >10 will overflow: ");
	scanf("%d", &m);
	if (m < 0)
		perror("int not positive.");

	for (c = 0; c < m; c++)
		d *= d;
	//printf("%lf\n", d);

	f = fetestexcept(FE_OVERFLOW);
	if (f & FE_OVERFLOW)
		printf("Got overflow\n");
	else
		printf("No overflow\n");
}
Comment 6 Anthony Basile gentoo-dev 2016-06-07 11:40:52 UTC
(In reply to Anthony Basile from comment #5)

> 		perror("int not positive.");

stupid minor error.  i meant to use errx(0, "int not positive."); there since perror() doesn't exit.
Comment 7 tt_1 2016-06-07 12:55:00 UTC
Well, I guessed that uclibc doesn't provide fenv.h as to me the error seemed to be about the lack of it. However, it is present: 

user ~ $ find /usr/include -iname fenv.h
/usr/include/fenv.h
/usr/include/bits/fenv.h

the testcase you posted fails on armv7a-hardfp-uclibc with the following error 


/tmp/ccoYxz9l.o: In function `main':
test.c:(.text+0xa0): undefined reference to `fetestexcept'
collect2: error: ld returned 1 exit status
Comment 8 Anthony Basile gentoo-dev 2016-06-07 13:51:12 UTC
(In reply to tt_1 from comment #7)
> Well, I guessed that uclibc doesn't provide fenv.h as to me the error seemed
> to be about the lack of it. However, it is present: 
> 
> user ~ $ find /usr/include -iname fenv.h
> /usr/include/fenv.h
> /usr/include/bits/fenv.h
> 
> the testcase you posted fails on armv7a-hardfp-uclibc with the following
> error 
> 
> 
> /tmp/ccoYxz9l.o: In function `main':
> test.c:(.text+0xa0): undefined reference to `fetestexcept'
> collect2: error: ld returned 1 exit status

I've confirmed that uclibc-0.9.33.2-r15 is not supplying any of the fenv functions. you can check with `readelf -sW /lib/libm.so.0`  I need to check -9999 and uclibc-ng.
Comment 9 Anthony Basile gentoo-dev 2016-06-09 21:54:15 UTC
(In reply to Anthony Basile from comment #8)

> I've confirmed that uclibc-0.9.33.2-r15 is not supplying any of the fenv
> functions. you can check with `readelf -sW /lib/libm.so.0`  I need to check
> -9999 and uclibc-ng.

No version of uclibc{,-ng} provides the floating point exception functions protoyped in fenv.h.  However, this seems to cause a problem only for perl >5.22.0 on arm.  I had no problem building perl on amd64.  So I cc-ed the perl team to inform them.

I'm looking now to see what's going on with perl on arm.
Comment 10 Anthony Basile gentoo-dev 2016-06-09 23:29:46 UTC
(In reply to Anthony Basile from comment #9)
> (In reply to Anthony Basile from comment #8)
> 
> > I've confirmed that uclibc-0.9.33.2-r15 is not supplying any of the fenv
> > functions. you can check with `readelf -sW /lib/libm.so.0`  I need to check
> > -9999 and uclibc-ng.
> 
> No version of uclibc{,-ng} provides the floating point exception functions
> protoyped in fenv.h.  However, this seems to cause a problem only for perl
> >5.22.0 on arm.  I had no problem building perl on amd64.  So I cc-ed the
> perl team to inform them.
> 
> I'm looking now to see what's going on with perl on arm.

I found the issue.  <bits/fenv.h> on arm guards the enums and defines with "#ifdef __MAVERICK__"  It doesn't on amd64 nor x86.

You should be able to build perl 5.22.2 as follows

# echo "dev-lang/perl perl.conf" >> /etc/portage/package.env 
# mkdir -p /etc/portage/env
# echo "CPPFLAGS=-D__MAVERICK__" >> /etc/portage/env/perl.conf
# emerge perl

can you verify.
Comment 11 Anthony Basile gentoo-dev 2016-06-10 00:02:52 UTC
(In reply to Anthony Basile from comment #10)

> # echo "CPPFLAGS=-D__MAVERICK__" >> /etc/portage/env/perl.conf

looks like perl's build system doesn't respect CPPFLAGS.  i tested and the following works with CFLAGS, so replace this line with

# echo "CFLAGS=-D__MAVERICK__" >> /etc/portage/env/perl.conf
Comment 12 tt_1 2016-06-10 10:19:32 UTC
I can confirm that this workaround is fixing the compile issue, on armv7a profile.
Comment 13 Andreas K. Hüttel archtester gentoo-dev 2017-01-04 09:18:15 UTC
Right now I have no clue how to 1) either upstream this (preferable) or 2) add it to an ebuild... please advise!
Comment 14 Anthony Basile gentoo-dev 2017-01-04 13:38:11 UTC
(In reply to Andreas K. Hüttel from comment #13)
> Right now I have no clue how to 1) either upstream this (preferable) or 2)
> add it to an ebuild... please advise!

We've moved past uclibc to uclibc-ng.  I don't have my arm system up right now, but it may be the case that this is no longer needed.  Check <bits/fenv.h> and see if __MAVERICK__ is still present.  If it is, then I'll upstream the fix to uclibc-ng.  If it isn't then I'll close this bug WONTFIX because uclibc is dead.

@dilfridge, don't add anything to an ebuild as this is way too hacky to polute our ebuilds.  The fix, if needed, must go into uclibc-ng.
Comment 15 Anthony Basile gentoo-dev 2018-10-14 12:33:03 UTC
sys-libs/uclibc has been removed from the tree, replaced by sys-libs/uclibc-ng.  if this is still a problem on uclibc-ng, please open a new bug.
Comment 16 Anthony Basile gentoo-dev 2018-10-14 12:34:58 UTC
Sorry this should be kept open.

(In reply to Anthony Basile from comment #15)
> sys-libs/uclibc has been removed from the tree, replaced by
> sys-libs/uclibc-ng.  if this is still a problem on uclibc-ng, please open a
> new bug.
Comment 17 tt_1 2018-10-15 06:33:52 UTC
I think it was dev-lang/perl failing due to this, and that you fixed it by adding a certain cflag to it which disabled the use of fenv.h, wasn't it?
Comment 18 Anthony Basile gentoo-dev 2018-10-15 13:18:08 UTC
(In reply to tt_1 from comment #17)
> I think it was dev-lang/perl failing due to this, and that you fixed it by
> adding a certain cflag to it which disabled the use of fenv.h, wasn't it?

Correct, but the fix hasn't gone into uclibc-ng yet.  (Busy with real life)  If you like you can try to upstream it.  Just reference this bug.
Comment 19 tt_1 2018-10-15 15:38:21 UTC
I may send it to upstream in your name, but for that I need the patch and their bugtracker, mailinglist, or whatever they are using for handing in patches.