您尚未登录。

楼主 #1 2018-12-19 10:55:14

pqfeng
会员
注册时间: 2018-08-18
已发帖子: 129
积分: 129

请教一下,为什么我有库,却不能编译通过,说找不到库。谢谢。

-rwxr-xr-x 1 root root  964991 Oct 18 17:59 libjpeg.so.9.1.0
-rwxr-xr-x 1 root root  431620 Oct 18 17:58 libm-2.23.so
lrwxrwxrwx 1 root root      12 Oct 18 17:58 libm.so.6 -> libm-2.23.so
-rwxr-xr-x 1 root root   63364 Oct 18 17:58 libnsl-2.23.so
lrwxrwxrwx 1 root root      14 Oct 18 17:58 libnsl.so.1 -> libnsl-2.23.so
-rwxr-xr-x 1 root root   22060 Oct 18 17:59 libnss_dns-2.23.so
lrwxrwxrwx 1 root root      18 Oct 18 17:58 libnss_dns.so.2 -> libnss_dns-2.23.so
-rwxr-xr-x 1 root root   34412 Oct 18 17:58 libnss_files-2.23.so
lrwxrwxrwx 1 root root      20 Oct 18 17:59 libnss_files.so.2 -> libnss_files-2.23.so
-rwxr-xr-x 1 root root  115588 Oct 18 17:58 libpthread-2.23.so
lrwxrwxrwx 1 root root      18 Oct 18 17:58 libpthread.so.0 -> libpthread-2.23.so
-rwxr-xr-x 1 root root   63216 Oct 18 17:58 libresolv-2.23.so
lrwxrwxrwx 1 root root      17 Oct 18 17:58 libresolv.so.2 -> libresolv-2.23.so
-rwxr-xr-x 1 root root   30676 Oct 18 17:58 librt-2.23.so
lrwxrwxrwx 1 root root      13 Oct 18 17:58 librt.so.1 -> librt-2.23.so
-rwxr-xr-x 1 root root     945 Oct 18 17:59 libts.la
-rwxr-xr-x 1 root root     946 Oct 18 17:59 libts.lai
-rwxr-xr-x 1 root root   12294 Oct 18 17:59 libts.so
-rwxr-xr-x 1 root root   12294 Oct 18 17:59 libts.so.0
-rwxr-xr-x 1 root root   12294 Oct 18 17:59 libts.so.0.8.0
-rwxr-xr-x 1 root root   17980 Oct 18 17:59 libutil-2.23.so
lrwxrwxrwx 1 root root      15 Oct 18 17:58 libutil.so.1 -> libutil-2.23.so
drwxr-xr-x 3 root root    4096 Dec 19 09:09 share
pqfeng@ubuntu:/opt/rootfs/lib$ cd /home/pqfeng/kadiuart/
pqfeng@ubuntu:~/kadiuart$ ls
bitmap.c         configtxt.c       dataproc.c  ebfont.h          jconfig.h    jpegcodec.o  libfile.o    libts.lai        message.h     osdecode.o  qrcnv.o       rtfdecode.o    ts.c          utf8decode.o
bitmap.h         configtxt.h       dataproc.h  ebfont.o          jdct.h       jpeg.h       libjpeg.a    libts.so         modbus.c      os.h        qr_dwtable.h  slidescreen.c  tslib.h       utf8table.c
bitmap.o         configtxt.o       dataproc.o  gb23122unicode.c  jerror.h     jpegint.h    libjpeg.la   libuartscreen.a  modbus.h      psimage.h   qr.h          slidescreen.o  ts.o          utf8table.o
calibrate.c      crc.h             dispctrl.c  gb23122unicode.o  jinclude.h   jpeglib.h    libjpeg.lai  Makefile         modbus.o      PY_code.h   qr.o          stackopea.c    uartmain.c    wordcodec.c
calibrate.o      d2k_discrpit.c    dispctrl.o  HZ_input.c        jmemsys.h    Kadi_Set     libjpeg.so   memblock.c       os_command.c  qr.c        qr_private.h  stackopea.h    uartmain.h    wordcodec.o
common.h         d2k_discrpit.o    ebcommon.c  HZ_input.o        jmorecfg.h   kdcommand.c  libserial.c  memblock.o       os_command.o  qrcmd.h     qr_util.h     stackopea.o    uartmain.o
communication.c  d2k_formatlast.c  ebcommon.o  imagebase.c       jpegcodec.c  kdcommand.o  libserial.o  messagecycle.c   osdecode.c    qrcnv.c     rtfdecode.c   toucharea.c    utf8decode.c
communication.o  d2k_formatlast.o  ebfont.c    imagebase.o       jpegcodec.h  libfile.c    libts.la     messagecycle.o   osdecode.h    qrcnv.h     rtfdecode.h   toucharea.o    utf8decode.h
pqfeng@ubuntu:~/kadiuart$ make
arm-linux-gnueabihf-gcc -L/opt/rootfs/lib/ -L/opt/rootfs/lib/lib -L/opt/rootfs/lib/lib/ts -L. -lpthread -lm -lc -lts -ljpeg   os_command.o kdcommand.o messagecycle.o d2k_formatlast.o memblock.o imagebase.o configtxt.o slidescreen.o utf8decode.o toucharea.o modbus.o d2k_discrpit.o ebcommon.o qrcnv.o bitmap.o qr.o osdecode.o HZ_input.o communication.o utf8table.o jpegcodec.o libfile.o ts.o gb23122unicode.o rtfdecode.o wordcodec.o ebfont.o libserial.o uartmain.o calibrate.o stackopea.o dataproc.o dispctrl.o  -o kadiuart
kdcommand.o: In function `kdCmd_SQRT':
kdcommand.c:(.text+0x25b6): undefined reference to `sqrt'
kdcommand.c:(.text+0x25ea): undefined reference to `sqrt'
kdcommand.c:(.text+0x2622): undefined reference to `sqrt'
imagebase.o: In function `ImageRotate':
imagebase.c:(.text+0x1528): undefined reference to `sin'
imagebase.c:(.text+0x1556): undefined reference to `cos'
imagebase.o: In function `DrawArcToImg':
imagebase.c:(.text+0x2e90): undefined reference to `cos'
imagebase.c:(.text+0x2ee2): undefined reference to `sin'
imagebase.c:(.text+0x2f34): undefined reference to `cos'
imagebase.c:(.text+0x2f86): undefined reference to `sin'
imagebase.c:(.text+0x304c): undefined reference to `sqrt'
imagebase.c:(.text+0x310e): undefined reference to `sqrt'
imagebase.o: In function `DrawFillArcOnImg':
imagebase.c:(.text+0x40ac): undefined reference to `cos'
imagebase.c:(.text+0x40fe): undefined reference to `sin'
imagebase.c:(.text+0x4150): undefined reference to `cos'
imagebase.c:(.text+0x41a2): undefined reference to `sin'
imagebase.c:(.text+0x4286): undefined reference to `sqrt'
imagebase.c:(.text+0x4348): undefined reference to `sqrt'
imagebase.o: In function `MakeSectorMask':
imagebase.c:(.text+0x4882): undefined reference to `cos'
imagebase.c:(.text+0x48d4): undefined reference to `sin'
imagebase.c:(.text+0x4926): undefined reference to `cos'
imagebase.c:(.text+0x4978): undefined reference to `sin'
imagebase.c:(.text+0x4a64): undefined reference to `sqrt'
imagebase.c:(.text+0x4afe): undefined reference to `sqrt'

离线

#2 2018-12-19 11:20:55

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,236
积分: 9197

Re: 请教一下,为什么我有库,却不能编译通过,说找不到库。谢谢。

glibc/uclibc 自带 libm 动态链接库,应该是操作问题吧.

做一个小的测试demo, 调用 sqrt() 试一试,看能否链接成功.





离线

#3 2018-12-19 20:16:19

执念执战
会员
注册时间: 2018-11-27
已发帖子: 19
积分: 9

Re: 请教一下,为什么我有库,却不能编译通过,说找不到库。谢谢。

我之前编译licheepi nano 的裸机驱动也是math库找不到。网上搜了半天说是arm裸机不支持除法(还有其他说法,忘了),然后有教程。但是跟着弄了半天,没解决。所以自己从网上复制了一个math库的c语言实现方法,才通过的。就是旋转立方体那个源程序中的Mymath.c。不知对你有帮助么,如果是一样的问题的话,这么解决起来很快的。

离线

#4 2018-12-20 06:53:52

basicdev
会员
注册时间: 2017-10-02
已发帖子: 159
积分: 159

Re: 请教一下,为什么我有库,却不能编译通过,说找不到库。谢谢。

执念执战 说:

我之前编译licheepi nano 的裸机驱动也是math库找不到。网上搜了半天说是arm裸机不支持除法(还有其他说法,忘了),然后有教程。但是跟着弄了半天,没解决。所以自己从网上复制了一个math库的c语言实现方法,才通过的。就是旋转立方体那个源程序中的Mymath.c。不知对你有帮助么,如果是一样的问题的话,这么解决起来很快的。

这个应该不是裸奔,一般gcc都提供了 数学函数库 libm.a,感觉还是操作方面的原因

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn