sagemath/sage

spkg-configure.m4 for pcre

Closed this issue · 19 comments

its only dependency is bzip2, so this should be a breeze - and it's one of deps of R.

CC: @embray @kiwifb @mkoeppe

Component: build: configure

Author: Dima Pasechnik

Branch: 285de31

Reviewer: François Bissey

Issue created by migration from https://trac.sagemath.org/ticket/27284

comment:1

Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)

Author: Dima Pasechnik

Commit: 285de31

New commits:

285de31spkg-config for pcre

Reviewer: François Bissey

comment:3

LGTM

comment:4

Thanks!

comment:6

I just installed pcre on my Mac with ./configure; make; make install, and I get a doctest failure with stats/r.py. If I instead emulate the installation of the Sage pcre package and use ./configure --enable-utf --enable-unicode-properties --enable-jit followed by make; make install, everything works. Should the .m4 file test for the appropriate feature of the system's pcre rather than just the presence of the library?

The doctest failure:

sage -t src/sage/stats/r.py
**********************************************************************
File "src/sage/stats/r.py", line 42, in sage.stats.r.ttest
Failed example:
    a, b = ttest([1,2,3,4,5],[1,2,3,3.5,5.121]); a # abs tol 1e-12
Exception raised:
    Traceback (most recent call last):
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1105, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.stats.r.ttest[0]>", line 1, in <module>
        a, b = ttest([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5)],[Integer(1),Integer(2),Integer(3),RealNumber('3.5'),RealNumber('5.121')]); a # abs tol 1e-12
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/stats/r.py", line 48, in ttest
        test = myR.t_test(x,y,conf_level = conf_level, **kw)._sage_()
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 1985, in __call__
        return self._parent.function_call(self._name, args=list(args), kwds=kwds)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 1062, in function_call
        [self._sage_to_r_name(key)+'='+kwds[key].name() for key in kwds ] )))
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 353, in new
        return self(code)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 288, in __call__
        return cls(self, x, name=name)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 701, in __init__
        self._name = parent._create(value, name=name)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 484, in _create
        self.set(name, value)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 1108, in set
        out = self.eval(cmd)
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/sage/interfaces/r.py", line 1321, in eval
        return str(robjects.r(code)).rstrip()
      File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/TESTING/sage-8.8.beta7/local/lib/python2.7/site-packages/rpy2/robjects/robject.py", line 108, in __str__
        self.__show(self)
    RRuntimeError: Error in strsplit(x, "\n[ \t\n]*\n", perl = TRUE) : 
      invalid split pattern '
    [ 	
    ]*
    '

**********************************************************************
1 item had failures:
   1 of   2 in sage.stats.r.ttest
    [2 tests, 1 failure, 0.50 s]

Changed commit from 285de31 to none

comment:7

It looks like ./configure --enable-utf is good enough, but not plain ./configure.

comment:8

Do you mean to say that in 2019 the newest MacOS ships a library without UTF support? Indeed, it seems they do, according to https://opensource.apple.com/source/pcre/pcre-9/Makefile.auto.html

(There is no pcre in Xcode on my OSX 10.13 for some reason)

Thanks Apple, you are the torch of progress... :-)

Well yes, sure, we can add a test for this.

Care to submit a bug report to Apple, as it's really silly of them...

comment:9

what is confusing to me that there is no UTF in the pattern it errors on.
Perhaps it's the string that's encoded in UTF that is passed to it...

comment:10

a typical installation of pcre(2) comes with pcretest and/or pcre2test. Does MacOS have them?

If so, what's the output of pcretest -C and pcre2test -C ?

Also, what is the output of pkg-config --modversion libpcre ? (if any)

comment:11

Replying to @dimpase:

Do you mean to say that in 2019 the newest MacOS ships a library without UTF support?

No, I mean to say that I downloaded a tarball for pcre and ran ./configure; make; make install, expecting that the default settings for ./configure would be sensible, but instead they lead to the doctest failure I mentioned.

Indeed, it seems they do, according to https://opensource.apple.com/source/pcre/pcre-9/Makefile.auto.html

I wasn't using this.

(There is no pcre in Xcode on my OSX 10.13 for some reason)

Thanks Apple, you are the torch of progress... :-)

Well yes, sure, we can add a test for this.

Care to submit a bug report to Apple, as it's really silly of them...

comment:12

Ah, I see. It installed, in /usr/local, I gather? Does it install pcre(2)test too by default?

Cause I don't want to write C code to test for UTF, you know :-)

comment:13

I've opened #27936 to provide these extra tests.

comment:14

Replying to @dimpase:

Ah, I see. It installed, in /usr/local, I gather? Does it install pcre(2)test too by default?

Yes, in /usr/local. It installs pcretest by default.

Cause I don't want to write C code to test for UTF, you know :-)