Opened 9 years ago

Closed 9 years ago

#14265 closed defect (fixed)

Compile Python with -D__C99FEATURES__ on Solaris

Reported by: jdemeyer Owned by: jdemeyer
Priority: blocker Milestone: sage-5.9
Component: packages: standard Keywords:
Cc: Merged in: sage-5.9.beta3
Authors: Jeroen Demeyer Reviewers: François Bissey
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The new doctesting framework (#12415) on Solaris gives lots of warnings like

sage -t --long devel/sage/sage/plot/plot.py
**********************************************************************
File "devel/sage/sage/plot/plot.py", line 236, in sage.plot.plot
Failed example:
    (g1+g2).show(ticks=pi/6, tick_formatter=pi)  # show their sum, nicely formatted
Expected nothing
Got:
    Warning: invalid value encountered in isinf
    Warning: invalid value encountered in isinf
    Warning: invalid value encountered in isinf
    [...]
    Warning: invalid value encountered in isinf
    Warning: invalid value encountered in isinf
    Warning: invalid value encountered in isinf

These warnings are actually harmless and are indirectly caused by the fact that Python doesn't find the isinf() C library function. From spkg/logs/python-2.7.3.p5.log:

[...]
checking whether isinf is declared... no
checking whether isnan is declared... yes
checking whether isfinite is declared... no
[...]

These functions are defined by C99 and Python's configure does find isinf and isfinite when compiled with -DC99FEATURES. So we should add a compiler flag to fix this.

spkg: http://boxen.math.washington.edu/home/jdemeyer/spkg/python-2.7.3.p6.spkg

To test: build this spkg, rebuild numpy (optionally: rebuild everything which depends on Python, including the Sage library).

python-2.7.3.p6 (Jeroen Demeyer, 24 March 2013)

  • Trac #14265: Compile with -DC99FEATURES on Solaris.
  • Remove workaround for http://bugs.python.org/issue6954 (which is fixed upstream).
  • Rename environment variable EXTRAFLAGS to PYTHON_CONFIGURE for consistency with other packages and allow it to be set by the user.
  • Add check that the ctypes and readline (required for IPython) and socket (required for setuptools) modules can be imported.
  • Don't add the -fwrapv flag (no longer needed since Python-2.7.3 adds this flag for Clang).

Attachments (1)

python-2.7.3.p6.diff (4.4 KB) - added by jdemeyer 9 years ago.
Diff for the Python spkg, for review only

Download all attachments as: .zip

Change History (54)

comment:1 Changed 9 years ago by jdemeyer

  • Status changed from new to needs_review

comment:2 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:3 follow-ups: Changed 9 years ago by leif

Note that this also affects any Python extension module built with distutils, as the latter (by default) use the flags Python was built with. (This also applies to C++ files btw. ...)

So for testing, one should at least rebuild the whole Sage library as well (e.g. with ./sage -ba-force).


Solaris is the only OS I'm aware of (and Sage supports) where GCC does not default to gnu99 (for C input files).

comment:4 in reply to: ↑ 3 ; follow-up: Changed 9 years ago by jdemeyer

Replying to leif:

Solaris is the only OS I'm aware of (and Sage supports) where GCC does not default to gnu99 (for C input files).

I think GCC never defaults to gnu99/c99. It must be that glibc always declares isinf(), even in C89 mode.

comment:5 in reply to: ↑ 4 Changed 9 years ago by leif

Replying to jdemeyer:

Replying to leif:

Solaris is the only OS I'm aware of (and Sage supports) where GCC does not default to gnu99 (for C input files).

I think GCC never defaults to gnu99/c99. It must be that glibc always declares isinf(), even in C89 mode.

Confused that with __STDC__, which GCC defines on anything but Solaris by default.

GLIBC's math.h only defines isinf() etc. if __USE_ISOC99 is defined, but that's apparently "frequently" the case (see features.h.)

comment:6 follow-up: Changed 9 years ago by jdemeyer

On sage.math at least, isinf() is declared in gnu89 mode, but not in c89 mode (which is a sensible choice).

comment:7 in reply to: ↑ 6 Changed 9 years ago by leif

Replying to jdemeyer:

On sage.math at least, isinf() is declared in gnu89 mode, but not in c89 mode (which is a sensible choice).

Same on 10.04.4.

comment:8 in reply to: ↑ 3 Changed 9 years ago by jdemeyer

Replying to leif:

Note that this also affects any Python extension module built with distutils, as the latter (by default) use the flags Python was built with. (This also applies to C++ files btw. ...)

True, it applies to C++ also, but this doesn't seem to cause problems:

gcc -fno-strict-aliasing -std=gnu99 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/release/merger/sage-5.9.beta0/local/include -I/release/merger/sage-5.9.beta0/local/include/csage -I/release/merger/sage-5.9.beta0/devel/sage/sage/ext -I/release/merger/sage-5.9.beta0/local/include/python2.7 -c sage/rings/number_field/number_field_element.cpp -o build/temp.linux-x86_64-2.7/sage/rings/number_field/number_field_element.o -w
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -shared -L/release/merger/sage-5.9.beta0/local/lib build/temp.linux-x86_64-2.7/sage/rings/number_field/number_field_element.o -L/release/merger/sage-5.9.beta0/local/lib -L/release/merger/sage-5.9.beta0/local/lib -lcsage -lntl -lgmp -lstdc++ -lntl -lpython2.7 -o build/lib.linux-x86_64-2.7/sage/rings/number_field/number_field_element.so

comment:9 Changed 9 years ago by leif

$ gcc-4.6.3 -std=gnu99 -c -x c++ /dev/null -o /dev/null
cc1plus: warning: command line option ‘-std=gnu99’ is valid for C/ObjC but not for C++ [enabled by default]

:-)

comment:10 follow-up: Changed 9 years ago by jdemeyer

More weirdness:

jdemeyer@sage:~$ gcc -std=gnu99 -Wstrict-prototypes -c -x c++ /dev/null -o /dev/null
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-std=gnu99' is valid for C/ObjC but not for C++ [enabled by default]
jdemeyer@sage:~$ gcc -std=gnu99 -Wstrict-prototypes -c -x c++ /dev/null -o /dev/null -w
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]

Anyway, it's a strange thing that Python uses CC and CFLAGS to compile C++ code.

comment:11 in reply to: ↑ 10 ; follow-up: Changed 9 years ago by leif

Replying to jdemeyer:

More weirdness:

jdemeyer@sage:~$ gcc -std=gnu99 -Wstrict-prototypes -c -x c++ /dev/null -o /dev/null
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-std=gnu99' is valid for C/ObjC but not for C++ [enabled by default]
jdemeyer@sage:~$ gcc -std=gnu99 -Wstrict-prototypes -c -x c++ /dev/null -o /dev/null -w
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]

Anyway, it's a strange thing that Python uses CC and CFLAGS to compile C++ code.

Yeah, I'll one day fix these (by removing the invalid options if lang=="c++") ...

Last edited 9 years ago by leif (previous) (diff)

comment:12 in reply to: ↑ 11 Changed 9 years ago by jdemeyer

Replying to leif:

Yeah, I'll one day fix these (by removing the invalid options if lang=="c++") ...

It's a distutils problem, not a Sage problem: http://bugs.python.org/issue1222585

comment:13 follow-up: Changed 9 years ago by jdemeyer

  • Description modified (diff)

Given that:

  1. this has been tested on the buildbot with no issues,
  2. it fixes an issue on Solaris,
  3. the fact that Distutils compiles C++ files as C files is not easily solved,

I think this ticket is still ready for review.

I added a patch to remove the c99 options which are currently in module_list.py.

comment:14 in reply to: ↑ 13 ; follow-ups: Changed 9 years ago by leif

Replying to jdemeyer:

I added a patch to remove the c99 options which are currently in module_list.py.

I also thought about doing so, but I think we shouldn't, as you can still override Python's CFLAGS, and it's good to have documented which modules actually (seem to) require C99...

comment:15 in reply to: ↑ 14 Changed 9 years ago by leif

Replying to leif:

Replying to jdemeyer:

I added a patch to remove the c99 options which are currently in module_list.py.

I also thought about doing so, but I think we shouldn't, as you can still override Python's CFLAGS, and it's good to have documented which modules actually (seem to) require C99...

To be more precise (tried a few hours ago, but forgot): the -std=gnu99 only appears in my Sage library build logs if I unset CFLAGS. (For "safety", I actually also unset CPPFLAGS and CXXFLAGS, FWIW).

comment:16 Changed 9 years ago by leif

P.S.: Unsetting CFLAGS is sufficient to get all of Python's.

comment:17 in reply to: ↑ 14 ; follow-up: Changed 9 years ago by jdemeyer

Replying to leif:

as you can still override Python's CFLAGS

Not really, Python's spkg-install would always add the C99 flag.

it's good to have documented which modules actually (seem to) require C99...

Why, what's the added value? Removing all those extra C99 flags simplifies module_list.py and I'm always in favour of simplification.

comment:18 Changed 9 years ago by jdemeyer

  • Description modified (diff)

OK, removing the C99 flags can be moved to a new ticket: #14268

comment:19 in reply to: ↑ 17 Changed 9 years ago by leif

Replying to jdemeyer:

Replying to leif:

as you can still override Python's CFLAGS

Not really, Python's spkg-install would always add the C99 flag.

You probably misunderstood me.

