cross-compiling using NDK, undefined references to le32toh and be32toh
===

I am trying to build a shared library, ultimately cross-compiling a piece of code that uses references to _be32toh_ and _le32toh_.  If I build this piece of code and create an executable out of it, I get no errors:

        include $(CLEAR_VARS) 
        LOCAL_SRC_FILES:= ubertooth.c ubertooth_helper.c 
        LOCAL_MODULE := ubertooth 
        LOCAL_C_INCLUDES += jni/libusb jni/libbtbb 
        LOCAL_SHARED_LIBRARIES := libc libusb libbtbb 
        LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog  
        include $(BUILD_EXECUTABLE) 

Here it compiles successfully:

        Compile thumb  : ubertooth <= ubertooth.c
        Compile thumb  : ubertooth <= ubertooth_helper.c
        Executable     : ubertooth
        Install        : ubertooth => libs/armeabi/ubertooth

However, when I try to build it as a shared library by only changing a single line in the _Android.mk_:

        include $(CLEAR_VARS) 
        ...
        include $(BUILD_SHARED_LIBRARY) 

I now get the following errors:

        Compile thumb  : ubertooth <= ubertooth.c
        Compile thumb  : ubertooth <= ubertooth_helper.c
        SharedLibrary  : libubertooth.so
        ./obj/local/armeabi/objs-debug/ubertooth/ubertooth.o: In function `stream_rx_file':
        ubertooth.c:224: undefined reference to `be32toh'
        ./obj/local/armeabi/objs-debug/ubertooth/ubertooth.o: In function `cb_lap':
        ubertooth.c:281: undefined reference to `le32toh'
        ./obj/local/armeabi/objs-debug/ubertooth/ubertooth.o: In function `cb_hop':
        ubertooth.c:417: undefined reference to `le32toh'
        ./obj/local/armeabi/objs-debug/ubertooth/ubertooth.o: In function `cb_btle':
        ubertooth.c:506: undefined reference to `le32toh'
        collect2: ld returned 1 exit status

I don't understand why I would get this linking error when building a shared library, but not when building the executable.  And, if I want to build the shared library, how to properly link to something I'm missing?

[Here is ubertooth.c](http://ubertooth.svn.sourceforge.net/viewvc/ubertooth/trunk/host/bluetooth_rxtx/ubertooth.c?revision=560&view=markup)