flint-2.4.4 compile error for Sage-6.4 on MacOSX Mavericks

154 views
Skip to first unread message

Xander Faber

unread,
Feb 3, 2015, 7:33:18 AM2/3/15
to sage-...@googlegroups.com
I was building Sage 6.4 on a Mac Pro 2.6 GHz Intel Core i5. 

Tail end of the flint log file:


 

 CC
../build/fq_zech_poly_factor/../fq_zech_poly_factor.lo

 CXX build
/interfaces/NTL-interface.lo

Undefined symbols for architecture x86_64:

 
"___gmpn_com", referenced from:

 _fmpz_bit_pack
in fmpz.lo

 _fmpz_bit_unpack
in fmpz.lo

ld
: symbol(s) not found for architecture x86_64

collect2
: error: ld returned 1 exit status

make
[4]: *** [libflint.dylib] Error 1

make
[3]: *** [library] Error 2

Error: Failed to build FLINT shared library.


 

real
3m30.826s

user
2m32.253s

sys
0m51.078s

************************************************************************

Error installing package flint-2.4.4

************************************************************************

Please email sage-devel (http://groups.google.com/group/sage-devel)

explaining the problem
and including the relevant part of the log file

 
/Users/xander/sage/logs/pkgs/flint-2.4.4.log

Describe your computer, operating system, etc.

If you want to try to fix the problem yourself, *don't* just cd to

/Users/xander/sage/local/var/tmp/sage/build/flint-2.4.4 and type '
make' or whatever is appropriate.

Instead, the following commands setup all environment variables

correctly and load a subshell for you to debug the error:

 (cd '
/Users/xander/sage/local/var/tmp/sage/build/flint-2.4.4' && '/Users/xander/sage/sage' --sh)

When you are done debugging, you can type "exit" to leave the subshell.

************************************************************************

Any thoughts on what's going on?

Xander Faber

unread,
Feb 3, 2015, 7:56:44 PM2/3/15
to sage-...@googlegroups.com
Small fix: I'm running OSX Yosemite, not Mavericks. 

François Bissey

unread,
Feb 3, 2015, 8:05:45 PM2/3/15
to sage-...@googlegroups.com
Need more log please.

Francois

On 02/04/15 13:56, Xander Faber wrote:
> Small fix: I'm running OSX Yosemite, not Mavericks.
>
> On Tuesday, February 3, 2015 at 7:33:18 AM UTC-5, Xander Faber wrote:
>
> I was building Sage 6.4 on a Mac Pro 2.6 GHz Intel Core i5.
>
> Tail end of the flint log file:
> |
>
>
>
>
> CC ../build/fq_zech_poly_factor/../fq_zech_poly_factor.lo
>
> CXX build/interfaces/NTL-interface.lo
>
> Undefinedsymbols forarchitecture x86_64:
>
> "___gmpn_com",referenced from:
>
> _fmpz_bit_pack infmpz.lo
>
> _fmpz_bit_unpack infmpz.lo
>
> ld:symbol(s)notfound forarchitecture x86_64
>
> collect2:error:ld returned 1exitstatus
>
> make[4]:***[libflint.dylib]Error1
>
> make[3]:***[library]Error2
>
> Error:Failedto build FLINT shared library.
>
>
>
>
> real 3m30.826s
>
> user 2m32.253s
>
> sys 0m51.078s
>
> ************************************************************************
>
> Errorinstalling packageflint-2.4.4
>
> ************************************************************************
>
> Pleaseemail sage-devel (http://groups.google.com/group/sage-devel
> <http://groups.google.com/group/sage-devel>)
>
> explaining the problem andincluding the relevant part of the log file
>
> /Users/xander/sage/logs/pkgs/flint-2.4.4.log
>
> Describeyour computer,operating system,etc.
>
> Ifyou want to tryto fix the problem yourself,*don't* just cd to
>
> /Users/xander/sage/local/var/tmp/sage/build/flint-2.4.4 and type
> 'make' or whatever is appropriate.
>
> Instead, the following commands setup all environment variables
>
> correctly and load a subshell for you to debug the error:
>
> (cd '/Users/xander/sage/local/var/tmp/sage/build/flint-2.4.4' &&
> '/Users/xander/sage/sage' --sh)
>
> When you are done debugging, you can type "exit" to leave the subshell.
>
> ************************************************************************
> |
>
> Any thoughts on what's going on?
>
> --
> You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+...@googlegroups.com
> <mailto:sage-devel+...@googlegroups.com>.
> To post to this group, send email to sage-...@googlegroups.com
> <mailto:sage-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

Xander Faber

unread,
Feb 3, 2015, 8:52:39 PM2/3/15
to sage-...@googlegroups.com
Full flint log attached.

-Xander
flint-2.4.4.log

Bill Hart

unread,
Feb 5, 2015, 3:50:59 PM2/5/15
to sage-...@googlegroups.com
I can't shed much light on this.

We do indeed call mpn_com_n from those flint functions. In flint.h mpn_com_n is #defined to mpn_com for compatibility with various versions of MPIR.

The latter becomes xxxmpn_com where xxx can be g, _g, __g or ___g depending on the global symbol prefix on your platform.

On lines 23 and 24 of mpn/generic/com_n.c in MPIR we have

#undef mpn_com_n
#define mpn_com_n __MPN(com_n)

Who knows what the effect of this is.

But on a core i5, this should all be irrelevant, since for all core2 and later Intel processors, mpn/x86_64/core2/com_n.as should be compiled and should use the standard symbol prefix for your system regardless.

I'd be inclined to look at the MPIR build log and see if it detected your processor correctly, or whether it thought it was just a generic x86_64.

Unless your OS kernel is 32 bits somehow. But even in that case, mpn/x86/core2/com_n.asm should take care of it for you.

Bill.

Bill Hart

unread,
Feb 5, 2015, 4:04:55 PM2/5/15
to sage-...@googlegroups.com
Actually, we call mpn_com_n in flint. In flint.h this becomes mpn_com.

In gmp.h in MPIR this becomes __MPN(com_n) which must be ___gmpn_com_n on your machine.

If headers are included in the reverse order, mpn_com_n becomes directly ___gmpn_com_n in gmp.h.

This is indeed the name of the symbol we export. I can't see why it should be looking for the symbol ___gmpn_com, which certainly doesn't exist.

I don't see why this is happening.

Bill Hart

unread,
Feb 5, 2015, 4:17:26 PM2/5/15
to sage-...@googlegroups.com
Can you post sage/local/include/gmp.h here. I can't see how it is getting the wrong symbol name, under any circumstances.

Xander Faber

unread,
Feb 5, 2015, 5:18:20 PM2/5/15
to sage-...@googlegroups.com
attached!
gmp.h

Bill Hart

unread,
Feb 6, 2015, 7:18:51 AM2/6/15
to sage-...@googlegroups.com
Thanks. Unfortunately, I haven't been able to figure out what is causing this.

It looks like your gmp.h is turning either mpn_com or mpn_com_n into __gmpn_com_n as it should. It certainly doesn't turn it into ___gmpn_com. 

I have absolutely no idea what could be causing the extra underscore, or the com instead of com_n.

Somehow, a header file has to be being picked up from somewhere else that is doing the wrong thing.

You could verify that mpir and flint build standalone by downloading mpir-2.7.0-alpha (from mpir.org), mpfr-3.1.2 (from mpfr.org) and flint-2.4 (from flintlib.org).

Untar the files in your home directory.

cd mpir-2.7.0
./configure -- enable-gmpcompat ABI=64
make
make check
cd ../mpfr-3.1.2
./configure --with-gmp-build=/home/xander/mpir-2.7.0
make
cd ../flint2
./configure --with-mpir=/home/xander/mpir-2.7.0 --with-mpfr=/home/xander/mpfr-3.1.2 ABI=64
make

where I am assuming your home directory is /home/xander. If not, just change it to whatever it is.

If all that works, then the issue must surely be sage specific.

I honestly have no idea how this particular issue can happen. After more thought, I think the only thing that should matter is gmp.h. And your gmp.h looks correct.

Bill.

Xander Faber

unread,
Feb 6, 2015, 10:42:49 PM2/6/15
to sage-...@googlegroups.com
Hi Bill,

Thanks for the detailed instructions. mpir-2.7.0  and mpfr-3.1.2 build fine on my system. When I run the makefile for flint, I get the following messages after a while:

 `   CC   ../build/fq_zech_poly_factor/fq_zech_poly_factor_print.o
    CC   ../build/fq_zech_poly_factor/fq_zech_poly_factor_print_pretty.o
    CC   ../build/fq_zech_poly_factor/fq_zech_poly_factor_realloc.o
    CC   ../build/fq_zech_poly_factor/fq_zech_poly_factor_set.o
    AR   libflint.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libflint.a(fq_zech_clear.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libflint.a(fq_zech_clear.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libflint.a(fq_zech_clear.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libflint.a(fq_zech_clear.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libflint.a(fq_zech_clear.o) has no symbols`

It does, however, proceed beyond the point where Sage's flint compile crashes. 

Afterward, I ran 
 
make check

and everything passed. Soooo ... Sage specific problem, you're thinking? Since I've now compiled mpir-2.70, mpfr-3.1.2, and flint-2.4.4 separately, is it feasible to just copy these libraries into the Sage directory and proceed with the Sage build? Any idea where I would put them?

-Xander

Volker Braun

unread,
Feb 7, 2015, 3:53:02 AM2/7/15
to sage-...@googlegroups.com
Looks like a toolchain problem. Can you try reinstalling the OSX compiler command line tools? (xcode-select --install)

Xander Faber

unread,
Feb 7, 2015, 6:03:53 PM2/7/15
to sage-...@googlegroups.com
Ok, command line tools updated. (Side note: reinstalling via xcode-select didn't seem to be an option. I downloaded and installed a the most current version from Apple's developer site.)

What now? I tried

make distclean
make

but I'm still getting the same error. 

Let me just say thanks again for the help this far. 

Volker Braun

unread,
Feb 8, 2015, 4:24:53 AM2/8/15
to sage-...@googlegroups.com
Sage is compiled with GCC. Can you enter a sage shell "sage -sh" and then try again the compilation, then that'll use the same compiler.

Also, your header search path should be something like:

$ sage -sh

Starting subshell with Sage environment variables set.  Don't forget
to exit when you are done.  Beware:
 * Do not do anything with other copies of Sage on your system.
 * Do not use this for installing Sage packages using "sage -i" or for
   running "make" at Sage's root directory.  These should be done
   outside the Sage shell.

Bypassing shell configuration files...

Note: SAGE_ROOT=/Users/vbraun/Sage

$ cpp -v
Using built-in specs.
COLLECT_GCC=cpp
Target: x86_64-apple-darwin14.0.0
Configured with: ../src/configure --prefix=/Users/vbraun/Sage/local --with-local-prefix=/Users/vbraun/Sage/local --with-gmp=/Users/vbraun/Sage/local --with-mpfr=/Users/vbraun/Sage/local --with-mpc=/Users/vbraun/Sage/local --with-system-zlib --disable-multilib --disable-nls --enable-languages=c,c++,fortran --disable-libitm --without-isl --without-cloog  
Thread model: posix
gcc version 4.9.2 (GCC) 
COLLECT_GCC_OPTIONS='-E' '-mmacosx-version-min=10.9' '-v' '-mtune=core2'
 /Users/vbraun/Sage/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/cc1 -E -quiet -v -D__DYNAMIC__ - -fPIC -mmacosx-version-min=10.9 -mtune=core2
ignoring nonexistent directory "/Users/vbraun/Sage/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/../../../../x86_64-apple-darwin14.0.0/include"
ignoring duplicate directory "/Users/vbraun/Sage/local/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /Users/vbraun/Sage/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include
 /Users/vbraun/Sage/local/include
 /Users/vbraun/Sage/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
^C




On Saturday, February 7, 2015 at 4:42:49 AM UTC+1, Xander Faber wrote:

Xander Faber

unread,
Feb 8, 2015, 7:55:26 AM2/8/15
to sage-...@googlegroups.com
Volker - 

I'm in over my head here. Can you be more specific about which commands you want me to run? 
Or do you just want to see the output of the commands you used below? If the latter, they're below.

-Xander


`
Xanders-MacBook-Pro:~ xander$ cd '/Users/xander/sage/local/var/tmp/sage/build/flint-2.4.4' && '/Users/xander/sage/sage' --sh

Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.

Bypassing shell configuration files...

Note: SAGE_ROOT=/Users/xander/sage
(sage-sh) xander@Xanders-MBP:flint-2.4.4$ cpp -v
Using built-in specs.
COLLECT_GCC=cpp
Target: x86_64-apple-darwin14.1.0
Configured with: ../src/configure --prefix=/Users/xander/sage/local --with-local-prefix=/Users/xander/sage/local --with-gmp=/Users/xander/sage/local --with-mpfr=/Users/xander/sage/local --with-mpc=/Users/xander/sage/local --with-system-zlib --disable-multilib --disable-nls --enable-languages=c,c++,fortran --disable-libitm --without-isl --without-cloog
Thread model: posix
gcc version 4.9.2 (GCC)
COLLECT_GCC_OPTIONS='-E' '-mmacosx-version-min=10.9' '-v' '-mtune=core2'
/Users/xander/sage/local/libexec/gcc/x86_64-apple-darwin14.1.0/4.9.2/cc1 -E -quiet -v -D__DYNAMIC__ - -fPIC -mmacosx-version-min=10.9 -mtune=core2
ignoring nonexistent directory "/Users/xander/sage/local/lib/gcc/x86_64-apple-darwin14.1.0/4.9.2/../../../../x86_64-apple-darwin14.1.0/include"
ignoring duplicate directory "/Users/xander/sage/local/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Users/xander/sage/local/lib/gcc/x86_64-apple-darwin14.1.0/4.9.2/include
/Users/xander/sage/local/include
/Users/xander/sage/local/lib/gcc/x86_64-apple-darwin14.1.0/4.9.2/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks
End of search list.
^C
`

Volker Braun

unread,
Feb 8, 2015, 9:38:30 AM2/8/15
to sage-...@googlegroups.com
On Sunday, February 8, 2015 at 1:55:26 PM UTC+1, Xander Faber wrote:
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Users/xander/sage/local/lib/gcc/x86_64-apple-darwin14.1.0/4.9.2/include
/Users/xander/sage/local/include

I'm guessing you have a /usr/local/include/gmp.h that is not ours, this explains your problem. Do you have homebrew installed in /usr/local? This conflicts with Sage, the easiest workaround is to rename /usr/local while building Sage.

Also, can you post the log of the gcc build, maybe we can add a workaround there.

Xander Faber

unread,
Feb 8, 2015, 7:22:09 PM2/8/15
to sage-...@googlegroups.com
Woot! Successful build! 

Yes, I had my own install of gmp. I renamed /usr/local before the build and everything went smoothly. 

Many thanks, Volker and Bill, for diagnosing the problem. 

Cheers,
Xander 



--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/pqB6hdzEFfk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages