idies / pyJHTDB

Python wrapper for the Johns Hopkins turbulence database library
Apache License 2.0
100 stars 47 forks source link

Compile error under windows #15

Closed timofeymukha closed 8 years ago

timofeymukha commented 8 years ago

Hello!

I am trying to install the package under Windows 10 using pip. I use Anaconda and I have a python 3.5 and 2.7 environment. In both of them I get the following error:

C/local_tools.c(319): error C2106: '=': left operand must be l-value

Any tips?

chichilalescu commented 8 years ago

Hello,

I have no idea why you would get this error. On lines 317 through 319 of local_tools.c an assignment is made to the variable "rad1" declared on line 295. As far as I can tell, the code is perfectly fine. Can you please give us your compiler info?

timofeymukha commented 8 years ago

Hi!

I have been following these recommendations https://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/#for-python-3-5

So for python 3.5.2 I have installed the community edition of Visual Studio 2015. The part of the output from "pip install" with the error follows below.

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iturblib -IC:\Anaconda3\include -IC:\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcC/local_tools.c /Fobuild\temp.win-amd64-3.5\Release\C/local_tools.obj local_tools.c C/local_tools.c(41): warning C4305: 'initializing': truncation from 'double' to 'float' C/local_tools.c(72): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(84): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(88): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(89): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(90): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(146): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(157): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(161): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(162): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(163): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(190): error C2059: syntax error: 'constant' C/local_tools.c(209): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(220): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(224): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(225): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(226): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(229): warning C4244: '=': conversion from 'double' to 'int', possible loss of data C/local_tools.c(229): error C2106: '=': left operand must be l-value C/local_tools.c(295): error C2059: syntax error: 'constant' C/local_tools.c(312): warning C4244: '=': conversion from 'double' to 'float', possible loss of data C/local_tools.c(319): warning C4244: '=': conversion from 'double' to 'int', possible loss of data C/local_tools.c(319): error C2106: '=': left operand must be l-value error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

chichilalescu commented 8 years ago

ok... this is looking more and more weird. Could you please check that there is no predefined variable named "rad1" in MVS14.0? The first error that I see is that on line 190 there is a "constant". On line 190 I just declare a bunch of variables, I fail to see any constant there, but maybe visual studio has something predefined. I'm sorry for not being more helpful, but I think this is the first time I hear of someone trying to compile this package for Windows, so there's really no experience I can draw upon.

timofeymukha commented 8 years ago

It appears to be a Microsoft thing.. From here (the link text says it all): http://lolengine.net/blog/2011/3/4/fuck-you-microsoft-near-far-macros

"One day I defined a function that took parameters measured in radians called "rad1" and "rad2". Turns out that Microsoft has #defined rad1 0x0420 and rad2 0x0421."

Probably this is still the case.. I realize that Windows users might not be a high priority for you but I would really appreciate a patch!

sshamilton commented 8 years ago

Timofey, I'm going to try and look into this today. I have a windows machine with Visual Studio that I should be able to test/fix this with.

Thanks for letting us know. Stephen

On Tue, Sep 20, 2016 at 5:03 PM, Timofey Mukha notifications@github.com wrote:

It appears to be a Microsoft thing.. From here (the link text says it all): http://lolengine.net/blog/2011/3/4/fuck-you-microsoft-near-far-macros

"One day I defined a function that took parameters measured in radians called "rad1" and "rad2". Turns out that Microsoft has #defined rad1 0x0420 and rad2 0x0421."

Probably this is still the case.. I realize that Windows users might not be a high priority for you but I would really appreciate a patch!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/idies/pyJHTDB/issues/15#issuecomment-248433661, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb9jGb9wmC-N4xoYEZnC-VPM5_6lUN_ks5qsEo2gaJpZM4KAc3s .

chichilalescu commented 8 years ago

Hi again,

Timofey, could you please try out the latest commit on "master"? I renamed the rad1 variables. @sshamilton, I think my fix will work, but if it turns out to be more complicated, I will ask for your help :)

chichilalescu commented 8 years ago

@timofeymukha, I assume the fix worked, since you haven't said anything about it. I'm going to close the issue; feel free to reopen if there's something wrong.