OpenWrt Forum Archive

Topic: linking taglib without libstdc++

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

Hi,

I'm trying to build a small application which uses taglib. For some reason, the resulting application is linked to both libstdc++ and uclibc++.
Does anyone know what I'm doing wrong ?
I'm using the current revision (r15955) of kamikaze

A sample application which only uses uclibc++:

#include <string>
#include <stdio.h> 
#include <zlib.h>

int main(void)
{
    z_stream strm;
    strm.zalloc = Z_NULL;
    strm.zfree  = Z_NULL;
    strm.opaque = Z_NULL;
    int level = 1;
    int ret = deflateInit(&strm, level);

    char str[200];
    sprintf(str, "deflateInit returns %i\n", ret );
    std::string s2(str);    //just to make sure uclibc++ is used
    printf( s2.c_str() );
}

According to ldd (run on the target device) this only uses clibc++.
My test application for taglib:


#include <string>
#include <stdio.h> 

//taglib:
#include <fileref.h>
#include <tag.h>
#include <mpegfile.h>

int main(void)
{
    //just call it to link against it, don't expect it to do anything:
    TagLib::MPEG::File f("dummy.mp3");

    std::string st("hello tag\n");
    printf( st.c_str() );
}

The output from "make -V=99" shows the switches I use to buid it:


mipsel-openwrt-linux-uclibc-g++ -fno-builtin -fno-rtti -nostdinc++ -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include/uClibc++ -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include/taglib -D__UCLIBC__ -DUSE_TAGLIB -L/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/lib -nodefaultlibs -luClibc++ -lz main_zlib.cpp -o bin/openWRT/squeezed_zlib                                                                                                                   
mipsel-openwrt-linux-uclibc-g++ -fno-builtin -fno-rtti -nostdinc++ -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include/uClibc++ -I/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/include/taglib -D__UCLIBC__ -DUSE_TAGLIB -L/media/Data/openwrt/trunk/staging_dir/target-mipsel_uClibc-0.9.29/usr/lib -nodefaultlibs -luClibc++ -lz -ltag main_tag.cpp -o bin/openWRT/squeezed_tag

The output of ldd on my router is:

root@router:/mnt/usbdrive/usr/bin# ldd squeezed_zlib
        libuClibc++.so.0 => /mnt/flash/usr/lib/libuClibc++.so.0 (0x2aaee000)
        libz.so.1 => /usr/lib/libz.so.1 (0x2ab30000)
        libc.so.0 => /lib/libc.so.0 (0x2ab81000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ac25000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
root@router:/mnt/usbdrive/usr/bin# ldd squeezed_tag
        libuClibc++.so.0 => /mnt/flash/usr/lib/libuClibc++.so.0 (0x2aaee000)
        libz.so.1 => /usr/lib/libz.so.1 (0x2ab30000)
        libtag.so.1 => /mnt/flash/usr/lib/libtag.so.1 (0x2ab81000)
        libc.so.0 => /lib/libc.so.0 (0x2abe9000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ac8d000)
        libstdc++.so.6 => /mnt/flash/usr/lib/libstdc++.so.6 (0x2acdc000)
        libm.so.0 => /lib/libm.so.0 (0x2ade1000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)

Any hints are appreciated

(Last edited by tuigje on 21 May 2009, 14:24)

You can use 'objdump <unstripped_binary> | grep NEEDED' instead of 'ldd' in the build-system before installing the package on the router...

The discussion might have continued from here.