-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compilation error in psutil/_psutil_linux.c when including ethtool.h #659
Comments
can you provide a patch / PR? |
Adding following code to psutil/_psutil_linux.c before #include < linux/ethtool.h > will work for me (hoping it will not break things on other Unix platforms)
|
It seems https://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/include/linux/types.h should define those types. |
Hi, Your suggested fix doesn't work in my environment. Getting the same error. In my environment /usr/include/linux/types.h includes /usr/include/asm/types.h which includes /usr/include/asm-x86_64/types.h or /usr/include/asm-i386/types.h based on the platform. Another way it to workaround asm-x86_64/types.h by adding the following code to _psutil_linux.c before the first #include in that file: #ifdef KERNEL But I don't really like it. I think that my first suggestion is the most generic. Thanks, |
I found the first workaround (with the typedefs) in the web. Maoz |
I took a look at that net-snmp fix and it looks like they are relying on a compile time flag. |
@mrjefftang can you please make a PR based on mrjefftang@b82b8be? Or you can also commit it directly. |
I haven't made a PR because that commit didn't work. It relies on a compiler time flag. |
Maybe you can do like ./configure does when building a C++ applications. psutil/_psutil_linux.c will look like:
And in setup.py, you will check if to define ETHTOOL_MISSING_TYPES. Something like:
Where psutil/_test_ethtool.c looks like:
|
I don't particularly like the solution of compiling a separate C file in setup.py buy I've extensively searched for a solution and couldn't find any. I committed a variant of your patch as of b8adcd7. Can you please confirm it works? |
It works! There is one cosmetic fix that you might want to do. |
Done in 8d66475. |
* giampaolo/master: (34 commits) pre-release updates try to fix appveyor failure refactor setup.py + fix Makefile fix OSX test failure linux / setup.py: do not print warnings giampaolo#675: [Linux] net_connections(); UnicodeDecodeError may occur when listing UNIX sockets move unicode tests so that they are executed on all platforms skip failing test on appveyor try to fix appveyor failure test refactoring+ try to fix appveyor failures open files by using sys.getfilesystemencoding() + refactor stuff giampaolo#675: try to fix encoding issue fix python 3 compilation error giampaolo#659: [Linux] compilation error on Suse 10. (patch by maozguttman) make flake8 happy fix giampaolo#644: add support for CTRL_* signals on Windows str-encode NIC names always return encoded strings instead of unicode giampaolo#650: make cmdline() handle unicode on python 2 ...
Hi,
I was trying to build psutil 3.1.1 and got compilation errors from psutil/_psutil_linux.c:
/usr/include/linux/ethtool.h:18:2: error: expected specifier-qualifier-list before 'u32'
The problem is that u32 is undefined in /usr/include/linux/ethtool.h.
ethtool.h looks like: https://www.kernel.org/pub/linux/kernel/people/marcelo/linux-2.4/include/linux/ethtool.h
It has no #include statements in it.
I am using: SUSE 10, Kernel 2.6.16.60
Thanks,
Maoz
The text was updated successfully, but these errors were encountered: