Re: [sage-release] sage-5.6.beta2 released - MPIR's configure fails with clang and '-O0'

36 views
Skip to first unread message

leif

unread,
Jan 6, 2013, 12:23:14 AM1/6/13
to sage-r...@googlegroups.com, mpir-...@googlegroups.com
Ivan Andrus wrote:
> On Jan 5, 2013, at 8:03 PM, leif <not.r...@online.de> wrote:
>
>> Ivan Andrus wrote:
>>> Dear Sagephiles,
>>>
>>> Sorry to be so late to the party, but I tried building recently and noticed that building MPIR fails with SAGE_DEBUG=yes. This is before a new gcc has been installed. It compiled fine once I set SAGE_DEBUG to the empty string.
>>>
>>> I'm using OS X 10.8.2 with a Mid 2010 MacBook Pro. The build log is at
>>> http://boxen.math.washington.edu/home/iandrus/mpir-2.4.0.p6.log
>>
>> Could you also upload MPIR's corresponding config.log ($SAGE_ROOT/spkg/build/mpir-2.4.0.p6/src/config.log IIRC)? (That of a /failed/ build with Clang of course ;-) )
>
> http://boxen.math.washington.edu/home/iandrus/config.log


Thanks. Although the 'configure' test is supposed to detect something
completely different, it fails due to some bug in Clang (or at least an
incompatibility to GCC / GNU C).

Unless one specifies '-O2' or higher ('-finline*' doesn't work either),
the GNU __inline__ function doesn't get inlined, which is in principle
ok, but Clang doesn't emit code for it either, hence the linker error.
(FWIW, '-std=gnu*' doesn't seem to make any difference.)

We could tweak the test to use 'extern inline' (although I'm not sure
whether that would still trigger the bug the test is meant for), or change

#ifdef __GNUC__

to

#if defined(__GNUC__) && !defined(__clang__)

(The latter is IMHO more appropriate, regarding the intent of the test.)


MPIR versions > 2.4 come with the same test, and since I know Bill is
keen to fix any Apple toolchain issues (although in this case it's
rather just Clang), it's likely we could get that upstream MPIR (cc'ed).

(We're currently preparing to upgrade to 2.6.0 at #13137 [1]).




>> You may also try setting CC="clang -std=gnu99" or CC="clang -std=c99", but probably something's wrong with '-g' (i.e., the debug symbols; wouldn't be the first time with Apple's linker�)
>
> Something quite odd happened when I tried
>
> make CC="clang -std=gnu99"
>
> (and also with c99). I got the following output:
>
>
> cd spkg && \
> "../spkg/pipestatus" \
> "env SAGE_PARALLEL_SPKG_BUILD='' ./install all 2>&1" \
> "tee -a ../install.log"
> Installing GCC because you have clang -std=gnu99 version 4.2.1, which is quite old.
> make -j2 base
> make[2]: warning: -jN forced in submake: disabling jobserver mode.
> env SAGE_BUILD_TOOLCHAIN=yes make -j2 toolchain
> make[2]: warning: -jN forced in submake: disabling jobserver mode.
> /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/pipestatus "sage-spkg ${SAGE_SPKG_OPTS} mpir-2.4.0.p6 2>&1" "tee -a /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/logs/mpir-2.4.0.p6.log"
> make[2]: *** [installed/mpir-2.4.0.p6] Error 1
> make[1]: *** [all] Error 2
> *** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***
> �
> ***********************************************
> make -j2 base
> make[2]: warning: -jN forced in submake: disabling jobserver mode.
> make[2]: Nothing to be done for `base'.
> env SAGE_BUILD_TOOLCHAIN=yes make -j2 toolchain
> make[2]: warning: -jN forced in submake: disabling jobserver mode.
> /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/pipestatus "sage-spkg ${SAGE_SPKG_OPTS} mpir-2.4.0.p6 2>&1" "tee -a /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/logs/mpir-2.4.0.p6.log"
> �
> /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/pipestatus "sage-spkg ${SAGE_SPKG_OPTS} sagetex-2.3.3.p2 2>&1" "tee -a /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/logs/sagetex-2.3.3.p2.log"
>
> real 0m1.957s
> user 0m1.088s
> sys 0m1.265s
> Sage build/upgrade complete!
>
> To install small scripts to directly run Sage's versions of GAP,
> the PARI/GP interpreter, Maxima, or Singular etc. (by typing e.g.
> just 'gap' or 'gp') into a standard 'bin' directory, start Sage
> by typing 'sage' (or './sage') and enter something like
>
> install_scripts('/usr/local/bin')
>
> at the Sage command prompt ('sage:').
>
> If you issued 'make', 'make all', or a similar command, then the
> HTML version of the documentation will be built right now.
> Otherwise, if you want to (re)build the HTML documentation,
> run 'make doc'. To build the PDF version, run 'make doc-pdf'.
>
> ./sage -b
> /Users/gvol/SageStuff/sage-5.6.beta2-debug/spkg/bin/sage: line 651: sage-build: command not found
> make: *** [build] Error 127
>

No idea what's going on there, but that's certainly a Sage build system
issue, presumably rather unrelated to MPIR.


-leif


[1] http://trac.sagemath.org/sage_trac/ticket/13137

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

leif

unread,
Jan 6, 2013, 1:19:43 AM1/6/13
to mpir-...@googlegroups.com
I probably spoke to soon, as I also run into other issues now (i.e.,
other 'configure' tests that don't work) while trying to build MPIR
2.6.0 with Clang (some 3.1 svn version at the moment).

More to come...


-leif

leif

unread,
Jan 6, 2013, 11:14:32 AM1/6/13
to sage-r...@googlegroups.com, mpir-...@googlegroups.com
Jeroen Demeyer wrote:
> On 2013-01-06 06:23, leif wrote:
>> Unless one specifies '-O2' or higher ('-finline*' doesn't work either),
>> the GNU __inline__ function doesn't get inlined, which is in principle
>> ok, but Clang doesn't emit code for it either, hence the linker error.
>> (FWIW, '-std=gnu*' doesn't seem to make any difference.)
> If clang:
> * doesn't inline e(),
> * references the function e() as a function call,
> * but doesn't actually generates code for e(),
>
> I'd say that's a bug in clang.


Well, if you expect Clang to be "fully" compatible with GCC, then yes.
(Note that this only applies to GNU __inline__ functions, not C/C++
inline functions.)

Nevertheless, MPIR's failing 'configure' tests aren't meant for Clang
(and try to trigger other bugs, in particular of broken *GCC* versions),
and pretty easy to fix. [I've so far successfully built 32-bit and
64-bit versions of MPIR 2.6.0 with Clang 3.1 (incidentally also with a
mixture of 'clang' and 'g++'), with '-O0' as well as (implicitly) '-O2';
'make check' passed in each case. That's still on Linux though; I'll
try what happens on MacOS X later.]

I'm [currently] not intending to make Sage fully build with Clang, but
IMHO bootstrapping our GCC should work with Clang as well (including the
case when SAGE_DEBUG happens to be set to "yes"). (Not yet sure about
Apple's /old/ Clang 1.7. On MacOS X systems with that version, we can
probably rely on -- or, more precisely, require -- [at least] Apple's
GCC 4.0.1 or 4.2.1.)

I think if MPIR 2.6.0 gets into Sage within reasonable time, we don't
need to fix our 2.4.0 spkg, although doing so is trivial (just a matter
of time...).


-leif

leif

unread,
Jun 3, 2013, 7:07:23 AM6/3/13
to mpir-...@googlegroups.com
See http://groups.google.com/group/mpir-devel/msg/a4c6cecf4832c186

(patch which fixes all issues attached there)
Reply all
Reply to author
Forward
0 new messages