Build error for PyICU 2.2 with ICU 64.1 in Windows
ertas opened this issue · 11 comments
Hi,
I am trying to install PyICU of ver2.2 and got the following error on build:
measureunit.cpp(1790): error C2660: 'icu_64::number::FormattedNumber::toString': function does not take 0 arguments
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
I expect toString() method to work without any arguments, so I dont know why I got such an error. Full build log up to error can be found below.
Any help is appriciated
Hi again,
When I use PyICU 2.3, I got a different error:
measureunit.cpp(2019): error C2121: '#': invalid character: possibly the result of a macro expansion
measureunit.cpp(2019): error C2679: binary '=': no operator found which takes a right-hand operand of type 'icu_64::number::FormattedNumber' (or there is no acceptable conversion)
measureunit.cpp(2013): error C2143: syntax error: missing ';' before 'if'
measureunit.cpp(2019): error C2059: syntax error: '>='
measureunit.cpp(2025): fatal error C1019: unexpected #else
The odd thing is, in source file measurementunit.cpp, the preprocessor condition is in line 2018, so it is odd that it shows 2019 as the error line number.
Would you reccomend that I use PyICU 2.2 with an older ICU version (60 for ex), or do you anticipate an easy fix for it?
Thanks,
Mustafa
FWIW, there are up to date binaries at https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu
I can definitely try using previous versions of ICU and pyICU, but I also want to identify the problem. It seems to me there is something wrong with the compiler that Distutils use:
Under "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN" there are multiple cl.exe. When I try to call cl.exe on one of them I get the following result successfully:
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
However when I run that for the compiler that Distutils use, it throws a System Error that reads mspdb140.dll was not found.
PyICU_v2_3 build_err.txt
In this log as you can see python uses cl in path"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe"
I come to think that the error may be originating from that. Also there seems to be nothing wrong with the measurementunit.cpp:
#if U_ICU_VERSION_HEX >= VERSION_HEX(60, 0, 0)
UnicodeString u;
STATUS_CALL(u = icu::number::NumberFormatter::withLocale(
Locale::getDefault())
.unit(self->object->getUnit())
.unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
.formatDouble(self->object->getNumber().getDouble(), status)
#if U_ICU_VERSION_HEX >= VERSION_HEX(64, 0, 0)
.toString(status));
#else
.toString());
#endif
return PyUnicode_FromUnicodeString(&u);
#else
Python version is 3.5.4 for further information, Os is Win 10 but as I said they are probably irrelevant.
I will dig into the issue if I have more time.
Thank you Andi for the helpfull feedbacks
Mustafa
On Mon, 1 Apr 2019, Christoph Gohlke wrote:
Msvc doesn't like this kind of macros/preprocessor constructs:
It seems that is the root cause of the problem. When I deleted the nested macro (I asuumed a constant ICU version), I didnt get any error in build.
However I came across a link error this time. In which path is icuin.lib supposed to be generated, the linker couldnt find it.
I am unsure if I should install by pip'ing the tar file. (i.e. "pip install PyICU-2.3.tar"). Any more recommendations Andi?
Thank you!
Mustafa
Thank you Andi for the help.