[SciPy-Dev] [SciPy-User] pip install scipy: error adding symbols: bad value

Daπid davidmenhur at gmail.com
Fri Dec 11 07:52:53 EST 2015


Moving this to Scipy-dev

On 10 December 2015 at 20:52, Charles R Harris <charlesr.harris at gmail.com>
wrote:

>
> On Thu, Dec 10, 2015 at 2:41 AM, Daπid <davidmenhur at gmail.com> wrote:
>
>>
>> On 9 December 2015 at 17:11, David Cournapeau <cournape at gmail.com> wrote:
>>
>>> You may have CFLAGS/CXXFLAGS defined, which override the distutils
>>> flags. Unset those (or append `-fPIC` to them)
>>
>>
>> I figured this one out. The culprit is actually FFLAGS. You can set
>> CFLAGS and CXXFLAGS freely.
>>
>> I noticed that Numpy compiled just fine, but produced errors with f2py;
>> and the errors in Scipy's installation arise when gfortran is invoked.
>> Also, last week I was building some FORTRAN, and I set the corresponding
>> flags; hence the problem. Unsetting FFLAGS fixed the issue (but setting it
>> to the empty string didn't!).
>>
>> I confirm that distutils is just appending my CFLAGS to the preset ones,
>> which seems to me a sane behaviour. I think f2py should do the same.
>>
>
> Please open an numpy issue for this.
>
>
https://github.com/numpy/numpy/issues/6809

Pauli Virtanen pointed out that that has been considered a feature (
https://github.com/numpy/numpy/issues/1171):

"The reason we need to override these flags is because Fortran compilers
change. We don't always have the most up-to-date set of flags that a
particular Fortran compiler needs to link a Python extension. The presence
of incorrect flags completely prevents the extension from being built
correctly. Consequently, we need a way to completely override the flags. In
the current incarnation of numpy.distutils, this is LDFLAGS and friends."
(Robert Kern, 2007).

That was 7 years ago, are FORTRAN compilers still that unstable? If that is
the case, I think a workaround would be to print a warning before
overwriting, printing the minimum set of flags that we think are required,
so in case it fails, the user has a bit more information. Another option I
believe would behave more as expected is to append FFLAGS, and overwrite
NUMPY_FFLAGS (or bikesheded equivalent) instead. This scheme would also
allow to overwrite C(XX)FLAGS, that are currently not overwritten
(distutils/setuptools allowing).


Thanks,

/David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20151211/09e7619a/attachment.html>


More information about the SciPy-Dev mailing list