C++ Experiences on LinkSys WRT54GL

Discussion in 'Cisco/Linksys Wireless Routers' started by pbtran, Jan 18, 2006.

  1. pbtran

    pbtran Network Guru Member


    I just got a new WRT54GL router which is just a repackaged WRT54 v4 with "L" for Linux.

    I'm trying to run an embedded C++ HTTP daemon similar to the default httpd one included by default but mines supports WebDAV (Web Distributed Authoring and Version) protocol (foot print is ~394 KB stripped).

    I was able to compile using the mipsel-linux-g++ compiler, but I'm getting compile errors when using the default mipsel-uclibc-gcc v0.9.19 since there's no C++ STL, such as multimap, vector, etc.

    e.g. Comparing C verus C++ Hello World program running on WRT54GL v4.30.1 (running telnetd):

    # test1 is a C++ Hello World program
    test1: ELF 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV), for GNU/Linux 2.2.15, dynamically linked, stripped
    # test2 is a C Hello World program
    test2: ELF 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV), dynamically linked, stripped

    Running it on the WRT54GL v4 via telnet:
    # ./test1 (C++ version)
    ./test1: not found
    # ./test2 (C version)
    Hello World!

    I know that there's a version of uclibc++ tool v0.1.12. Has anyone been able to compile C++ program using uclibc++ and run it on the WRT54G/GL v4 firmware.
  2. __nbd

    __nbd Network Guru Member

    I'd recommend switching to OpenWrt. Not only does it use newer toolchains and libraries, it also has some useful developer tools that make porting applications about as easy as it gets.
    There are also several examples of ported C++ applications like Kismet and nmap, which also use uClibc++ on OpenWrt.
  3. pbtran

    pbtran Network Guru Member

    I have HyperWRT + tofu v12 installed and tried to build cross compile with latest version of uclibc++, but was unsuccessful. I did manage to download and build the latest "stable" RC4 release of OpenWRT (aka "white russain").

    Is there any sample Makefile for add customized C++ apps?


  4. __nbd

    __nbd Network Guru Member

    If you want to know what special CFLAGS and LDFLAGS should be added, have a look at our package directory for nmap or kismet. If you want to know how to put the source files into the package directory instead of downloading from an external source, have a look at the robocfg package directory.
  5. pbtran

    pbtran Network Guru Member

    Thanks for the tip, __nbd!!! I was able to compile all src into obj files with a customized Makefile (using nmap sample) under the OpenWRT-SDK-Linux-i686-1's package dir that configures and calls another customized Makefile for my C++ app; but I get link errors.

    I used mipsel-linux-uclibc-ar and mipsel-linux-uclibc-ranlib to create an archived library called "libofx.a" for easier linking and got the following errors:

    /home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-g++ -o ofxdb ofx_db.cc -fPIC -g -O3 -Wall -Wno-deprecated -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I. -I./ -I/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include -I/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include -nodefaultlibs -luClibc++ -lc -lm -lstdc++ -L. -L./ -L/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib -L/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib -lofx
    ./libofx.a(_ofxdb.o):/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/package/ofx/fx-3.0/_ofxdb.cc:140: undefined reference to `log2'
    ./libofx.a(_index.o):/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/package/ofx/fx-3.0/_index.cc:427: undefined reference to `ceilf'
    ./libofx.a(_index.o):/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/package/ofx/fx-3.0/_index.cc:427: undefined reference to `floorf'
    ./libofx.a(_query.o):/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/package/ofx/fx-3.0/_query.cc:430: undefined reference to `ceilf'
    ./libofx.a(_query.o):/home/pbtran/LinkSys/OpenWrt-SDK-Linux-i686-1/package/ofx/fx-3.0/_query.cc:431: undefined reference to `ceilf'
    collect2: ld returned 1 exit status
    make: *** [ofxdb] Error 1

    The funny thing is that I see the references using "strings" command (and this compiles and links fine on Linux RH ES 4 and on MacOS 10.4) :

    [pbtran@linux fx-3.0]$ strings libofx.a | grep -i log2
    [pbtran@linux fx-3.0]$ strings libofx.a | grep -i ceilf
  6. __nbd

    __nbd Network Guru Member

    See my reply in the OpenWrt forum ...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice