Hi, how can I compile udev with cross compilation?
Hi,
I am currently building an linux system for arm board. I am stuck with udev. So can you help me with some commands to compile udev with cross compilation?
Thanks for your time
---------------------------
Huy
Quoted 5 lines · huyle
Hi,
I am currently building an linux system for arm board. I am stuck with udev. So can you help me with some commands to compile udev with cross compilation?
Thanks for your time
I am cross compiling udev, but not for the ARM.
The only trouble that I have encountered when cross compiling version 151 is with the configure scripts determination of the pci.ids file location. This is caused by autoconf's AC_CHECK_FILES macro generating an error when cross compiling. However, this can be worked around by setting
ac_cv_file__usr_share_pci_ids='no'
ac_cv_file__usr_share_hwdata_pci_ids='no'
ac_cv_file__usr_share_misc_pci_ids='no'
in the build system's environment before running configure and setting the configure script's --with-pci-ids-path argument.
I have had this work around for so long that I have not given it much thought. However, it is relatively easy to fix the configure script so that it only attempting to determine the pci.ids file location when --with-pci-ids-path is not set. Therefore, I have created and attached a patch that should do this. Of course, after applying, you would need to rerun autoconf or autoreconf.
configure.ac +4 -6
@@ -69,15 +69,13 @@ PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) AC_ARG_WITH(pci-ids-path, AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]), [PCI_DATABASE=${withval}], - [if test -n "$pciids" ; then - PCI_DATABASE="$pciids" - else + [AC_CHECK_FILES([/usr/share/pci.ids], [PCI_DATABASE=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [PCI_DATABASE=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [PCI_DATABASE=/usr/share/misc/pci.ids]) + if test -x "$PCI_DATABASE" ; then AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) fi]) AC_SUBST(PCI_DATABASE)
Quoted 22 lines · Paul Bender
Quoted 6 lines · huyle
Hi,
I am currently building an linux system for arm board. I am stuck with udev. So can you help me with some commands to compile udev with cross compilation?
Thanks for your timeI am cross compiling udev, but not for the ARM.
The only trouble that I have encountered when cross compiling version 151 is with the configure scripts determination of the pci.ids file location. This is caused by autoconf's
AC_CHECK_FILESmacro generating an error when cross compiling. However, this can be worked around by settingac_cv_file__usr_share_pci_ids='no'
ac_cv_file__usr_share_hwdata_pci_ids='no'
ac_cv_file__usr_share_misc_pci_ids='no'in the build system's environment before running configure and setting the configure script's --with-pci-ids-path argument.
Quoted 6 lines
I have had this work around for so long that I have not given it much thought. However, it is relatively easy to fix the configure script so that it only attempting to determine the pci.ids file location when --with-pci-ids-path is not set. Therefore, I have created and attached a patch that should do this. Of course, after applying, you would need to rerun autoconf or autoreconf.
I think it would be better to just make the AC_CHECK_FILES conditional on cross compiling:
if test $cross_compiling != yes; then
AC_CHECK_FILES...
else
# just assume pciids location
pciids=/usr/share/pci.ids
fiOtherwise, people cross compiling will bomb unless they pass --with-pci-ids-path. Likewise, you changed the 'test -n "$pciids"' to a 'test -x'. I don't know a lot of people with an executable pci database. Attached is a patch to do this.
--
Dan
From 779098c43b0c2f3b88dedea77dfc2e891fe39c26 Mon Sep 17 00:00:00 2001
From: Dan Nicholson <[email protected]>
Date: Sat, 20 Feb 2010 09:20:20 -0800
Subject: [PATCH] pci.ids: Fix PCI database checking for cross compiling
When cross compiling, AC_CHECK_FILES will error, so a default location is assumed in this case. A message is added to the end of the check to let the user know what udev has decided.
--- configure.ac | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
configure.ac +14 -4
@@ -69,17 +69,27 @@ if test "x$enable_extras" = xyes; then PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) + if test $cross_compiling = no; then + AC_CHECK_FILES([/usr/share/pci.ids], + [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], + [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], + [pciids=/usr/share/misc/pci.ids]) + else + # just assume location + pciids=/usr/share/pci.ids + fi AC_ARG_WITH(pci-ids-path, - AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]), + [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], [PCI_DATABASE=${withval}], [if test -n "$pciids" ; then PCI_DATABASE="$pciids" else AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) fi]) + AC_MSG_CHECKING([for PCI database location]) + AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
Signature · 1 line
1.6.6
Quoted 34 lines · Dan Nicholson
Quoted 22 lines · Paul Bender
Quoted 6 lines · huyle
Hi,
I am currently building an linux system for arm board. I am stuck with udev. So can you help me with some commands to compile udev with cross compilation?
Thanks for your timeI am cross compiling udev, but not for the ARM.
The only trouble that I have encountered when cross compiling version 151 is with the configure scripts determination of the pci.ids file location. This is caused by autoconf's
AC_CHECK_FILESmacro generating an error when cross compiling. However, this can be worked around by settingac_cv_file__usr_share_pci_ids='no'
ac_cv_file__usr_share_hwdata_pci_ids='no'
ac_cv_file__usr_share_misc_pci_ids='no'in the build system's environment before running configure and setting the configure script's --with-pci-ids-path argument.
Quoted 6 lines
I have had this work around for so long that I have not given it much thought. However, it is relatively easy to fix the configure script so that it only attempting to determine the pci.ids file location when --with-pci-ids-path is not set. Therefore, I have created and attached a patch that should do this. Of course, after applying, you would need to rerun autoconf or autoreconf.
I think it would be better to just make the
AC_CHECK_FILESconditional on cross compiling:if test $cross_compiling != yes; then
Quoted 8 lines
AC_CHECK_FILES...pci.ids not found, try --with-pci-ids-path else # just assume pciids location pciids=/usr/share/pci.ids fiOtherwise, people cross compiling will bomb unless they pass --with-pci-ids-path.
Unless I misunderstand AC_ARG_WITH, its third argument is for what to do when the corresponding --with configure argument is not provided, which is how it behaves in my build system (with autoconf 2.63). That is why I put the AC_CHECK_FILES in the third argument.
I like your patch better than mine as it does not generate the unhelpful error message:
"cannot check for file existence when cross compiling".
when the --with-pci-ids-path is not provided.
However, for cross compiling, it might be better to force the user to provide --with-pci-ids-path rather than assuming one since an incorrect assumed path would not be discovered until on target runtime.
Quoted 3 lines
Likewise, you changed the 'test -n "$pciids"' to
a 'test -x'. I don't know a lot of people with an executable pci database. Attached is a patch to do this.
Doh, that was supposed to be -z. Thanks for the catch.
Quoted 56 lines · Paul Bender
Quoted 43 lines · Dan Nicholson
Quoted 27 lines · Paul Bender
Quoted 6 lines · huyle
Hi,
I am currently building an linux system for arm board. I am stuck with udev. So can you help me with some commands to compile udev with cross compilation?
Thanks for your timeI am cross compiling udev, but not for the ARM.
The only trouble that I have encountered when cross compiling version 151 is
with the configure scripts determination of the pci.ids file location. This
is caused by autoconf'sAC_CHECK_FILESmacro generating an error when cross
compiling. However, this can be worked around by settingac_cv_file__usr_share_pci_ids='no'
ac_cv_file__usr_share_hwdata_pci_ids='no'
ac_cv_file__usr_share_misc_pci_ids='no'in the build system's environment before running configure and setting the
configure script's --with-pci-ids-path argument.Quoted 7 lines
I have had this work around for so long that I have not given it much thought. However, it is relatively easy to fix the configure script so that
it only attempting to determine the pci.ids file location when --with-pci-ids-path is not set. Therefore, I have created and attached a patch that should do this. Of course, after applying, you would need to rerun autoconf or autoreconf.I think it would be better to just make the
AC_CHECK_FILESconditional on cross compiling:if test $cross_compiling != yes; then AC_CHECK_FILES...pci.ids not found, try --with-pci-ids-path else
Quoted 6 lines
# just assume pciids location pciids=/usr/share/pci.ids fiOtherwise, people cross compiling will bomb unless they pass --with-pci-ids-path.
Unless I misunderstand
AC_ARG_WITH, its third argument is for what to do when the corresponding --with configure argument is not provided, which is how it behaves in my build system (with autoconf 2.63). That is why I put theAC_CHECK_FILESin the third argument.
Quoted 8 lines
I like your patch better than mine as it does not generate the unhelpful error message:
"cannot check for file existence when cross compiling".
when the --with-pci-ids-path is not provided.However, for cross compiling, it might be better to force the user to provide --with-pci-ids-path rather than assuming one since an incorrect assumed path would not be discovered until on target runtime.
Yeah, there's definitely a balance there. That's why I added the message so people would at least see what udev was going to use. I just prefer the "don't make people pass options to configure unless they definitely have to" approach. Could easily go both ways, though.
Quoted 5 lines
Quoted 3 lines
Likewise, you changed the 'test -n "$pciids"' to
a 'test -x'. I don't know a lot of people with an executable pci database. Attached is a patch to do this.Doh, that was supposed to be -z. Thanks for the catch.
With that fix I think either patch would be fine.
--
Dan