OpenWrt Forum Archive

Topic: where is libudev package?

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, we are trying to cross compile one of our Linux application. This app works on Ubuntu. We build our x86 Alix version OpenWRT from trunk. But cross compiling failed since lack of libudev package, developers need libudev.h header file. I've already include udev package but it no help. Can someone tell me what's the different between libudev and udev? (there is only very little post about libudev on internet)

Thanks

Shawn

(Last edited by akoei on 26 Aug 2010, 15:28)

It looks like the Makefile needs to be modified to create a libudev package.

With embedded systems becoming faster, and storage continues to grow, having full udev is an enormous advantage for some developers who need to manage dynamic devices. Hotplug2 is very nice, and very slick, but libudev has a good collection of helper functions to walk the sysfs tree, and it also allows programs to act on device events without using a system message bus or shell script rules (though you can use both if you like.) Makes programming for hotplugged devices braindead simple.


Since the udev package compiles libudev, and even moves it to the rootfs, packaging up libudev for development should be pretty simple.

In the udev Makefile, right before:

define Package/udev/install

paste:

define Build/InstallDev
    $(INSTALL_DIR) $(1)/usr/include
    $(CP) $(PKG_INSTALL_DIR)/usr/include/libudev.h $(1)/usr/include
    $(INSTALL_DIR) $(1)/lib
    $(CP) $(PKG_INSTALL_DIR)/lib/libudev.so* $(1)/lib
    $(INSTALL_DIR) $(1)/usr/lib
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/libudev.so $(1)/usr/lib
    $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
    $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libudev.pc $(1)/usr/lib/pkgconfig
endef

Then make package/udev/{clean,compile,install}

I was able to build an app which linked against libudev (-ludev). Note that I had to define a caveat in the program source before it would compile:

#include <stdio.h>
#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
#include <libudev.h>

Otherwise it will prevent you from using the library.


I haven't tested the app on the target itself, but since the udev package copies libudev over to the rootfs, I don't see why it wouldn't work.

(Last edited by aport on 6 Dec 2010, 19:24)

The discussion might have continued from here.