[SciPy-user] OS X build problems with non-Apple python -- diagnosis and solution

Robert Kern rkern at ucsd.edu
Fri Mar 11 19:48:33 CST 2005

Zachary Pincus wrote:
> Hello folks,
> I've run into some trouble building scipy for OS X. Fortunately, I've  
> got it mostly licked, so I thought I'd explain how.
> The issues were two:
> (1) A problem with g77 and the -bundle switch. This switch must not be  
> used at the beginning of the command line.
> (2) The linker not being pointed at the correct set of python libraries  
> for non-Apple python installs.
> Here are the details:
> Note that I'm following the Christopher Fonnesbeck's directions  
> (http://www.scipy.org/documentation/Members/fonnesbeck/osx_build.txt )  
> exactly, except that I've used Fink to install python. All other  
> packages were manually installed. I'm using a CVS checkout of SciPy  
> from today.
> The first problem that I encountered was in building the various  
> fortran libs with g77. (Full error text below as #1). The gist of the  
> error is that g77 reports "couldn't run  
> `/usr/local/bin/undle-gcc-3.4.2': No such file or directory". This  
> problem turns out to be due to the (insane) fact that g77 has a "-b  
> MACHINE" switch that is only honored if it is the first element on the  
> command line.

Oh, *fantastic*.

> So 'g77 -bundle' makes the compiler look for the  
> executable undle-gcc-3.4.2. The solution is to put something before the  
> '-bundle' switch. I used -WALL because it's relatively harmless. (See:  
> http://www.mail-archive.com/fink-devel@lists.sourceforge.net/ 
> msg10604.html )
> So it's important to make sure that -bundle is not the first switch. I  
> suspect that this problem has not cropped up before because users  
> without Fink-installed python will get a '-framework' switch before the  
> -bundle switch. However, this might change in the future; as such it  
> would be a good idea to explicitly make sure that -bundle is never  
> first in the g77 command.
> The second problem that I ran into was precisely the same issue that  
> Christopher reported last year  
> (http://www.scipy.net/pipermail/scipy-user/2004-February/002576.html ).  
> That is, the linker was not finding the python libraries to link to the  
> fortran libraries. The solution proffered at that time  
> (http://www.scipy.net/pipermail/scipy-user/2004-February/002587.html )  
> was to add specific switches to the compiler options for darwin.  
> Unfortunately, these switches are specific for the apple-installed  
> python framework. If a user has manually installed a new python (or has  
> had fink do so for them), this fails. (see Error #2 below) I believe  
> the python distutils provide a unified method to find out the correct  
> libraries to link to, in order to avoid these sort of problems.

I think the answer to both of your problems is to keep the "-undefined 
dynamic_lookup" first for both framework and non-framework builds. 
Google says it should work for Fink Python, too.

Try current CVS, please, and report back.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the SciPy-user mailing list