[Numpy-discussion] Is numpy ignoring CFLAGS?

Dr. David Kirkby david.kirkby@onetel....
Mon Jun 28 07:28:29 CDT 2010


On 06/28/10 11:28 AM, David Cournapeau wrote:
> On Mon, Jun 28, 2010 at 6:56 PM, Dr. David Kirkby

>> Many other parts of Sage seem to inherit the flags ok from Python, but not numpy.
>
> Are you saying that OPT is not taken into account ? It seems to work
> for me, e.g.
>
> OPT="-m64" python setup.py build_ext
>
> does put -m64 somewhere in CFLAGS. When using numpy.distutils, CFLAGS
> should never be overriden unless you are ready to set up the whole set
> of options manually. By default, CFLAGS is the concatenation of
> BASECFLAGS, OPT and CCSHARED (in that order), and only OPT should be
> tweaked in general.
>
> David
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


OPT is not being totally ignored, but some part of numpy is trying to build 
without taking -m64 into account.

Note in the output below that as numpy is compiled, -m64 is shown on some lines, 
which is what I expect. But note also the messages about "wrong ELF class: 
ELFCLASS64" from the linker, indicating to me the linker is not expecting to 
find 64-bit objects.

All the libraries in the directory

/export/home/drkirkby/sage-4.5.alpha0/local/lib

are 64-bit.


Someone worked around this on OS X by creating a script called 'gcc_fake', with 
this content


#!/bin/bash
/usr/bin/gcc -m64 $@


If a 64-bit build was going to be done, this was remaned to 'gcc' and put in the 
path first before building numpy. Once numpy was built, the script can be 
deleted. All the script does is basically invoke gcc with the -m64 option, which 
is making me think that -m64 is being missed somewhere.

I just deleted this gcc_fake, as it had a hard-coded path. I then created it 
dynamically, so the path of the real gcc does not need to be /usr/bin/gcc. Doing 
that, I can build numpy 64-bit on OpenSolaris. But of course this is a hack, and 
I'd rather avoid the hack if possible.

BTW, if it would help, I could create you an account on this machine and test it 
yourself. I'm not trying to get out of doing the work, but the offer is there.

Dave

numpy-1.3.0.p3/spkg-install
numpy-1.3.0.p3/.hgignore
Finished extraction
****************************************************
Host system
uname -a:
SunOS hawk 5.11 snv_134 i86pc i386 i86pc
****************************************************
****************************************************
CC Version
gcc -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with: /export/home/drkirkby/gcc-4.4.4/configure 
--prefix=/usr/local/gcc-4.4.4-multilib --enable-languages=c,c++,fortran 
--with-gmp=/usr/local/gcc-4.4.4-multilib 
--with-mpfr=/usr/local/gcc-4.4.4-multilib --disable-nls 
--enable-checking=release --enable-werror=no --enable-multilib 
--with-system-zlib --enable-bootstrap --with-gnu-as 
--with-as=/usr/local/binutils-2.20/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld
Thread model: posix
gcc version 4.4.4 (GCC)
****************************************************
Running from numpy source directory.
F2PY Version 2
blas_opt_info:
blas_mkl_info:
   libraries mkl,vml,guide not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
   NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
   libraries ptf77blas,ptcblas,atlas not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
   NOT AVAILABLE

atlas_blas_info:
   FOUND:
     libraries = ['f77blas', 'cblas', 'atlas']
     library_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/lib']
     language = c
     include_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/include']

/export/home/drkirkby/sage-4.5.alpha0/spkg/build/numpy-1.3.0.p3/src/numpy/distutils/command/config.py:361: 
DeprecationWarning:
+++++++++++++++++++++++++++++++++++++++++++++++++
Usage of get_output is deprecated: please do not
use it anymore, and avoid configuration checks
involving running executable on the target machine.
+++++++++++++++++++++++++++++++++++++++++++++++++

   DeprecationWarning)
customize Sage_FCompiler_1
customize Sage_FCompiler_1
customize Sage_FCompiler_1 using config
compiling '_configtest.c':

/* This file is generated from numpy/distutils/system_info.py */
void ATL_buildinfo(void);
int main(void) {
   ATL_buildinfo();
   return 0;
}
C compiler: gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -m64 -Wall 
-Wstrict-prototypes -fPIC

