Giter Site home page Giter Site logo

Comments (15)

rtobar avatar rtobar commented on June 28, 2024

Hi,

Sorry for taking so long to respond. We don't usually build software against Visual Studio (we usually build in Linux/OSX), but if you wanted to offer some patches that would enable that I would be happy to incorporate them.

I don't understand fully the errors you are receiving (an english version would be great!), but from what I read only I think the core problem is that Visual Studio does not support x86 inline assembly, which is what we use. Instead, one needs to use the x86 intrinsics, but this would need some effort and testing. Again, if you are willing to undertake this and come back with a working solution it would be great.

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

rtobar,

Thanks for your detailed answer. I didn't find the instruction about your software operating system, so I tried in Windows. I will try your software in Linux. I'm not very familiar about the inline assembly, hence, I can't work on it now, maybe I will try in the future! :)

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

Good point about the missing information on supported operating systems/compilers. I will add a note in the README to clarify this so it is more clear to people in the future.

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

It's kind of you to make this change. I will try MinGW under windows.

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

Great, let me know how it goes!

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

I have tried MinGW, but still have problems!
I installed MinGW gcc compiler in win10 and tried "pip install crc32c", then came like this:

PS C:\Users\guoyi\Desktop\crc32c-master> pip install crc32c
Collecting crc32c
Using cached https://files.pythonhosted.org/packages/db/81/f48320a779492fb74493cdf5d4b140cc814f2080f908dfed9070c5df3730/crc32c-1.2.tar.gz
Building wheels for collected packages: crc32c
Running setup.py bdist_wheel for crc32c ... error
Complete output from command c:\users\guoyi\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;file='C:\Users\guoyi\AppData\Local\Temp\pip-install-cxsxrbwk\crc32c\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\guoyi\AppData\Local\Temp\pip-wheel-mjlkb5gg --python-tag cp36:
running bdist_wheel
running build
running build_ext
building 'crc32c' extension
creating build
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c _crc32c.c -o build\temp.win32-3.6\Release_crc32c.o
In file included from c:\users\guoyi\appdata\local\programs\python\python36-32\include/Python.h:68:0,
from _crc32c.c:30:
c:\users\guoyi\appdata\local\programs\python\python36-32\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
c:\users\guoyi\appdata\local\programs\python\python36-32\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c crc32c.c -o build\temp.win32-3.6\Release\crc32c.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c checksse42.c -o build\temp.win32-3.6\Release\checksse42.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c consume.c -o build\temp.win32-3.6\Release\consume.o
consume.c:31:24: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>
^
compilation terminated.
error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1


Failed building wheel for crc32c
Running setup.py clean for crc32c
Failed to build crc32c
Installing collected packages: crc32c
Running setup.py install for crc32c ... error
Complete output from command c:\users\guoyi\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;file='C:\Users\guoyi\AppData\Local\Temp\pip-install-cxsxrbwk\crc32c\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\guoyi\AppData\Local\Temp\pip-record-kt9qghx_\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'crc32c' extension
creating build
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c _crc32c.c -o build\temp.win32-3.6\Release_crc32c.o
In file included from c:\users\guoyi\appdata\local\programs\python\python36-32\include/Python.h:68:0,
from _crc32c.c:30:
c:\users\guoyi\appdata\local\programs\python\python36-32\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
c:\users\guoyi\appdata\local\programs\python\python36-32\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c crc32c.c -o build\temp.win32-3.6\Release\crc32c.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c checksse42.c -o build\temp.win32-3.6\Release\checksse42.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -Ic:\users\guoyi\appdata\local\programs\python\python36-32\include -c consume.c -o build\temp.win32-3.6\Release\consume.o
consume.c:31:24: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>
^
compilation terminated.
error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1

----------------------------------------

Command "c:\users\guoyi\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;file='C:\Users\guoyi\AppData\Local\Temp\pip-install-cxsxrbwk\crc32c\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\guoyi\AppData\Local\Temp\pip-record-kt9qghx_\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\guoyi\AppData\Local\Temp\pip-install-cxsxrbwk\crc32c\

It seems that "sys/socket.h" is not supported under WinAPI, I switch it to "winsock2.h" and try "python setup.py install", but still can not work:

PS C:\Users\guoyi\Desktop\crc32c-master> python setup.py install
running install
running bdist_egg
running egg_info
writing crc32c.egg-info\PKG-INFO
writing dependency_links to crc32c.egg-info\dependency_links.txt
writing top-level names to crc32c.egg-info\top_level.txt
reading manifest file 'crc32c.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'crc32c.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_ext
building 'crc32c' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c _crc32c.c -o build\temp.win32-3.6\Release_crc32c.o
In file included from C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/Python.h:68:0,
from _crc32c.c:30:
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c crc32c.c -o build\temp.win32-3.6\Release\crc32c.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c checksse42.c -o build\temp.win32-3.6\Release\checksse42.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c consume.c -o build\temp.win32-3.6\Release\consume.o
consume.c: In function '_crc32c_read_crc_write':
consume.c:50:22: warning: implicit declaration of function 'fcntl' [-Wimplicit-function-declaration]
int orig_in_flags = fcntl(fd_in, F_GETFL);
^~~~~
consume.c:50:35: error: 'F_GETFL' undeclared (first use in this function)
int orig_in_flags = fcntl(fd_in, F_GETFL);
^~~~~~~
consume.c:50:35: note: each undeclared identifier is reported only once for each function it appears in
consume.c:51:22: error: 'F_SETFL' undeclared (first use in this function)
stat = fcntl(fd_in, F_SETFL, orig_in_flags & ~O_NONBLOCK );
^~~~~~~
consume.c:51:48: error: 'O_NONBLOCK' undeclared (first use in this function)
stat = fcntl(fd_in, F_SETFL, orig_in_flags & ~O_NONBLOCK );
^~~~~~~~~~
consume.c:57:2: error: unknown type name 'socklen_t'
socklen_t size = sizeof(to);
^~~~~~~~~
consume.c:60:52: warning: passing argument 4 of 'getsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
stat = getsockopt(fd_in, SOL_SOCKET, SO_RCVTIMEO, &original_to, &size);
^
In file included from c:\mingw\include\winsock2.h:62:0,
from consume.c:32:
c:\mingw\include\winsock.h:588:32: note: expected 'char *' but argument is of type 'struct timeval *'
WINSOCK_API_LINKAGE int PASCAL getsockopt (SOCKET, int, int, char *, int *);
^~~~~~~~~~
consume.c:65:52: warning: passing argument 4 of 'setsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
stat = setsockopt(fd_in, SOL_SOCKET, SO_RCVTIMEO, &to, size);
^
In file included from c:\mingw\include\winsock2.h:62:0,
from consume.c:32:
c:\mingw\include\winsock.h:599:32: note: expected 'const char *' but argument is of type 'struct timeval *'
WINSOCK_API_LINKAGE int PASCAL setsockopt (SOCKET, int, int, const char *, int);
^~~~~~~~~~
consume.c:106:45: warning: passing argument 4 of 'setsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
setsockopt(fd_in, SOL_SOCKET, SO_RCVTIMEO, &original_to, size);
^
In file included from c:\mingw\include\winsock2.h:62:0,
from consume.c:32:
c:\mingw\include\winsock.h:599:32: note: expected 'const char *' but argument is of type 'struct timeval *'
WINSOCK_API_LINKAGE int PASCAL setsockopt (SOCKET, int, int, const char *, int);
^~~~~~~~~~
error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1

**I wonder if this problem can be simply solved. **

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

Hi,

Yes, that seems completely unrelated to the previous error you were having with the Visual Studio compiler, and more related to Windows itself. I will try to put a fix on a different branch, would you be able to try it out and let me know if it works? If it does then I will merge it to the master branch.

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

I have just pushed a commit to a new windows-fix branch, could you try that?

If you have a local copy of the git repository already, you should be able to do:

git pull
git checkout -b windows-fix origin/windows-fix
python setup.py install

Please let me know how it goes and I will merge to the master branch and upload a new release to PyPI if everything goes well. The Windows version simply does not include the problematic code, but that code was always an experiment I did and never really intended it to stay (so I will probably remove it later also from the other operating systems).

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

I tried just now, it still can not be installed, and seems the same problem.

PS C:\Users\guoyi\Desktop\crc32c-windows-fix> python setup.py install
running install
running bdist_egg
running egg_info
writing crc32c.egg-info\PKG-INFO
writing dependency_links to crc32c.egg-info\dependency_links.txt
writing top-level names to crc32c.egg-info\top_level.txt
reading manifest file 'crc32c.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'crc32c.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_ext
building 'crc32c' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c _crc32c.c -o build\temp.win32-3.6\Release_crc32c.o
In file included from C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/Python.h:68:0,
from _crc32c.c:30:
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c crc32c.c -o build\temp.win32-3.6\Release\crc32c.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c checksse42.c -o build\temp.win32-3.6\Release\checksse42.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c consume.c -o build\temp.win32-3.6\Release\consume.o
consume.c:31:24: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>
^
compilation terminated.
error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

Can you confirm you are using the code form the new windows-fix branch? Do you see, for example, a file called common.h?

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

Sorry for taking so long to respond! I'm sure about that, I think the problem comes from consume.c which still in th windows-fix branch.

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

Hi! You are right, the initial fix I put in place was bogus. I just pushed again to the windows-fix branch, hopefully this time with the correct bits and pieces. Could you pull and try once again? Thanks!

from crc32c.

cmdbln avatar cmdbln commented on June 28, 2024

Great!

running install
running bdist_egg
running egg_info
creating crc32c.egg-info
writing crc32c.egg-info\PKG-INFO
writing dependency_links to crc32c.egg-info\dependency_links.txt
writing top-level names to crc32c.egg-info\top_level.txt
writing manifest file 'crc32c.egg-info\SOURCES.txt'
reading manifest file 'crc32c.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'crc32c.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_ext
building 'crc32c' extension
creating build
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c _crc32c.c -o build\temp.win32-3.6\Release_crc32c.o
In file included from C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/Python.h:68:0,
from _crc32c.c:30:
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c crc32c.c -o build\temp.win32-3.6\Release\crc32c.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c checksse42.c -o build\temp.win32-3.6\Release\checksse42.o
C:\MinGW\bin\gcc.exe -mdll -O -Wall -I. -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\include -c consume.c -o build\temp.win32-3.6\Release\consume.o
writing build\temp.win32-3.6\Release\crc32c.cp36-win32.def
creating build\lib.win32-3.6
C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-3.6\Release_crc32c.o build\temp.win32-3.6\Release\crc32c.o build\temp.win32-3.6\Release\checksse42.o build\temp.win32-3.6\Release\consume.o build\temp.win32-3.6\Release\crc32c.cp36-win32.def -LC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\libs -LC:\Users\guoyi\AppData\Local\Programs\Python\Python36-32\PCbuild\win32 -lpython36 -lvcruntime140 -o build\lib.win32-3.6\crc32c.cp36-win32.pyd
creating build\bdist.win32
creating build\bdist.win32\egg
copying build\lib.win32-3.6\crc32c.cp36-win32.pyd -> build\bdist.win32\egg
creating stub loader for crc32c.cp36-win32.pyd
byte-compiling build\bdist.win32\egg\crc32c.py to crc32c.cpython-36.pyc
creating build\bdist.win32\egg\EGG-INFO
copying crc32c.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying crc32c.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying crc32c.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying crc32c.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
writing build\bdist.win32\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
pycache.crc32c.cpython-36: module references file
creating dist
creating 'dist\crc32c-1.2-py3.6-win32.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing crc32c-1.2-py3.6-win32.egg
creating c:\users\guoyi\appdata\local\programs\python\python36-32\lib\site-packages\crc32c-1.2-py3.6-win32.egg
Extracting crc32c-1.2-py3.6-win32.egg to c:\users\guoyi\appdata\local\programs\python\python36-32\lib\site-packages
Adding crc32c 1.2 to easy-install.pth file

Installed c:\users\guoyi\appdata\local\programs\python\python36-32\lib\site-packages\crc32c-1.2-py3.6-win32.egg
Processing dependencies for crc32c==1.2
Finished processing dependencies for crc32c==1.2

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

That is great news, I will merge the changes to the master branch, produce a new version and upload it to PyPI.

from crc32c.

rtobar avatar rtobar commented on June 28, 2024

I've uploaded a new 1.3 version of this package to PyPI with these fixes, so installing via pip should now be possible using MinGW.

from crc32c.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.