[Numpy-discussion] when will osx linker option -bundle be reflected in distutils

2009-01-05 Thread Garry Willgoose
  I was just wondering what plans there were to reflect the different
  linker options (i.e. -bundle instead of -shared) that are required  
 on
  OSX in the fcompiler files within distutils. While its a minor thing
  it always catches the users of my software when they either install
  fresh or update numpy ... and sometimes on a bad day it even catches
  me ;-)

 I'm sorry; I don't follow. What problems are you having? --
 -- Robert Kern

---

OK for example the distribution g95.py in distutils/fcompiler has the  
following code

executables = {
'version_cmd'  : [g95, --version],
'compiler_f77' : [g95, -ffixed-form],
'compiler_fix' : [g95, -ffixed-form],
'compiler_f90' : [g95],
'linker_so': [g95,-shared],
'archiver' : [ar, -cr],
'ranlib'   : [ranlib]
}

For osx you need to modify it to

  executables = {
'version_cmd'  : [g95, --version],
'compiler_f77' : [g95, -ffixed-form],
'compiler_fix' : [g95, -ffixed-form],
'compiler_f90' : [g95],
'linker_so': [g95,-shared],
'archiver' : [ar, -cr],
'ranlib'   : [ranlib]
}
import sys
if sys.platform.lower() == 'darwin':
executables[linker_so'] = [g95,-Wall -bundle]

The 'shared' option is not implemented in the osx linker. Not sure  
what the underlying difference between 'shared' and 'bundle' is but  
this substitution is necessary and this has been working for me for  
the last year or so. You also need the -Wall but for reasons that  
completely escape me.

The same goes for gfortran and intel (both of which I use) and I  
assume the other compilers that are available for OSX.



Prof Garry Willgoose,
Australian Professorial Fellow in Environmental Engineering,
Director, Centre for Climate Impact Management (C2IM),
School of Engineering, The University of Newcastle,
Callaghan, 2308
Australia.

Centre webpage: www.c2im.org.au

Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2 6545 9574  
(Fri PM-Mon)
FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal  
and Telluric)
Env. Engg. Secretary: (International) +61 2 4921 6042

email:  garry.willgo...@newcastle.edu.au; g.willgo...@telluricresearch.com
email-for-life: garry.willgo...@alum.mit.edu
personal webpage: www.telluricresearch.com/garry

Do not go where the path may lead, go instead where there is no path  
and leave a trail
   Ralph Waldo Emerson






___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] when will osx linker option -bundle be reflected in distutils

2009-01-05 Thread Robert Kern
On Mon, Jan 5, 2009 at 18:48, Garry Willgoose
garry.willgo...@newcastle.edu.au wrote:
  I was just wondering what plans there were to reflect the different
  linker options (i.e. -bundle instead of -shared) that are required
 on
  OSX in the fcompiler files within distutils. While its a minor thing
  it always catches the users of my software when they either install
  fresh or update numpy ... and sometimes on a bad day it even catches
  me ;-)

 I'm sorry; I don't follow. What problems are you having? --
 -- Robert Kern

 ---

 OK for example the distribution g95.py in distutils/fcompiler has the
 following code