compile options: '-c'
gcc: _configtest.c
gcc _configtest.o -L/export/home/drkirkby/sage-4.5.alpha0/local/lib -lf77blas 
-lcblas -latlas -o _configtest
ld: fatal: file _configtest.o: wrong ELF class: ELFCLASS64
ld: fatal: file processing errors. No output written to _configtest
collect2: ld returned 1 exit status
ld: fatal: file _configtest.o: wrong ELF class: ELFCLASS64
ld: fatal: file processing errors. No output written to _configtest
collect2: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o
Status: 255
Output:
   FOUND:
     libraries = ['f77blas', 'cblas', 'atlas']
     library_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/lib']
     language = c
     define_macros = [('NO_ATLAS_INFO', 2)]
     include_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/include']

lapack_opt_info:
lapack_mkl_info:
mkl_info:
   libraries mkl,vml,guide not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
   NOT AVAILABLE

   NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
   libraries ptf77blas,ptcblas,atlas not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
   libraries lapack_atlas not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
numpy.distutils.system_info.atlas_threads_info
   NOT AVAILABLE

atlas_info:
   libraries lapack_atlas not found in 
/export/home/drkirkby/sage-4.5.alpha0/local/lib
numpy.distutils.system_info.atlas_info
   FOUND:
     libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
     library_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/lib']
     language = f77
     include_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/include']

customize Sage_FCompiler_1
customize Sage_FCompiler_1
customize Sage_FCompiler_1 using config
compiling '_configtest.c':

/* This file is generated from numpy/distutils/system_info.py */
void ATL_buildinfo(void);
int main(void) {
   ATL_buildinfo();
   return 0;
}
C compiler: gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -m64 -Wall 
-Wstrict-prototypes -fPIC

compile options: '-c'
gcc: _configtest.c
gcc _configtest.o -L/export/home/drkirkby/sage-4.5.alpha0/local/lib -llapack 
-lf77blas -lcblas -latlas -o _configtest
ld: fatal: file _configtest.o: wrong ELF class: ELFCLASS64
ld: fatal: file processing errors. No output written to _configtest
collect2: ld returned 1 exit status
ld: fatal: file _configtest.o: wrong ELF class: ELFCLASS64
ld: fatal: file processing errors. No output written to _configtest
collect2: ld returned 1 exit status
failure.
removing: _configtest.c _configtest.o
Status: 255
Output:
   FOUND:
     libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
     library_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/lib']
     language = f77
     define_macros = [('NO_ATLAS_INFO', 2)]
     include_dirs = ['/export/home/drkirkby/sage-4.5.alpha0/local/include']

running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
building py_modules sources
creating build
creating build/src.solaris-2.11-i86pc-2.6
creating build/src.solaris-2.11-i86pc-2.6/numpy
creating build/src.solaris-2.11-i86pc-2.6/numpy/distutils
building library "npymath" sources
creating build/src.solaris-2.11-i86pc-2.6/numpy/core
creating build/src.solaris-2.11-i86pc-2.6/numpy/core/src
conv_template:> build/src.solaris-2.11-i86pc-2.6/numpy/core/src/npy_math.c
building extension "numpy.core._sort" sources
Generating build/src.solaris-2.11-i86pc-2.6/numpy/core/include/numpy/config.h
customize Sage_FCompiler_1
customize Sage_FCompiler_1
customize Sage_FCompiler_1 using config
C compiler: gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -m64 -Wall 
-Wstrict-prototypes -fPIC

compile options: '-Inumpy/core/src -Inumpy/core/include 
-I/export/home/drkirkby/sage-4.5.alpha0/local/include/python2.6 -c'
gcc: _configtest.c
success!
removing: _configtest.c _configtest.o
C compiler: gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -m64 -Wall 
-Wstrict-prototypes -fPIC

compile options: '-Inumpy/core/src -Inumpy/core/include 
-I/export/home/drkirkby/sage-4.5.alpha0/local/include/python2.6 -c'
gcc: _configtest.c
_configtest.c:4: warning: function declaration isn't a prototype
removing: _configtest.c _configtest.o
C compiler: gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -m64 -Wall 
-Wstrict-prototypes -fPIC



More information about the NumPy-Discussion mailing list