Open sarnold opened 8 years ago
Hello and apologies for the late reply. I just pushed python-evdev 0.6.3 to pypi with a potential fix for this. You should now be able to use the --evdev-headers
option to the build_ecodes
distutils command. It can be done in one go:
python setup.py build \
build_ecodes --evdev-headers $SYSROOT/input.h:$SYSROOT/input-event-codes.h \
build_ext --include-dirs $SYSROOT/ \
install
With bitbake, you could just set the following in your recipe:
DISTUTILS_BUILD_ARGS = "build_ecodes --evdev-headers $STAGING_INCDIR/input.h:$STAGING_INCDIR/input-event-codes.h build_ext --include-dirs $STAGING_INCDIR/"
Please let me know if this works or if you have other ideas.
Kind regards, Georgi
That looks like it should work; I was actually making a patch for the version in krogoth branch (0.0.0) but I'll test newer one in meta-printing layer. Thanks!
Hi, I was facing a similar problem trying to build the python-evdev recipe in Yocto. Using the recipe and the patch found in the repo provided by @sarnold finally did the trick for me. Using the latest recipe found in the openembedded layer (python-evdev_0.6.4) and just adding the line @gvalkov proposed (if I understood correctly), unfortunately does not seem to work in my setup.
The patched version is still on krogoth branch in meta-printing (https://github.com/VCTLabs/meta-printing/tree/krogoth/recipes-devtools/python/python-evdev) but I believe openembedded master/morty has 0.6.4 with no patch. Is that what is failing for you? <= @platisd
If I followed you correctly, yes, the latest recipe (0.6.4) for Morty fails as do the others (i.e. the one for krogoth) that I tried. In particular I tried to build the recipe(s) with krogoth and jethro, failing on both occasions. However, it strangely seems that this is only happening when Yocto is running on Ubuntu 16.04! The 0.6.0 recipe (and possibly 0.6.4 as well, haven't tried yet) worked without the patch on our build server that runs Ubuntu 14.04! That being said, since many of our developers run the latest Ubuntu and often need to build locally, we still had to push the patch despite it not necessarily being needed by our build server.
What you're seeing is the current package finding the headers on the build host instead of the (correct) sysroot headers. If they happen to match closely enough, then it compiles; if not, then it doesn't. The DISTUTILS_BUILD_ARGS = blah thing in the recipe is probably easier than patching; can you try that with one or more -D args? Also if you just "bitbake
I think I tried that line and it did not give more interesting info with the extra -D's. I will try again on Monday just to be sure and let you know if I get something useful out of it! 👍
Try changing $STAGING_INCDIR to ${STAGING_INCDIR} maybe?
Otherwise I'll see if I can get the two fixes to converge...
Good catch about the brackets. Trying recipe 0.6.0 with Jethro running on Ubuntu 16.04 without the patch and with DISTUTILS_BUILD_ARGS = "build_ecodes --evdev-headers ${STAGING_INCDIR}/input.h:${STAGING_INCDIR}/input-event-codes.h build_ext --include-dirs ${STAGING_INCDIR}/"
added in it. It stopped failing on undeclared identifiers but now instead it complains about "build_ecodes" being an invalid command.
Edit: Changed the assignment from '=' to '?=' and stopped complaining about build_ecodes. However then I just got back to the initial error about the undeclared identifier.
If the build host kernel/linux-headers package provides the same headers as the embedded toolchain/sysroot, then all is fine. As soon as they diverge, it blows up. Since both setup.py and genecodes.py have the full path hardcoded, I made this patch for openembedded/yocto:
https://github.com/sarnold/meta-openembedded/blob/python-evdev-fix/meta-python/recipes-devtools/python/python-evdev/use-sysroot-headers.patch
In the above patch, STAGING_INCDIR is specific to the bitbake build environment, and I didn't want to try mind-reading (since that never works anyway) so what ideas might you have for a generic fix? Something like adding a (normally empty) SYSROOT var in front of the header path (sort of like DESTDIR) might be enough.
Basically a way to configure the header path with a local prefix.