muodov / kociemba

A pure Python and pure C ports of Kociemba's algorithm for solving Rubik's cube
GNU General Public License v2.0
561 stars 126 forks source link

Compiling on Windows #27

Closed jarheadjoe closed 6 years ago

jarheadjoe commented 6 years ago

Hi,I'm a student. My computer environment is win8. I can download kociemba with pip . But I cant install it.How to solve it? Thank You.

muodov commented 6 years ago

I've never tried to compile the C version on Windows, and unfortunately I don't have a Windows environment to check this.

I would suggest two options:

1) use the pure Python version. You can just clone the repo and use the python package directly. Python version is slower, but it might still be acceptable if you are using a desktop PC or a laptop. 2) Solve the compilation errors. The C code is really basic, I expect that those errors should be easily solvable. Most probably it's just a matter of using correct compiler flags, and/or some minor source code change (e.g. adding semicolons). You can find the tips of how to build the code in README and Makefile. In case you go this way, please don't hesitate to create a pull request with your changes, that would be a valuable contribution!

jarheadjoe commented 6 years ago

Thank you for your hint. I have successfully compiled C code on Windows. I write a .h file named "unistd.h" since Windows doesn't have it. And I have changed the function mkdir() since Windows only needs one parameter in mkdir().

muodov commented 6 years ago

@jarheadjoe that's awesome! would you mind sharing via pull-request?

jarheadjoe commented 6 years ago

@muodov Of course. Thank you again

andiebc commented 6 years ago

@jarheadjoe I have had the same problem when trying to install kociemba on windows using pip, but I get ImportError: No module named _cffi_backend. How did you fix this problem?

jarheadjoe commented 6 years ago

Hi! I give up python version and try to compile the c version. It will work if u try to fix the problem while compiling(include<>and file read/write).Then using the.exe file will be ok.

horizonzzz commented 6 years ago

@jarheadjoe hi! I met the same problem. Can you tell me how to change the way to read and write the file?

jarheadjoe commented 6 years ago

@horizonzzz Hi,Debug it and you will find out it's the fopen() in "coordcube.c" when read the cache.

horizonzzz commented 6 years ago

@jarheadjoe Thank you for answering my question : ). I change the way to open the file as what you said in the pull requests. But I met another problem as the second issue said. "The first execution runs fine, the prune tables are calculated and the folder is created, a correct solution is displayed. However, if I run the program a second time, it crashes". It breaks when extracting pruning value. Can you give me some advice?

jarheadjoe commented 6 years ago

@horizonzzz Two places you can find the fopen() which are read AND write.

muodov commented 6 years ago

Fixed by https://github.com/muodov/kociemba/pull/31