[MacPorts] #19397: scipy not completely universal

MacPorts noreply at macports.org
Sun May 23 09:44:09 PDT 2010


#19397: scipy not completely universal
-------------------------------------------+--------------------------------
 Reporter:  daweonline@…                   |       Owner:  jmr@…           
     Type:  defect                         |      Status:  new             
 Priority:  Normal                         |   Milestone:                  
Component:  ports                          |     Version:  1.7.1           
 Keywords:  scipy python universal binary  |        Port:  py26-scipy      
-------------------------------------------+--------------------------------

Comment(by cpandar@…):

 Vincent,

 this seems to be a really good way of building a universal scipy with the
 macports framework. I tried it, and with some minor modification, it seems
 like everything builds well, e.g.:

 {{{
 $ file
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/l
 inalg/flapack.so
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/flapack.so: Mach-O universal binary with 2
 architectures
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/flapack.so (for architecture x86_64):  Mach-O
 64-bit bundle x86_64
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/flapack.so (for architecture i386):    Mach-O
 bundle i386
 }}}


 I am running into strange issues when trying to actually use the dynamic
 modules in python, though.

 {{{
 $ python -c "import scipy.linalg"
 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/__init__.py", line 8, in <module>
     from basic import *
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/basic.py", line 17, in <module>
     from lapack import get_lapack_funcs
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
 /site-packages/scipy/linalg/lapack.py", line 17, in <module>
     from scipy.linalg import flapack
 ImportError: dynamic module does not define init function (initflapack)
 }}}

 Did you run into this issue at all? Any ideas?

 Thanks.

 Replying to [comment:7 vince@…]:
 > This version of gfortran is also available here :
 http://r.research.att.com/tools/
 >
 > But the way it handles the command line is buggy. For example :
 >
 > {{{
 > -> /usr/local/bin/gfortran -arch i386
 > i686-apple-darwin8-gfortran-4.2: no input files
 > -> /usr/local/bin/gfortran -arch i386 -arch x86_64
 > ->
 > }}}
 >
 > Strange, no? If two archs flags are present, there is no stderr output.
 >
 > Here is a way to build a universal scipy with this compiler located in
 /usr/local/bin:
 >
 > 1. Add this file in the ${portpath} file directory, it wraps
 /usr/local/bin/gfortran-4.2, fixes the bug above and another one in the
 building process (automatic addition of -arch i686 and -arch ppc; why
 ???):
 >
 > {{{
 > -> more files/gf.in
 > #!/bin/sh
 >
 > NOF=yes
 > IGNORE=no
 > ARGS=
 >
 > for i in $@ ; do
 > if [ $IGNORE == 'yes' ]; then
 >   IGNORE=no
 > else
 >   if [ $i == '-arch' ]; then
 >     IGNORE=yes
 >   else
 >     ARGS=`echo $ARGS " " $i`
 >     if [ $i == '-o' ]; then
 >       NOF=no
 >     fi
 >   fi
 > fi
 > done
 >
 > if [ $NOF == 'yes' ]; then
 > /usr/local/bin/gfortran-4.2 $@
 > else
 > /usr/local/bin/gfortran-4.2 XXX $ARGS
 > fi
 > }}}
 >
 > 2. Add this variant to Portfile
 >
 > {{{
 > variant gf42univ conflicts gcc42 gcc43 gcc44 description "Use
 gfortan-4.2 from http://r.research.att.com/tools to build universal
 binaries" {
 >
 > if {! [file exists /usr/local/bin/gfortran-4.2]} then {
 >    puts "> Please install gfortran universal from
 http:////r.research.att.com//tools//"
 >    exit 1
 > }
 >
 > set fc_options "build_clib --fcompiler=gnu95 build_ext --fcompiler=gnu95
 config_fc --fcompiler=gnu95 \
 >                 --f77exec ${portpath}/files/gf --f90exec
 ${portpath}/files/gf"
 >
 > set uarch ""
 > foreach arch ${universal_archs} {
 >       append uarch "-arch " ${arch} " "
 > }
 >
 > delete ${portpath}/files/gf
 > copy ${portpath}/files/gf.in ${portpath}/files/gf
 > reinplace "s|XXX|${uarch}|" ${portpath}/files/gf
 >
 > build.cmd-append      ${fc_options}
 > destroot.cmd-append   ${fc_options}
 > }
 > }}}
 >
 > Maybe one should also add a system "chmod +x ${portpath}/files/gf" ?
 [[br]]
 > Vincent

-- 
Ticket URL: <http://trac.macports.org/ticket/19397#comment:14>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list