Im trying to cross-compile and link aggregate on ubuntu for my arm-router and I get the following error. In the past I think I have been able to workaround this by setting the appropriate environment variable but this time is not working . Can anyone help me figure out why this might not work:
/home/ubuntu/Downloads/toolchain-arm_cortex-a9_gcc-4.9-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.9.1/../../../../arm-openwrt-linux-muslgnueabi/bin/ld:
cannot find -lpopt
however libpopt.so exists in :
lrwxrwxrwx 1 root root 34 Sep 10 12:46 /lib/x86_64-linux-gnu/libpopt.so -> /lib/x86_64-linux-gnu/libpopt.so.0
I set the following environment variables , in order of desperation, to no avail.
LIBRARY_PATH=/lib/x86_64-linux-gnu/
LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/
PATH=/lib/x86_64-linux-gnu/:/usr/include/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Thinking that it might be caused because it might be a target architecture issue (ie maybe i need libpopt.so built for the target of the cross-compile) I copied the libpopt.so from the router to my ubuntu and set the paths again. Again to no avail.
What might I be doing wrong?
Thanks
解决方案
I had to specify the path to the lib using -L in the Makefile as follows:
-L/lib/x86_64-linux-gnu/
additionally I did have to use the target arhchitecture version of libpopt.so which i copied into a new dir and used that in the argument to -L/home/Downloads/lib/. For whatever reason LIBRARY_PATH and LD_LIBRARY_PATH were not being picked up.
博主在Ubuntu上为ARM路由器进行交叉编译和链接时,遇到找不到 -lpopt 的错误,即便设置环境变量 LIBRARY_PATH、LD_LIBRARY_PATH 和 PATH 也无济于事,复制 libpopt.so 文件到 Ubuntu 同样无效。最终解决方案是在 Makefile 中用 -L 指定库路径,且使用目标架构版本的 libpopt.so。
57

被折叠的 条评论
为什么被折叠?



