On Sun, May 27, 2012 at 4:05 AM, Magician <f_magician@mac.com> wrote:
Hi Ralf and Sergio,


I thought my problems inclined to NumPy, and I posted to NumPy mailing list.
But I couldn't get any answers for several days, so I'd like to ask again.


I tried to build NumPy again with site.cfg, but I got these errors:
> building 'numpy.core._sort' extension
> compiling C sources
> C compiler: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
>
> compile options: '-Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/local/python-2.7.3/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'
> gcc: build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.c
> gcc -pthread -shared build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.o -L. -Lbuild/temp.linux-x86_64-2.7 -lnpymath -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/numpy/core/_sort.so
> /usr/bin/ld: cannot find -lpython2.7
> collect2: ld returned 1 exit status
> /usr/bin/ld: cannot find -lpython2.7
> collect2: ld returned 1 exit status
> error: Command "gcc -pthread -shared build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/_sortmodule.o -L. -Lbuild/temp.linux-x86_64-2.7 -lnpymath -lm -lpython2.7 -o build/lib.linux-x86_64-2.7/numpy/core/_sort.so" failed with exit status 1

Before I built NumPy, I uncommented and modified site.cfg as below:
> [DEFAULT]
> library_dirs = /usr/local/python-2.7.3/lib:/usr/lib64:/usr/lib64/atlas
> include_dirs = /usr/local/python-2.7.3/include:/usr/include:/usr/include/atlas
>
> [blas_opt]
> libraries = f77blas, cblas, atlas
>
> [lapack_opt]
> libraries = lapack, f77blas, cblas, atlas

And "setup.py config" dumped these messages:
> Running from numpy source directory.F2PY Version 2
> blas_opt_info:
> blas_mkl_info:
>  libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib
>  libraries mkl,vml,guide not found in /usr/lib64
>  libraries mkl,vml,guide not found in /usr/lib64/atlas
>  NOT AVAILABLE
>
> atlas_blas_threads_info:
> Setting PTATLAS=ATLAS
>  libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib
> Setting PTATLAS=ATLAS
> customize GnuFCompiler
> Could not locate executable g77
> Could not locate executable f77
> customize IntelFCompiler
> Could not locate executable ifort
> Could not locate executable ifc
> customize LaheyFCompiler
> Could not locate executable lf95
> customize PGroupFCompiler
> Could not locate executable pgf90
> Could not locate executable pgf77
> customize AbsoftFCompiler
> Could not locate executable f90
> customize NAGFCompiler
> Found executable /usr/bin/f95
> customize VastFCompiler
> customize CompaqFCompiler
> Could not locate executable fort
> customize IntelItaniumFCompiler
> Could not locate executable efort
> Could not locate executable efc
> customize IntelEM64TFCompiler
> customize Gnu95FCompiler
> Found executable /usr/bin/gfortran
> customize Gnu95FCompiler
> customize Gnu95FCompiler 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 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
>
> compile options: '-c'
> gcc: _configtest.c
> gcc -pthread _configtest.o -L/usr/lib64/atlas -lptf77blas -lptcblas -latlas -o _configtest
> ATLAS version 3.8.4 built by mockbuild on Wed Dec  7 18:04:21 GMT 2011:
>   UNAME    : Linux c6b5.bsys.dev.centos.org 2.6.32-44.2.el6.x86_64 #1 SMP Wed Jul 21 12:48:32 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
>   INSTFLG  : -1 0 -a 1
>   ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_PII -DATL_CPUMHZ=2261 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
>   F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
>   CACHEEDGE: 8388608
>   F77      : gfortran, version GNU Fortran (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
>   F77FLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
>   SMC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
>   SMCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
>   SKC      : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
>   SKCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
> success!
> removing: _configtest.c _configtest.o _configtest
> Setting PTATLAS=ATLAS
>  FOUND:
>    libraries = ['ptf77blas', 'ptcblas', 'atlas']
>    library_dirs = ['/usr/lib64/atlas']
>    language = c
>    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
>    include_dirs = ['/usr/include']
>
>  FOUND:
>    libraries = ['ptf77blas', 'ptcblas', 'atlas']
>    library_dirs = ['/usr/lib64/atlas']
>    language = c
>    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
>    include_dirs = ['/usr/include']
>
> lapack_opt_info:
> lapack_mkl_info:
> mkl_info:
>  libraries mkl,vml,guide not found in /usr/local/python-2.7.3/lib
>  libraries mkl,vml,guide not found in /usr/lib64
>  libraries mkl,vml,guide not found in /usr/lib64/atlas
>  NOT AVAILABLE
>
>  NOT AVAILABLE
>
> atlas_threads_info:
> Setting PTATLAS=ATLAS
>  libraries ptf77blas,ptcblas,atlas not found in /usr/local/python-2.7.3/lib
>  libraries lapack_atlas not found in /usr/local/python-2.7.3/lib
>  libraries lapack_atlas not found in /usr/lib64/atlas
> numpy.distutils.system_info.atlas_threads_info
> Setting PTATLAS=ATLAS
> Setting PTATLAS=ATLAS
>  FOUND:
>    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
>    library_dirs = ['/usr/lib64/atlas']
>    language = f77
>    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
>    include_dirs = ['/usr/include']
>
>  FOUND:
>    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
>    library_dirs = ['/usr/lib64/atlas']
>    language = f77
>    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
>    include_dirs = ['/usr/include']
>
> running config

I couldn't get enough informations about numscons/bento,
so I'm still trying to build it with site.cfg and CFLAGS.

You specified the additional library dir you need in site.cfg. You therefore don't need to use CFLAGS anymore. This is probably still what's going wrong, because the build error says it can't find Python itself anymore. So make sure that CFLAGS is not defined and try again.

Ralf