teddy99999 发表于 2014-05-24 11:06

openwrt系统添加模块依赖uboot,编译出的可执行程序执行失败

./etc/init.d/onu.sh start
/opt/lantiq/bin/onu: can't load library 'crc32.o'

问题描述:
自己的onu模块需要调用uboot-envtools-2012.04.01模块中的fw_env_open等操作函数进行环境变量读写
修改onu的Makefile.am+#FNSR depend on libenv.a
+onu_CFLAGS += \
+       @IFXOS_INCLUDE_PATH@/../../../root-lantiq/usr/include
+onu_CFLAGS += \
+       @IFXOS_LIBRARY_PATH@/../../root-lantiq/usr/lib
+onu_LDFLAGS += -lenv
编译正常,但是系统启动后执行出现开头的错误提示

取消上述修改,包括代码中的调用语句,一切正常。
保持上述修改,取消代码中的调用语句,执行也会出错。

理论问题:
onu模块采用静态链接,如果是找不到库文件应该也是编译阶段出错?为什么错误提示感觉像是动态库的操作一样。

teddy99999 发表于 2014-05-25 11:27

比较了以前可以正常工作的uboot,发现生成crc32.o大小不一样:正常的crc32.o 大小为2964, 出错时的crc32.o有5k多
将正常makefile的语句替换出错的Makefile,生成的crc32.o也为2964

正常make语句:
        mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -Wall -shared -fPIC -c -o crc32.o crc32.c
出错make语句:
        mips-openwrt-linux-uclibc-gcc -Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float-I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/target-mips_r2_uClibc-0.9.33.2_falcon/usr/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/target-mips_r2_uClibc-0.9.33.2_falcon/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include -I/home/jiangbo/v642/Lantiq-SDK-FALC_ON-Linux-and-ecos-v6.4.2/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include-shared -fPIC crc32.c -o crc32.o
差别只是一些-I选项,这些选项会导致编译出的.o文件大小变化吗?

页: [1]
查看完整版本: openwrt系统添加模块依赖uboot,编译出的可执行程序执行失败