Do env CFLAGS="-DFOO" ./sage -ba and the -std=gnu99 vanishes, so we must not remove -std=c99 from the extra_compile_flags (or what it's called).

As an alternative (I see no reason for), unconditionally (except for C++ sources perhaps) explicitly add -std=gnu99 in setup.py.

comment:20 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:21 Changed 9 years ago by leif

Building Sage 5.8.rc0 from scratch with this spkg on mark (Solaris 5.10, GCC 4.7.0, CFLAGS et al. not set), I get a lot of (additional, I think) warnings, and at least SageNB and the Sage library fail to build:

...
Building modified file sage/ext/interpreters/wrapper_el.pyx.
Executing 341 commands (using 1 thread)
Traceback (most recent call last):
  File "setup.py", line 835, in <module>
    execute_list_of_commands(queue)
  File "setup.py", line 278, in execute_list_of_commands
    execute_list_of_commands_in_parallel(command_list, nthreads)
  File "setup.py", line 226, in execute_list_of_commands_in_parallel
    from multiprocessing import Pool
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python/multiprocessing/__init__.py", line 84, in <module>
    import _multiprocessing
ImportError: No module named _multiprocessing
Error installing modified sage library code.
ERROR installing Sage

(Haven't investigated the Python build log yet.)

SageNB:

...
Processing zope.interface-4.0.3.tar.gz
Running zope.interface-4.0.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-TRxDqq/zope.interface-4.0.3/egg-dist-tmp-5XxIwA
In file included from /usr/include/limits.h:18:0,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/limits.h:169,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/syslimits.h:7,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/limits.h:34,
                 from /home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/include/python2.7/Python.h:19,
                 from src/zope/interface/_zope_interface_coptimizations.c:15:
/usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/sys/feature_tests.h
:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
********************************************************************************
WARNING:

        An optional code optimization (C extension) could not be compiled.

        Optimizations for this package will not be available!
()
command 'gcc' failed with exit status 1
********************************************************************************
Adding zope.interface 4.0.3 to easy-install.pth file
...
Running Twisted-12.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-lSWXxx/Twisted-12.3.0/egg-dist-tmp-mH8uhP
In file included from /usr/include/sys/types.h:18:0,
                 from /usr/include/rpc/types.h:16,
                 from /usr/include/rpc/rpc.h:19,
                 from conftest.c:1:
/usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/sys/feature_tests.h
:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
In file included from /usr/include/rpc/rpcb_clnt.h:31:0,
                 from /usr/include/rpc/rpc.h:46,
                 from conftest.c:1:
/usr/include/rpc/rpcb_prot.h:162:3: error: unknown type name 'u_int'
/usr/include/rpc/rpcb_prot.h:198:3: error: unknown type name 'u_int'
/usr/include/rpc/rpcb_prot.h:226:2: error: unknown type name 'u_int'
/usr/include/rpc/rpcb_prot.h:479:1: error: unknown type name 'u_int'
/usr/include/rpc/rpcb_prot.h:492:1: error: unknown type name 'u_int'
conftest.c:1:23: fatal error: sys/epoll.h: No such file or directory
compilation terminated.
In file included from /usr/include/limits.h:18:0,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/limits.h:169,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/syslimits.h:7,
                 from /usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/limits.h:34,
                 from /home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/include/python2.7/Python.h:19,
                 from twisted/test/raiser.c:4:
/usr/local/gcc-4.7.0/sparc-SunOS-ultrasparc3/lib/gcc/sparc-sun-solaris2.10/4.7.0/include-fixed/sys/feature_tests.h
:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
error: Setup script exited with error: command 'gcc' failed with exit status 1
Error installing Twisted-12.3.0.tar.bz2 !

real    0m28.292s
user    0m8.691s
sys     0m2.294s
************************************************************************
Error installing package sagenb-0.10.4
************************************************************************

Countless warnings like

.../sage-5.8.rc0-gcc-4.7.0/local/include/python2.7/pyconfig.h:1136:0: warning: "_FILE_OFFSET_BITS" redefined [enabled by default]

comment:22 Changed 9 years ago by leif

P.S.: Nearly one year ago, I managed to successfully build Sage 5.0.beta13 (presumably with a couple of fixed spkgs) with GCC 4.7.0 on mark2.

comment:23 follow-up: Changed 9 years ago by jdemeyer

I have updated my spkg at some point, did you try the most recent version?

comment:24 in reply to: ↑ 23 ; follow-up: Changed 9 years ago by leif

Replying to jdemeyer:

I have updated my spkg at some point, did you try the most recent version?

Most recent is a moving target... I took the one dated March 13th 14:19 UTC. (I didn't see any relevant changes in the changelog or the comments, so didn't bother to grab a new one later. Now I see -std=gnu99 meanwhile gets appended to CFLAGS, and IIRC adding -D_XPG6 on Solaris is also new; any other relevant changes?)

comment:25 Changed 9 years ago by leif

I've now installed your updated Python spkg and make'd the rest (without setting SAGE_UPGRADING) on mark.

Documentation built, ptestlong in progress.

Last edited 9 years ago by leif (previous) (diff)

comment:26 follow-ups: Changed 9 years ago by leif

I get a couple of doctest "errors" of the form (still on mark):

Expected:
    foo
Got:
    WARNING: IPython GUI event loop requires ctypes, %gui will not be available
    foo

:-)

comment:27 in reply to: ↑ 26 ; follow-up: Changed 9 years ago by jdemeyer

Replying to leif:

I get a couple of doctest "errors" of the form (still on mark):

Expected:
    foo
Got:
    WARNING: IPython GUI event loop requires ctypes, %gui will not be available
    foo

And where do you get these errors, it would help if you mention the exact test.

comment:28 in reply to: ↑ 24 Changed 9 years ago by jdemeyer

  • Owner changed from tbd to jdemeyer

Replying to leif:

I see -std=gnu99 meanwhile gets appended to CFLAGS

That was a mistake, it should be prepended, fixed now.

adding -D_XPG6 on Solaris is also new

Indeed, it is required at least for OpenSolaris (hawk).

any other relevant changes?

Removing -fwrapv since Python's configure now adds it for compilers named *clang*.

comment:29 in reply to: ↑ 27 Changed 9 years ago by leif

Replying to jdemeyer:

Replying to leif:

I get a couple of doctest "errors" of the form (still on mark):

Expected:
    foo
Got:
    WARNING: IPython GUI event loop requires ctypes, %gui will not be available
    foo

And where do you get these errors, it would help if you mention the exact test.

Haven't investigated further yet (will rebuild parts and rerun ptestlong later), but I thinkTM most of the following failures are of that kind:

	sage -t  --long -force_lib devel/sage/sage/crypto/mq/sr.py # 1 doctests failed
	sage -t  --long -force_lib devel/sage/sage/libs/ppl.pyx # 8 doctests failed
	sage -t  --long -force_lib devel/sage/sage/matrix/matrix_modn_dense.pyx # 5 doctests failed
	sage -t  --long -force_lib devel/sage/sage/matrix/matrix_modn_dense_template.pxi # 5 doctests failed
	sage -t  --long -force_lib devel/sage/sage/misc/interpreter.py # 1 doctests failed
	sage -t  --long -force_lib devel/sage/sage/misc/temporary_file.py # 1 doctests failed
	sage -t  --long -force_lib devel/sage/sage/parallel/decorate.py # 2 doctests failed
	sage -t  --long -force_lib devel/sage/sage/tests/cmdline.py # 9 doctests failed

More details later; here's the "preliminary" log.

comment:30 Changed 9 years ago by leif

sage/parallel/decorate.py passed now (tested separately; no rebuilds yet).

All failures in sage/libs/ppl.pyx are (apparently reproducibly) Expected: foo Got: WARNING: ... foo. Same for sage/misc/interpreter.py; similar for sage/misc/temporary_file.py and sage/tests/cmdline.py.

Why t** f*** is IPython involved at all?

When testing sage/crypto/mq/sr.py, I also get the warning at the beginning (but not in Got:), then a RuntimeError: Bus Error. Same for sage/matrix/matrix_modn_dense{.pyx,_template.pxi}, plus some errors due to the previous bus error(s) I think.

comment:31 follow-up: Changed 9 years ago by leif

Just found

.../spkg/build/python-2.7.3.p6/src/Modules/_ctypes/libffi/src/sparc/v9.o: file not recognized: Bad value
collect2: error: ld returned 1 exit status

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _ssl               _tkinter        
bsddb185           gdbm               linuxaudiodev   
ossaudiodev                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_ctypes            _curses            _curses_panel   

when (re)building the updated Python spkg. So apparently _ctypes cannot be built because some objects are built 64-bit.

comment:32 follow-up: Changed 9 years ago by jdemeyer

I added a check in the spkg that ctypes can be imported, but I cannot reproduce your problem.

comment:33 in reply to: ↑ 32 ; follow-up: Changed 9 years ago by leif

Replying to jdemeyer:

I added a check in the spkg that ctypes can be imported, but I cannot reproduce your problem.

Well, it previously worked without _ctypes, so why require it now? Just for %gui?

Something with IPython (or doctesting) is broken, so that should (also) get fixed. (I don't think the spkg here is causing it.)

comment:34 in reply to: ↑ 31 Changed 9 years ago by leif

Replying to leif:

.../src/Modules/_ctypes/libffi/src/sparc/v9.o: file not recognized: Bad value
collect2: error: ld returned 1 exit status
...
Failed to build these modules:
_ctypes            _curses            _curses_panel   

This goes back to Sage 5.2 and 5.0, with GCC 4.7.0, but apparently never caused a problem.

comment:35 follow-up: Changed 9 years ago by leif

With yesterday's spkg, it gets even weirder now:

WARNING: IPython GUI event loop requires ctypes, %gui will not be available
Traceback (most recent call last):
  File "./spkg-install", line 4, in <module>
    from sage.all import save
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/all.py", line 70, in <module>
    from sage.matrix.all     import *
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/matrix/all.py", line 1, in <module>
    from matrix_space import MatrixSpace, is_MatrixSpace
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/matrix/matrix_space.py", line 37, in <module>
    import matrix_modn_dense
  File "matrix_modn_dense_template_header.pxi", line 11, in init sage.matrix.matrix_modn_dense (sage/matrix/matrix_modn_dense.c:13934)
  File "matrix_integer_dense.pxd", line 12, in init sage.matrix.matrix_modn_dense_float (sage/matrix/matrix_modn_dense_float.cpp:16937)
  File "linbox.pxd", line 7, in init sage.matrix.matrix_integer_dense (sage/matrix/matrix_integer_dense.c:43265)
ImportError: ld.so.1: python2.7: fatal: relocation error: file /home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/liblinboxsage.so.0: symbol _ZN6LinBox17NotImplementedYet12_errorStreamE: referenced symbol not found

real    0m16.342s
user    0m3.614s
sys     0m1.785s
************************************************************************
Error installing package conway_polynomials-0.4.p0
************************************************************************

comment:36 in reply to: ↑ 33 ; follow-up: Changed 9 years ago by jdemeyer

Replying to leif:

Something with IPython (or doctesting) is broken

If the new IPython requires ctypes, then we should check for it.

I feel like we're wandering away too much away from the essence of this ticket, which is ensuring that Python compiles the isinf() function. The fact that it doesn't work with GCC-4.7.0 doesn't matter for now.

comment:37 in reply to: ↑ 36 ; follow-up: Changed 9 years ago by leif

Replying to jdemeyer:

Replying to leif:

Something with IPython (or doctesting) is broken

If the new IPython requires ctypes, then we should check for it.

Well it doesn't, otherwise it wouldn't build, or issue an error message instead of just a warning.

And as said, previous versions did build and work with GCC 4.7.0, so there's a regression.

comment:38 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:39 in reply to: ↑ 37 ; follow-up: Changed 9 years ago by jdemeyer

Replying to leif:

And as said, previous versions did build and work with GCC 4.7.0, so there's a regression.

Do you mean GCC-4.7.0 with GNU ld which is installed system-wide on mark or do you mean a custom-built GCC-4.7.0 with Sun ld? Because building Sage on mark with GNU ld never worked for me (at least libpng doesn't build).

I'm going to try building Sage on mark with GCC-4.7.2 (the optional spkg) + Sun ld. If that works with this spkg, I think there is no reason to hold up this ticket.

Last edited 9 years ago by jdemeyer (previous) (diff)

comment:40 in reply to: ↑ 39 ; follow-up: Changed 9 years ago by leif

Replying to jdemeyer:

Replying to leif:

And as said, previous versions did build and work with GCC 4.7.0, so there's a regression.

Do you mean GCC-4.7.0 with GNU ld which is installed system-wide on mark or do you mean a custom-built GCC-4.7.0 with Sun ld? Because building Sage on mark with GNU ld never worked for me (at least libpng doesn't build).

The system-wide GCC 4.7.0 (which is configured to use GNU ld).

Unfortunately, with the default setup on the skynet machines (/usr/local/skynet_bash_profile), the Sun linker comes first in PATH, so some packages get confused, assuming the wrong linker.

E.g. to build libpng, you have to

export LD=/usr/local/binutils-2.22/sparc-SunOS-ultrasparc3-gcc-4.6.2-without-zlib/bin/ld


I'm going to try building Sage on mark with GCC-4.7.2 (the optional spkg) + Sun ld. If that works with this spkg, I think there is no reason to hold up this ticket.

Yes. I was going to try that as well. (I'll open a ticket for building Singular with GCC 4.7.x on Solaris soon; only needs a trivial patch to kernel/bigintmat.cc.)

The odd IPython warnings (and/or making Python properly build _ctypes on Solaris SPARC) should be fixed on another ticket.

Hopefully Sage 5.9.beta* gets out soon... ;-)

comment:41 in reply to: ↑ 40 Changed 9 years ago by leif

Replying to leif:

(I'll open a ticket for building Singular with GCC 4.7.x on Solaris soon; only needs a trivial patch to kernel/bigintmat.cc.)

P.S.: A patched version of bigintmat.cc is here.

comment:42 Changed 9 years ago by jdemeyer

See #14296 for $LD troubles.

comment:43 in reply to: ↑ 35 Changed 9 years ago by leif

Replying to leif:

With yesterday's spkg, it gets even weirder now:

WARNING: IPython GUI event loop requires ctypes, %gui will not be available
Traceback (most recent call last):
  File "./spkg-install", line 4, in <module>
    from sage.all import save
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/all.py", line 70, in <module>
    from sage.matrix.all     import *
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/matrix/all.py", line 1, in <module>
    from matrix_space import MatrixSpace, is_MatrixSpace
  File "/home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/python2.7/site-packages/sage/matrix/matrix_space.py", line 37, in <module>
    import matrix_modn_dense
  File "matrix_modn_dense_template_header.pxi", line 11, in init sage.matrix.matrix_modn_dense (sage/matrix/matrix_modn_dense.c:13934)
  File "matrix_integer_dense.pxd", line 12, in init sage.matrix.matrix_modn_dense_float (sage/matrix/matrix_modn_dense_float.cpp:16937)
  File "linbox.pxd", line 7, in init sage.matrix.matrix_integer_dense (sage/matrix/matrix_integer_dense.c:43265)
ImportError: ld.so.1: python2.7: fatal: relocation error: file /home/leif/Sage/release/build/mark/sage-5.8.rc0-gcc-4.7.0/local/lib/liblinboxsage.so.0: symbol _ZN6LinBox17NotImplementedYet12_errorStreamE: referenced symbol not found

real    0m16.342s
user    0m3.614s
sys     0m1.785s
************************************************************************
Error installing package conway_polynomials-0.4.p0
************************************************************************

I've now successfully built vanilla Sage 5.8.rc0 (plus the fix for Singular, cf. #14295) on mark2 (with CFLAGS et al. set, FWIW), and while I still get the IPython warnings, Sage at least starts up without errors.

Currently building the docs to afterwards run ptestlong.

comment:44 follow-up: Changed 9 years ago by jdemeyer

It seems that OpenSolaris is much more strict about C99. In particular, there doesn't seem to be a clean way to compile both C and C++ with the same compiler options.

So perhaps we should try compiling C89 but with -D__C99FEATURES__ which enables a few things from C99 such as isinf().

comment:45 in reply to: ↑ 44 Changed 9 years ago by leif

Replying to jdemeyer:

So perhaps we should try compiling C89 but with -D__C99FEATURES__ which enables a few things from C99 such as isinf().

Seems much better. -D_XPG6 is a hack anyway, as both _XOPEN_SOURCE=600 and _POSIX_C_SOURCE=200112L` require C99.

Or define your own macros #ifndef... ;-)

comment:46 Changed 9 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from Compile Python as C99 to Compile Python with -D__C99FEATURES__ on Solaris

comment:47 in reply to: ↑ 26 Changed 9 years ago by leif

Replying to leif:

I get a couple of doctest "errors" of the form (still on mark):

Expected:
    foo
Got:
    WARNING: IPython GUI event loop requires ctypes, %gui will not be available
    foo

This is now #14309.

comment:48 Changed 9 years ago by jdemeyer

This spkg has been completely buildbot-tested and works fine. Needs review...

Changed 9 years ago by jdemeyer

Diff for the Python spkg, for review only

comment:49 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:50 follow-up: Changed 9 years ago by fbissey

OK I bite. I note from the diff that on OS X you prepend --disable-toolbox-glue rather than appending it to PYTHON_CONFIGURE. Does it mean that it is safe for user to override this option? If it is safe why is it disabled by default?

comment:51 in reply to: ↑ 50 Changed 9 years ago by jdemeyer

Replying to fbissey:

I note from the diff that on OS X you prepend --disable-toolbox-glue rather than appending it to PYTHON_CONFIGURE. Does it mean that it is safe for user to override this option?

No.

It's all about giving the user at least the possibility to override this option. In general, we should never force things on the user, it the user wants to do stupid things, he should be able to.

comment:52 Changed 9 years ago by fbissey

  • Status changed from needs_review to positive_review

I am ok with that line of reasonning. It was different from the original handling. spkg looks ok to me and only touch solaris which has been tested positive that.

comment:53 Changed 9 years ago by jdemeyer

  • Merged in set to sage-5.9.beta3
  • Resolution set to fixed
  • Reviewers set to François Bissey
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.