Bug 194183 (arm_R) - [arm] math/R missing libquadmath to compile
Summary: [arm] math/R missing libquadmath to compile
Status: Closed FIXED
Alias: arm_R
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Many People
Assignee: Brendan Fabeny
URL: http://chips.ysv.freebsd.org/data/11a...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-06 13:45 UTC by Sean Bruno
Modified: 2015-02-13 21:42 UTC (History)
4 users (show)

See Also:
sbruno: maintainer-feedback? (bf)


Attachments
fix signedness issue on armv6 (585 bytes, patch)
2015-01-20 16:13 UTC, Mikael Urankar
no flags Details | Diff
Include previous patch, add MISSING to default options on ARMv6 (1.53 KB, patch)
2015-02-08 20:21 UTC, Sean Bruno
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Bruno freebsd_committer freebsd_triage 2014-10-06 13:45:58 UTC
When using a patched version of gcc that will build on ARMv6, math/R will not build due to missing libquadmath.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-10-06 13:45:58 UTC
Auto-assigned to maintainer bf@FreeBSD.org
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2015-01-17 19:47:27 UTC
I added the MISSING option to allow R to build itself, which seemed to be progressing very well.

It seems to stumble a bit running a test of some sort that I don't understand:

# make
`libRblas.so' is up to date.
/wrkdirs/usr/ports/math/R/work/R-3.0.2/lib/libRblas.so is unchanged
`Makedeps' is up to date.
`libtre.a' is up to date.
`libappl.a' is up to date.
`libnmath.a' is up to date.
`libunix.a' is up to date.
gcc48 -std=gnu99 -I. -I../../src/include -I../../src/include -I/usr/local/include -I/usr/local/include -DLIBICONV_PLUG -DHAVE_CONFIG_H  -fopenmp -fpic  -O -pipe  -DLIBICONV_PLUG -Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing -DR_HOME='"/wrkdirs/usr/ports/math/R/work/R-3.0.2"' -o Rscript  ./Rscript.c
/wrkdirs/usr/ports/math/R/work/R-3.0.2/lib/libR.so is unchanged
/wrkdirs/usr/ports/math/R/work/R-3.0.2/bin/exec/R is unchanged
`internet.so' is up to date.
`libRlapack.so' is up to date.
/wrkdirs/usr/ports/math/R/work/R-3.0.2/lib/libRlapack.so is unchanged
`lapack.so' is up to date.
`vfonts.so' is up to date.
`R_X11.so' is up to date.
`R_de.so' is up to date.
/wrkdirs/usr/ports/math/R/work/R-3.0.2/modules/R_X11.so is unchanged
/wrkdirs/usr/ports/math/R/work/R-3.0.2/modules/R_de.so is unchanged
building system startup profile
building package 'translations'
building package 'base'
all.R is unchanged
building package 'tools'
all.R is unchanged
../../../../library/tools/libs/tools.so is unchanged
Error: Line starting 'Package: tools ...' is malformed!
Execution halted
*** Error code 1

Stop.
make[3]: stopped in /wrkdirs/usr/ports/math/R/work/R-3.0.2/src/library/tools
*** Error code 1

Stop.
make[2]: stopped in /wrkdirs/usr/ports/math/R/work/R-3.0.2/src/library
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/math/R/work/R-3.0.2/src
*** Error code 1

Stop.
make: stopped in /wrkdirs/usr/ports/math/R/work/R-3.0.2
# uname -a
FreeBSD 11armv6-11-armv6-ports 11.0-CURRENT FreeBSD 11.0-CURRENT r277146 arm
Comment 3 Sean Bruno freebsd_committer freebsd_triage 2015-01-17 19:48:53 UTC
seems to be coming from here, which I don't fully understand:

root@11armv6-11-armv6-ports:/wrkdirs/usr/ports/math/R/work/R-3.0.2/src/library/tools # sh
# echo "tools:::.install_package_description('.', '"../../../library/tools"')" |  R_DEFAULT_PACKAGES=NULL ../../../bin/R --vanilla --slave
Error: Line starting 'Package: tools ...' is malformed!
Execution halted
Comment 4 Mikael Urankar freebsd_committer freebsd_triage 2015-01-20 16:13:10 UTC
Created attachment 151907 [details]
fix signedness issue on armv6

I think there is a signedness issue in the 'tre' regex library, correct me if I'm wrong:

in R-3.0.2/src/extra/tre/tre-internal.h, we have
(line 52): typedef wint_t tre_cint_t;
(line 53): #define TRE_CHAR_MAX WCHAR_MAX

for arm: __WCHAR_MAX == __UINT_MAX == 0xffffffff (see include/_types.h and include/_limits.h)

in R-3.0.2/src/extra/tre/tre-parse.c, we have
(line 279): tre_cint_t min = 0, max = 0;
(line 349): max = TRE_CHAR_MAX;

so max is of type tre_cint_t == wint_t == __wint_t == __ct_rune_t == int (see /usr/include/wctype.h and /usr/include/sys/_types.h)

at the end: max = -1;

A pull request was issued upstream with no follow-up (https://github.com/andreas-schwab/tre/commit/182e1060dc3bfc175490f6e0e961d9330971299c)

I don't know if the fix is correct but it allows to build math/R on arm.

I think the attached patch can be applied for all arches because on x86, powerpc, sparc64 and powerpc __WCHAR_MAX = __INT_MAX = 0x7fffffff
Comment 6 Sean Bruno freebsd_committer freebsd_triage 2015-02-08 20:21:36 UTC
Created attachment 152769 [details]
Include previous patch, add MISSING to default options on ARMv6
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-02-10 22:24:44 UTC
A commit references this bug:

Author: sbruno
Date: Tue Feb 10 22:24:03 UTC 2015
New revision: 378808
URL: https://svnweb.freebsd.org/changeset/ports/378808

Log:
  Repair overflow condition where WCHAR_MAX != INT_MAX
  https://github.com/andreas-schwab/tre/commit/182e1060dc3bfc175490f6e0e961d9330971299c

  Add MISSING option to the default build on armv6.

  PR:		194183
  Submitted by:	mikael.urankar@gmail.com, Adreas Schwab
  Approved by:	maintainer timeout (3 months without PR comment)

Changes:
  head/math/R/Makefile
  head/math/R/files/patch-src_extra_tre_tre-internal.h
Comment 8 Sean Bruno freebsd_committer freebsd_triage 2015-02-10 22:35:51 UTC
Going to run a mips32 and mips64 test just to see if it builds as is suspected.

Adding some of the powerpc guys to the list to see if they can test as well.

Probably, OPTIONS_DEFAULT_powerpc+= MISSING if there's no libquadmath on these arch's ?

Unable to test sparc64, but hopefully someone can test?
Comment 9 Sean Bruno freebsd_committer freebsd_triage 2015-02-12 15:39:34 UTC
oh, math/R depend tree requires a functional lang/gcc

This is not available on mips/mips64 at this time.
Comment 10 Justin Hibbits freebsd_committer freebsd_triage 2015-02-13 21:38:01 UTC
(In reply to Sean Bruno from comment #8)

This should also be done for powerpc and powerpc64.  I can open a new bug if you'd like.
Comment 11 Sean Bruno freebsd_committer freebsd_triage 2015-02-13 21:42:17 UTC
(In reply to Justin Hibbits from comment #10)
powerpc/powerpc64 done in r378945