I'm having difficulty integrating a C application into the Openwrt project.
I've followed the steps on the http://wiki.openwrt.org/BuildingPackagesHowTo
for creating a Makefile for building a .c source file in a package.
The error that I continually run into is:
geomag.c:(.text+0x250): undefined reference to `sqrt'
...
I have the most updated version of uClibc 0.9.30 and I've made sure that C
99 feature is enabled in the menuconfig.
so theoretically the math.h library is build into the system and I've found
it in the toolchain staging dir.
this is the command I'm using to build the .c source.
$(TARGET_CC) $(TARGET_CFLAGS) \
$(TARGET_CFLAGS_EXTRA) \
-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include \
-I$(TOOLCHAIN_DIR)/usr/include -include math.h
-I$(TOOLCHAIN_DIR)/usr/include \
$(TARGET_LDFLAGS) \
-o $(PKG_BUILD_DIR)/pathcombin/geomag.out \
$(PKG_BUILD_DIR)/geomag.c
which in turn expands to:
mipsel-openwrt-linux-uclibc-gcc -Os -pipe -mips32 -mtune=mips32
-funit-at-a-time -fhonour-copts
-I/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/target-mipsel_uClibc-0.9.30/usr/include
-I/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/target-mipsel_uClibc-0.9.30/include
-I/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/toolchain-mipsel_gcc-4.1.2_uClibc-0.9.30/usr/include
-include math.h
-I/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/toolchain-mipsel_gcc-4.1.2_uClibc-0.9.30/usr/include
-L/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/toolchain-mipsel_gcc-4.1.2_uClibc-0.9.30/usr/lib
-L/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/toolchain-mipsel_gcc-4.1.2_uClibc-0.9.30/lib
-L/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/target-mipsel_uClibc-0.9.30/usr/lib
-L/home/pathcom/wirelessradio/wrt54g/trunk/staging_dir/target-mipsel_uClibc-0.9.30/lib
-o
/home/pathcom/wirelessradio/wrt54g/trunk/build_dir/target-mipsel_uClibc-0.9.30/pathcom-0.1/pathcombin/geomag.out
/home/pathcom/wirelessradio/wrt54g/trunk/build_dir/target-mipsel_uClibc-0.9.30/pathcom-0.1/geomag.c
I'm guessing that the ld command isn't linking the library correctly.
any help would be much appreciated as I have been racking my brain for a
while on this one.
Thank you,
Dominique
_______________________________________________
openwrt-users mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users