executables = {
'version_cmd'  : [g95, --version],
'compiler_f77' : [g95, -ffixed-form],
'compiler_fix' : [g95, -ffixed-form],
'compiler_f90' : [g95],
'linker_so': [g95,-shared],
'archiver' : [ar, -cr],
'ranlib'   : [ranlib]
}

 For osx you need to modify it to

  executables = {
'version_cmd'  : [g95, --version],
'compiler_f77' : [g95, -ffixed-form],
'compiler_fix' : [g95, -ffixed-form],
'compiler_f90' : [g95],
'linker_so': [g95,-shared],
'archiver' : [ar, -cr],
'ranlib'   : [ranlib]
}
import sys
if sys.platform.lower() == 'darwin':
executables[linker_so'] = [g95,-Wall -bundle]

 The 'shared' option is not implemented in the osx linker. Not sure
 what the underlying difference between 'shared' and 'bundle' is but
 this substitution is necessary and this has been working for me for
 the last year or so. You also need the -Wall but for reasons that
 completely escape me.

-Wall absolutely should not affect anything except adding warning
messages. I suspect something else is getting modified when you do
that.

 The same goes for gfortran and intel (both of which I use) and I
 assume the other compilers that are available for OSX.

I've been building scipy for years with gfortran and an unmodified
numpy on OS X. The correct switches are added in the
get_flags_linker_so() method:

def get_flags_linker_so(self):
opt = self.linker_so[1:]
if sys.platform=='darwin':
# MACOSX_DEPLOYMENT_TARGET must be at least 10.3. This is
# a reasonable default value even when building on 10.4 when using
# the official Python distribution and those derived from it (when
# not broken).
target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None)
if target is None or target == '':
target = '10.3'
major, minor = target.split('.')
if int(minor)  3:
minor = '3'
warnings.warn('Environment variable '
'MACOSX_DEPLOYMENT_TARGET reset to %s.%s' % (major, minor))
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major,
minor)

opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
else:
opt.append(-shared)
if sys.platform.startswith('sunos'):
# SunOS often has dynamically loaded symbols defined in the
# static library libg2c.a  The linker doesn't like this.  To
# ignore the problem, use the -mimpure-text flag.  It isn't
# the safest thing, but seems to work. 'man gcc' says:
# .. Instead of using -mimpure-text, you should compile all
#  source code with -fpic or -fPIC.
opt.append('-mimpure-text')
return opt

If this is not working for you, please show me the error messages you get.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] when will osx linker option -bundle be reflected in distutils

2009-01-05 Thread Daniel Macks
On Tue, Jan 06, 2009 at 11:48:57AM +1100, Garry Willgoose wrote:
 The 'shared' option is not implemented in the osx linker. Not sure  
 what the underlying difference between 'shared' and 'bundle' is

To answer this narrow part of the question, -shared is the way to
build shared libraries on linux (I think it's part of the standard GNU
ld and/or ELF binary format), and is how one builds all sorts of .so.
On OS X, there is a difference between a dynamic library (one that
is linked later via -lFOO flags, standard extension .dylib) and a
loadable module (one that is loaded at runtime via dlopen() or
similar methods, often extension .so). Linux doesn't have as sharp a
distinction. OS X linker uses different flags to specify which one to
build (-dynamiclib and -bundle, respectively).

dan

-- 
Daniel Macks
dma...@netspace.org
http://www.netspace.org/~dmacks

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] when will osx linker option -bundle be reflected in distutils

2008-12-08 Thread Garry Willgoose
I was just wondering what plans there were to reflect the different  
linker options (i.e. -bundle instead of -shared) that are required on  
OSX in the fcompiler files within distutils. While its a minor thing  
it always catches the users of my software when they either install  
fresh or update numpy ... and sometimes on a bad day it even catches  
me ;-)

Prof Garry Willgoose,
Australian Professorial Fellow in Environmental Engineering,
Director, Centre for Climate Impact Management (C2IM),
School of Engineering, The University of Newcastle,
Callaghan, 2308
Australia.

Centre webpage: www.c2im.org.au

Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2 6545 9574  
(Fri PM-Mon)
FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal  
and Telluric)
Env. Engg. Secretary: (International) +61 2 4921 6042

email:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
email-for-life: [EMAIL PROTECTED]
personal webpage: www.telluricresearch.com/garry

Do not go where the path may lead, go instead where there is no path  
and leave a trail
   Ralph Waldo Emerson






___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] when will osx linker option -bundle be reflected in distutils

2008-12-08 Thread Robert Kern
On Mon, Dec 8, 2008 at 18:02, Garry Willgoose
[EMAIL PROTECTED] wrote:
 I was just wondering what plans there were to reflect the different
 linker options (i.e. -bundle instead of -shared) that are required on
 OSX in the fcompiler files within distutils. While its a minor thing
 it always catches the users of my software when they either install
 fresh or update numpy ... and sometimes on a bad day it even catches
 me ;-)

I'm sorry; I don't follow. What problems are you having?

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion