Compilation failure of pari (ARM, gcc 4.6.2)

67 views
Skip to first unread message

Julien Puydt

unread,
Feb 4, 2012, 3:37:56 AM2/4/12
to sage-...@googlegroups.com
Hi,

I upgraded my AC100 to (a snapshot of the forthcoming) ubuntu precise,
thinking it woud perhaps raise new issues, and that would be interesting
to detect them beforehand.

And indeed, pari doesn't compile!

One of the files gives an assembler file which doesn't compile, but the
problem is optimization-dependent :

(sage subshell) hecke:Olinux-armv7l jpuydt$ make
gcc -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -g
-funroll-loops -fPIC -I. -I../src/headers
-I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
/tmp/ccgVJ73D.s: Assembler messages:
/tmp/ccgVJ73D.s:376: Error: branch out of range
/tmp/ccgVJ73D.s:5127: Error: branch out of range
make: *** [mp.o] Erreur 1
SAGE_ROOT=/home/jpuydt/sage-4.8
(sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O2 -Wall
-fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
-I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
/tmp/ccMfUGHc.s: Assembler messages:
/tmp/ccMfUGHc.s:376: Error: branch out of range
/tmp/ccMfUGHc.s:5120: Error: branch out of range
SAGE_ROOT=/home/jpuydt/sage-4.8
(sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O -Wall
-fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
-I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
SAGE_ROOT=/home/jpuydt/sage-4.8

The gcc version is Ubuntu/Linaro 4.6.2-12ubuntu1.

I'll try to investigate where the problem is (pari? gcc? other?), but I
thought sharing early would raise good suggestions.

Snark on #sagemath

Paulo César Pereira de Andrade

unread,
Feb 4, 2012, 4:18:32 AM2/4/12
to sage-...@googlegroups.com
2012/2/4 Julien Puydt <julien...@laposte.net>:

> Hi,
>
> I upgraded my AC100 to (a snapshot of the forthcoming) ubuntu precise,
> thinking it woud perhaps raise new issues, and that would be interesting to
> detect them beforehand.
>
> And indeed, pari doesn't compile!
>
> One of the files gives an assembler file which doesn't compile, but the
> problem is optimization-dependent :
>
> (sage subshell) hecke:Olinux-armv7l jpuydt$ make
> gcc  -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer  -g
> -funroll-loops -fPIC -I. -I../src/headers
> -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c

Try running something like:

gcc -c -S -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -g
-funroll-loops -fPIC -I. -I../src/headers
-I/home/jpuydt/sage-4.8/local/include -o mp.s mp.c

and then look at the assembler generated in mp.s

you can also s/-S/-E/; s/mp.s/mp.e/ or variant to reduce to, and
create a self contained small test case and report upstream.

If you want it "working now", you can try removing -funroll-loops

> /tmp/ccgVJ73D.s: Assembler messages:
> /tmp/ccgVJ73D.s:376: Error: branch out of range
> /tmp/ccgVJ73D.s:5127: Error: branch out of range
> make: *** [mp.o] Erreur 1
> SAGE_ROOT=/home/jpuydt/sage-4.8
> (sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O2 -Wall
> -fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
> -I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
> /tmp/ccMfUGHc.s: Assembler messages:
> /tmp/ccMfUGHc.s:376: Error: branch out of range
> /tmp/ccMfUGHc.s:5120: Error: branch out of range
> SAGE_ROOT=/home/jpuydt/sage-4.8
> (sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O -Wall
> -fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
> -I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
> SAGE_ROOT=/home/jpuydt/sage-4.8
>
> The gcc version is Ubuntu/Linaro 4.6.2-12ubuntu1.
>
> I'll try to investigate where the problem is (pari? gcc? other?), but I
> thought sharing early would raise good suggestions.

Hard to tell without looking at what is being generated, but I
suspect something related to -mimplict-it=??? assembler option
with the assembler generating extra code, and branch encoding
for short jumps (8 or 11 bits). You can add -marm to CFLAGS
and then it can only generate 24 bit displacement jumps...

> Snark on #sagemath

Paulo

Julien Puydt

unread,
Feb 4, 2012, 8:37:25 AM2/4/12
to sage-...@googlegroups.com
Le 04/02/2012 09:37, Julien Puydt a �crit :

> And indeed, pari doesn't compile!

After I compile mp.c with only the -O switch, pari and the rest of sage
compiled correctly.

Snark on #sagemath

Julien Puydt

unread,
Feb 4, 2012, 2:52:51 PM2/4/12
to sage-...@googlegroups.com
Le 04/02/2012 10:18, Paulo C�sar Pereira de Andrade a �crit :
> 2012/2/4 Julien Puydt<julien...@laposte.net>:

>> (sage subshell) hecke:Olinux-armv7l jpuydt$ make
>> gcc -c -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -g
>> -funroll-loops -fPIC -I. -I../src/headers
>> -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
>
> Try running something like:
>
> gcc -c -S -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -g
> -funroll-loops -fPIC -I. -I../src/headers
> -I/home/jpuydt/sage-4.8/local/include -o mp.s mp.c
>
> and then look at the assembler generated in mp.s
>
> you can also s/-S/-E/; s/mp.s/mp.e/ or variant to reduce to, and
> create a self contained small test case and report upstream.

Hmmm... I'll send the mp.e as a mp.c ; it doesn't compile with both
-funroll-loops and -O3, so I guess it's a valid test case. Not really
small (19147 lines), but I guess that will do.

> If you want it "working now", you can try removing -funroll-loops

I used the -O option instead of -O3 ;-)

>> /tmp/ccgVJ73D.s: Assembler messages:
>> /tmp/ccgVJ73D.s:376: Error: branch out of range
>> /tmp/ccgVJ73D.s:5127: Error: branch out of range
>> make: *** [mp.o] Erreur 1
>> SAGE_ROOT=/home/jpuydt/sage-4.8
>> (sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O2 -Wall
>> -fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
>> -I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
>> /tmp/ccMfUGHc.s: Assembler messages:
>> /tmp/ccMfUGHc.s:376: Error: branch out of range
>> /tmp/ccMfUGHc.s:5120: Error: branch out of range
>> SAGE_ROOT=/home/jpuydt/sage-4.8
>> (sage subshell) hecke:Olinux-armv7l jpuydt$ gcc -c -O -Wall
>> -fno-strict-aliasing -fomit-frame-pointer -g -funroll-loops -fPIC -I.
>> -I../src/headers -I/home/jpuydt/sage-4.8/local/include -o mp.o mp.c
>> SAGE_ROOT=/home/jpuydt/sage-4.8
>>
>> The gcc version is Ubuntu/Linaro 4.6.2-12ubuntu1.
>>
>> I'll try to investigate where the problem is (pari? gcc? other?), but I
>> thought sharing early would raise good suggestions.
>
> Hard to tell without looking at what is being generated, but I
> suspect something related to -mimplict-it=??? assembler option
> with the assembler generating extra code, and branch encoding
> for short jumps (8 or 11 bits). You can add -marm to CFLAGS
> and then it can only generate 24 bit displacement jumps...

Adding -marm makes the file compile too.

Snark on #sagemath

PS: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855

Julien Puydt

unread,
Feb 8, 2012, 5:18:57 AM2/8/12
to sage-...@googlegroups.com
Le samedi 04 février, Julien Puydt a écrit:
> After I compile mp.c with only the -O switch, pari and the rest of
> sage compiled correctly.

Amusing remark :

sage: float(maxima('1e+17'))
1e+17

One problem down... It's a shame others came up...

Snark on #sagemath

Dr. David Kirkby

unread,
Feb 8, 2012, 6:52:45 PM2/8/12
to sage-...@googlegroups.com
On 02/ 8/12 10:18 AM, Julien Puydt wrote:
> Le samedi 04 f�vrier, Julien Puydt a �crit:

>> After I compile mp.c with only the -O switch, pari and the rest of
>> sage compiled correctly.
>
> Amusing remark :
>
> sage: float(maxima('1e+17'))
> 1e+17
>
> One problem down... It's a shame others came up...
>
> Snark on #sagemath
>


Any attempt to port sage to another platform seems to bring up endless issues.
It took me several years of my spare time to get Sage building on Solaris. Prior
to my efforts, someone else worked on it full time for two years, though he
never got very far with it.

I've looked at building Sage on both AIX and HP-UX, but the issues are
formidable. (In the case of HP-UX, there is probably little point anyway, but
IBM make some very fast machines which run AIX).

I think your ARM port will be less hassle than an AIX port!!!!

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

William Stein

unread,
Feb 8, 2012, 6:57:13 PM2/8/12
to sage-...@googlegroups.com
On Wed, Feb 8, 2012 at 3:52 PM, Dr. David Kirkby
<david....@onetel.net> wrote:
> On 02/ 8/12 10:18 AM, Julien Puydt wrote:
>>
>> Le samedi 04 février, Julien Puydt a écrit:
>>>
>>> After I compile mp.c with only the -O switch, pari and the rest of
>>> sage compiled correctly.
>>
>>
>> Amusing remark :
>>
>> sage: float(maxima('1e+17'))
>> 1e+17
>>
>> One problem down... It's a shame others came up...
>>
>> Snark on #sagemath
>>
>
>
> Any attempt to port sage to another platform seems to bring up endless
> issues. It took me several years of my spare time to get Sage building on
> Solaris. Prior to my efforts, someone else worked on it full time for two
> years, though he never got very far with it.
>
> I've looked at building Sage on both AIX and HP-UX, but the issues are
> formidable. (In the case of HP-UX, there is probably little point anyway,
> but IBM make some very fast machines which run AIX).
>
> I think your ARM port will be less hassle than an AIX port!!!!

Thank you Julian/Snark for your really valuable contributions! It's
going to be fun to run Sage on my gtab.

William

>
> --
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
>
>

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Julien Puydt

unread,
Feb 9, 2012, 1:19:05 AM2/9/12
to sage-...@googlegroups.com
Le mercredi 08 février, Dr. David Kirkby a écrit:

> On 02/ 8/12 10:18 AM, Julien Puydt wrote:
> > Le samedi 04 février, Julien Puydt a écrit:
> >> After I compile mp.c with only the -O switch, pari and the rest of
> >> sage compiled correctly.
> >
> > Amusing remark :
> >
> > sage: float(maxima('1e+17'))
> > 1e+17
> >
> > One problem down... It's a shame others came up...
> >
> > Snark on #sagemath
> >
>
>
> Any attempt to port sage to another platform seems to bring up
> endless issues. It took me several years of my spare time to get Sage
> building on Solaris. Prior to my efforts, someone else worked on it
> full time for two years, though he never got very far with it.
>
> I've looked at building Sage on both AIX and HP-UX, but the issues
> are formidable. (In the case of HP-UX, there is probably little point
> anyway, but IBM make some very fast machines which run AIX).
>
> I think your ARM port will be less hassle than an AIX port!!!!
>

ARM is a plaftorm which is at the tip of the bleeding edge in some
sense, so gcc gets much work, and especially optimisation work.

Which also means they sometimes let bugs slip in the compiler, and
the buggy compiler slip out. I have the ubuntu gcc team and the linaro
gcc team on it, so I hope that one will go away soon. I shook quite a
few trees...

I consider portability of a piece of code a good indicator of its
quality : bad code doesn't port.

Snark on #sagemath

Julien Puydt

unread,
Feb 25, 2012, 3:44:52 PM2/25/12
to sage-...@googlegroups.com
Le samedi 04 février, Julien Puydt a écrit:
> I'll try to investigate where the problem is (pari? gcc? other?), but
> I thought sharing early would raise good suggestions.

Well, the problem was in the gcc version used for precise on ARM, which
has been updated since : I just compiled 5.0beta5 on my AC100 (still
building docs though) ; I only needed the new flint spkg
(http://trac.sagemath.org/sage_trac/ticket/10328).

Snark on #sagemath

Reply all
Reply to author
Forward
0 new messages