Error building tuneup
Mats SX
mats.sxz at gmail.com
Wed Oct 2 11:20:30 CEST 2013
Hello
I was trying to optimize GMP 5.1.2 for my system, and as per the manual,
running tuneup is advisable. But building tuneup proved impossible. First,
I configure GMP as such (in the main directory):
./configure --enable-fat ABI=64 CFLAGS="-march=corei7-avx -mtune=corei7-avx
-m64 -O3" --enable-cxx CXX=g++ CXXFLAGS="-march=corei7-avx
-mtune=corei7-avx -m64 -O3"
(As far as I've gathered, sandybridge support will not be available for
assembler code in GMP until 5.2.)
Running make executes fine also. Then I go to subdir tune and try to run
make tuneup
which works fine for a lot of files, until I get
echo "#define TUNE_PROGRAM_BUILD 1" >divrem_1.c
echo "#define __gmpn_divrem_1 mpn_divrem_1_tune" >>divrem_1.c
echo "#include \"mpn/generic/divrem_1.c\"" >>divrem_1.c
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I.. -I../tests
-march=corei7-avx -mtune=corei7-avx -m64 -O3 -c divrem_1.c
In file included from divrem_1.c:3:0:
../mpn/generic/divrem_1.c:79:1: error: expected ‘)’ before ‘.’ token
make[1]: *** [divrem_1.o] Error 1
make[1]: Leaving directory `/home/sx/Downloads/gmp-5.1.2/tune'
(I've included the output which seemed relevant.)
The very strange thing here is that in the file divrem_1.c, there is no '.'
token. Not even one (outside comments). How gcc finds one I do not know.
But, removing the 'm' (or replacing it with any other character basically;
I've tried a few), which is located at 79:1 in the file, makes compilation
run fine. This is how the file looks like around the error-row:
mp_limb_t
mpn_divrem_1 (mp_ptr qp, mp_size_t qxn, mp_srcptr up,
mp_size_t un, mp_limb_t d)
(The 'm' in "mpn_divrem_1" is the one that is interpreted as a '.'.)
Then compilation fails again, this time in another file
"mpn/generic/mod_1.c", again complaining about an 'm' being a '.'. Same
procedure here gets us through the compilation and into linking.
It starts out fine, but soon everything collapses with "undefined reference
to" a lot of things. Some I suspect are due to me renaming functions in
order to compile as above, but some seem to be completely other things.
Here is a snip of the output:
tuneup.o: In function `speed_mpn_mod_1_tune':
tuneup.c:(.text+0x31d): undefined reference to `mpn_mod_1_tune'
tuneup.o: In function `speed_mpn_divrem_1_tune':
tuneup.c:(.text+0x932): undefined reference to `mpn_divrem_1_tune'
/home/sx/Downloads/gmp-5.1.2/.libs/libgmp.a(jacobi.o): In function
`__gmpz_jacobi':
jacobi.c:(.text+0x3e1): undefined reference to `__gmpn_modexact_1_odd'
/home/sx/Downloads/gmp-5.1.2/.libs/libgmp.a(toom32_mul.o): In function
`__gmpn_toom32_mul':
toom32_mul.c:(.text+0x34d): undefined reference to `__gmpn_add_nc'
toom32_mul.c:(.text+0x3d4): undefined reference to `__gmpn_sub_nc'
toom32_mul.c:(.text+0x3ed): undefined reference to `__gmpn_sub_nc'
toom32_mul.c:(.text+0x4ef): undefined reference to `__gmpn_sub_nc'
/home/sx/Downloads/gmp-5.1.2/.libs/libgmp.a(toom_interpolate_6pts.o): In
function `__gmpn_toom_interpolate_6pts':
toom_interpolate_6pts.c:(.text+0x1fb): undefined reference to
`__gmpn_sublsh2_n'
So, I don't think this is necessarily a bug with GMP as such, but I don't
know where to go from here.
My system as per bug report instructions:
$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-mageia-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-mageia-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib
--with-slibdir=/lib64
--with-bugurl=http://bugs.mageia.org/--mandir=/usr/share/man
--infodir=/usr/share/info --enable-checking=release
--enable-languages=c,c++,ada,fortran,objc,obj-c++,java
--enable-linker-build-id --build=x86_64-mageia-linux-gnu
--host=x86_64-mageia-linux-gnu --with-cpu=generic --with-system-zlib
--enable-threads=posix --enable-shared --enable-objc-gc --enable-long-long
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-gtk-cairo
--disable-libjava-multilib --enable-ssp --disable-libssp --disable-werror
--with-ppl --with-cloog --with-python-dir=/lib/python2.7/site-packages
--enable-lto
Thread model: posix
gcc version 4.7.2 (GCC)
$uname -a
Linux exjobb28.cs.lth.se 3.8.13.4-desktop-1.mga3 #1 SMP Thu Jul 4 13:56:21
UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$./config.guess
coreisbr-unknown-linux-gnu
Thank you
Mats
More information about the gmp-bugs
mailing list