[Cython] Bug: llabs not defined in vs2008

Stefan Behnel stefan_ml at behnel.de
Wed Sep 30 09:20:33 CEST 2015


Stefan Behnel schrieb am 30.09.2015 um 09:13:
> Hogan, Christopher schrieb am 30.09.2015 um 00:03:
>> I was trying to compile numpy v1.9.2 with Visual Studio 2008 and Cython
>> 0.23.1.  This worked fine with Cython 0.22.x, but in 0.23.1 there are
>> some changes in Cython/Utility/TypeConversion.c that seem to cause this
>> error:
>>
>> mtrand.obj : error LNK2019: unresolved external symbol llabs referenced
>> in function __pyx_pf_6mtrand_11RandomState_24 choice
>>
>> llabs is not available in vs2008, but it ends up taking that "#elif"
>> branch in TypeConversion.c and defining __Pyx_sst_abs to be llabs.  I
>> was able to fix this by swapping the order of the "#elif defined
>> (_MSC_VER) ..."  block with the "#elif defined (__STDC_VERSION__) ... "
>> block.
> 
> So, what you are saying is that VS-2008 is not C99 standards compliant
> (what a surprise) but claims to be? Are you passing any C compiler flags
> that requests C99 compliance?
> 
> The last changes in this area were here:
> 
> https://github.com/cython/cython/pull/403
> 
> The contributor claimed to be using MSVC 2008, too, so I wonder why you run
> into this problem but he didn't.
> 
> 
>> That probably won't fix the problem in all cases though.
> 
> To me, your proposed change seems a reasonable thing to do. What cases are
> you thinking of?

I applied your change for now, it's in the 0.23.x. maintenance branch:

https://github.com/cython/cython/commit/8bf936e5449592b8b69dd56c09640db8c0ab12ff

Stefan



More information about the cython-devel mailing list