ecm failed to build

74 views
Skip to first unread message

Jan Groenewald

unread,
Sep 19, 2017, 12:11:54 PM9/19/17
to sage-devel
Hi

On Debian 9 64bit (VM) with SAGE_FAT_BINARY=yes ecm fails to build, log attached.

Log attached, any idea?

Regards,
Jan

--
  .~.
  /V\     Jan Groenewald
 /( )\    www.aims.ac.za
 ^^-^^ 

ecm-7.0.4.p0.log

Dima Pasechnik

unread,
Sep 19, 2017, 1:25:11 PM9/19/17
to sage-devel
Probably your gmp or mpir was not built correctly:
Indeed:

/usr/bin/ld: /srv/sage-8.0/local/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC

Of er is een kat op de muizenberg... :-)

Jan Groenewald

unread,
Sep 20, 2017, 2:57:20 AM9/20/17
to sage-devel
Hi

On 19 September 2017 at 19:25, Dima Pasechnik <dim...@gmail.com> wrote:

Probably your gmp or mpir was not built correctly:
Indeed:

/usr/bin/ld: /srv/sage-8.0/local/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC

mpir log attached. There is no gmp log.

This persists with SAGE_FAT_BINARY=no and rerunning make as well.

This occurs inside a libvirt/qemu virtual machine.
Someone else posted this error related to docker in July:
https://groups.google.com/d/msg/sage-devel/Jl071EqambM/yr4_RvjbBQAJ

When I build on the host OS, also Debian 9 it compiles OK.

Regards,
Jan


mpir-3.0.0.p0.log.xz

Jan Groenewald

unread,
Sep 20, 2017, 3:19:48 AM9/20/17
to sage-devel
Hi

On 20 September 2017 at 08:56, Jan Groenewald <j...@aims.ac.za> wrote:
Hi

On 19 September 2017 at 19:25, Dima Pasechnik <dim...@gmail.com> wrote:

Probably your gmp or mpir was not built correctly:
Indeed:

/usr/bin/ld: /srv/sage-8.0/local/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC

mpir log attached. There is no gmp log.

This persists with SAGE_FAT_BINARY=no and rerunning make as well.

This occurs inside a libvirt/qemu virtual machine.
Someone else posted this error related to docker in July:
https://groups.google.com/d/msg/sage-devel/Jl071EqambM/yr4_RvjbBQAJ

Just like that previous poster (in docker), if inside my VM I do:

cd upstream; tar xf ecm*; cd ecm*; ./configure; make

then the build succeeds.

Regards,
Jan

Dima Pasechnik

unread,
Sep 20, 2017, 7:32:16 AM9/20/17
to sage-devel


On Wednesday, September 20, 2017 at 8:19:48 AM UTC+1, Jan Groenewald wrote:
Hi

On 20 September 2017 at 08:56, Jan Groenewald <j...@aims.ac.za> wrote:
Hi

On 19 September 2017 at 19:25, Dima Pasechnik <dim...@gmail.com> wrote:

Probably your gmp or mpir was not built correctly:
Indeed:

/usr/bin/ld: /srv/sage-8.0/local/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC

mpir log attached. There is no gmp log.
/bin/bash ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo fat_entry | sed 's/_$//'`   -m64 -O2  -g   -I. -I..  `test -f 'fat_entry.asm' || echo './'`fat_entry.asm

libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. fat_entry.asm  -fPIC -DPIC -o .libs/fat_entry.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_fat_entry -DPIC fat_entry.asm >tmp-fat_entry.s
 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. tmp-fat_entry.s -fPIC -DPIC -o .libs/fat_entry.o

libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. fat_entry.asm -o fat_entry.o >/dev/null 2>&1

these are lines in the log corresponding to compiling fat_entry.o, and it looks to me as if the last line does not 
say -fPIC anywhere. No idea whether this is the cause of the problem...
 

This persists with SAGE_FAT_BINARY=no and rerunning make as well.

This occurs inside a libvirt/qemu virtual machine.
Someone else posted this error related to docker in July:
https://groups.google.com/d/msg/sage-devel/Jl071EqambM/yr4_RvjbBQAJ

Just like that previous poster (in docker), if inside my VM I do:

cd upstream; tar xf ecm*; cd ecm*; ./configure; make

but this is against another libgmp, I presume.

Jan Groenewald

unread,
Sep 21, 2017, 2:54:44 AM9/21/17
to sage-devel
Hi



On 20 September 2017 at 13:32, Dima Pasechnik <dim...@gmail.com> wrote:


On Wednesday, September 20, 2017 at 8:19:48 AM UTC+1, Jan Groenewald wrote:
Hi

On 20 September 2017 at 08:56, Jan Groenewald <j...@aims.ac.za> wrote:
Hi

On 19 September 2017 at 19:25, Dima Pasechnik <dim...@gmail.com> wrote:

Probably your gmp or mpir was not built correctly:
Indeed:

/usr/bin/ld: /srv/sage-8.0/local/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC

mpir log attached. There is no gmp log.
/bin/bash ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo fat_entry | sed 's/_$//'`   -m64 -O2  -g   -I. -I..  `test -f 'fat_entry.asm' || echo './'`fat_entry.asm

libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. fat_entry.asm  -fPIC -DPIC -o .libs/fat_entry.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_fat_entry -DPIC fat_entry.asm >tmp-fat_entry.s
 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. tmp-fat_entry.s -fPIC -DPIC -o .libs/fat_entry.o

libtool: compile:  ../mpn/m4-ccas --m4=m4 gcc -c -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -I.. -DOPERATION_fat_entry -m64 -O2 -g -I. -I.. fat_entry.asm -o fat_entry.o >/dev/null 2>&1

these are lines in the log corresponding to compiling fat_entry.o, and it looks to me as if the last line does not 
say -fPIC anywhere. No idea whether this is the cause of the problem...

I do see there is a trac issue already: https://trac.sagemath.org/ticket/23519

 
 

This persists with SAGE_FAT_BINARY=no and rerunning make as well.

This occurs inside a libvirt/qemu virtual machine.
Someone else posted this error related to docker in July:
https://groups.google.com/d/msg/sage-devel/Jl071EqambM/yr4_RvjbBQAJ

Just like that previous poster (in docker), if inside my VM I do:

cd upstream; tar xf ecm*; cd ecm*; ./configure; make

but this is against another libgmp, I presume.

Yes, must be the debian libgmp, it was not in a sage shell.

Regards,
Jan

Jan Groenewald

unread,
Sep 21, 2017, 3:22:24 AM9/21/17
to sage-devel
Hi

This is possibly gcc 6.2 related: https://mail.coreboot.org/pipermail/coreboot/2016-December/082739.html

And a possible solution is Build GMP --with-pic, (only) if GCC defaults to -pie (preferred solution from reading the rest of above thread to the end).

Regards,
Jan



Jan Groenewald

unread,
Sep 21, 2017, 10:16:30 AM9/21/17
to sage-devel
Hi

On 21 September 2017 at 09:21, Jan Groenewald <j...@aims.ac.za> wrote:

And a possible solution is Build GMP --with-pic, (only) if GCC defaults to -pie (preferred solution from reading the rest of above thread to the end).

export CFLAGS="--with-pic"; ./sage -f mpir; make # failed to build

export CFLAGS="-fPIC"; ./sage -f mpir; make # completed build (well many packages (see attached) except doc-html eventually failed to build with OSError: [Errno 12] Cannot allocate memory in a 4G Virtual Machine.
rebuilds.txt
Reply all
Reply to author
Forward
0 new messages