[Nfd-dev] Issue in running NDN/NFD on router using OpenWRT

Mathias Gibbens gibmat at cs.arizona.edu
Wed Oct 28 14:39:23 PDT 2015


Hello Lohith,

  I spent some time investigating the issue you're seeing. What's
happened is that the trunk for OpenWRT was switched to a new C library
(musl, http://www.musl-libc.org/) from the older uClib back in June.
This was done after the branch for OpenWRT 15.05 (Chaos Calmer) was
created. Thus, the current release of OpenWRT still uses uClib. However,
when you cross compiled ndn-cxx/NFD it linked against the new musl
library. This obviously won't be on the router, thus you're getting an
error.

  You can still tell the OpenWRT build system to use the uClib library
instead. In your OpenWRT working directory, run `make menuconfig`, then
traverse this path in the menus (you will first have to enable the
options before selecting them):

Advanced configuration options (for developers) --->
    Toolchain Options --->
        C Library implementation (Use musl) --->
            Use uClib

  Then, re-run `make`. It will have to recompile everything, since the C
library was changed. Once that is done, you'll now have two cross
compile toolchains setup, one using musl and the other using uClib. Set
your environment variables to the uClib one and you should be fine.

  Please let me know if changing the C library fixes the problem you're
seeing. I'll be updating the wiki page with this information as well, so
others aren't caught by the same bug.

Thanks,
Mathias

  PS - For those who are interested in how I figured this out, I'll
briefly outline what I did.

  First, I attempted to reproduce the error that Lohith saw. I did a
fresh checkout of the OpenWRT cross compile code and while it was
compiling the toolchain I flashed a clean version of OpenWRT 15.05 to a
router.

  I then got the exact same error that was reported when I tried to run
NFD on the router. Unfortunately there aren't any simple development
tools on the router, such as `ld` or `file`. So, I hunted for a binary
that was already on the router (/bin/jshn) and copied it to my computer,
since I wanted to compare the output of the `file` command. I saw this:

        $ file jshn
        jshn: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1,
        dynamically linked, interpreter /lib/ld-uClibc.so.0, corrupted
        section header size
        
        $ file nfd
        nfd: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1,
        dynamically linked, interpreter /lib/ld-musl-mips-sf.so.1, not
        stripped

  You can see that the interpreter for the router's binary and the nfd
binary are different. I did some searching on Google and found that the
default C library for OpenWRT has changed.

  Finally, just to confirm things, I copied the musl C library over to
the router and tried running NFD once more. This time it at least began
executing, although there were several symbol errors due to some
different library versions and using a different C library.

On Wed, 2015-10-28 at 10:33 -0400, Lohith L wrote:
> Hello,
> 
> 
> Please find the details of the issue below:
> 
> 
> 1. I have followed the steps mentioned in the below link to
> cross-compile NDN/NFD. [Result - Success]
> http://redmine.named-data.net/projects/ndn-embedded/wiki/Cross-compiling_NDN_projects_for_home_routers
> 
> 2. Also, Installed OpenWrt to router using the instructions mentioned
> in the below link.
> http://wiki.openwrt.org/toh/tp-link/tl-wdr7500
> 
> 3. The cross-compiled binaries (ndn-crosscompile/usr/bin and
> NFD-crosscompile/usr/bin) are then copied to router (/usr/bin).
> Similar way libraries are copied to proper places.
> 
> 4. Now, If I try to run '/usr/bin/nfd' or '/usr/bin/ndnsec' on router,
> it says "not found").
> 
> 
> Could you please let me know what is going wrong? Is the procedure of
> copying cross-compiled binaries from local machine to router is right?
> 
> 
> 
> Below are hardware and software version details:
> 
> Router: TP-Link AC1750 Archer C7
> 
> OpenWrt installed on router: Chaos Calmer 15.05
> 
> ndn version: 0.3.4
> 
> nfd version: 0.3.4
> 
> OpenWrt branch used to crosscompile from git:
> git://git.openwrt.org/openwrt
> 
> It would be great if you could help me with this issue. I am currently
> stuck with this!
> 
> Let me know if anything is unclear
> 
> 
> 
> Thanks & Regards,
> 
> Lohith
> 
> _______________________________________________
> Nfd-dev mailing list
> Nfd-dev at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev





More information about the Nfd-dev mailing list