程序运行时,调用动态库出错

ackfbcu 2016-07-18 05:27:38
gcc sip_test.c -L libeXosip/src/libs/ -losip2 -losipparser2 -leXosip2 -o test -g -Wall
程序编译成功了,但运行程序,程序直接退出

我用gdb调试:
Starting program: /mnt/sipsvr/test
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fcc8e0 (LWP 28849)]

Breakpoint 1, main () at sip_test.c:58
58 printf("start\n");
(gdb) s
start
59 sipInit();
(gdb)
sipInit () at sip_test.c:14
14 exosip_ = eXosip_malloc();
(gdb)
eXosip_malloc () at eXconf.c:590
590 eXconf.c: No such file or directory.
in eXconf.c
(gdb)

eXosip_malloc()是我调的库中的函数,为什么调用到这就显示找不到文件?
哪位大哥能帮忙指点一下。
...全文
625 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
hanrp0702 2016-08-28
  • 打赏
  • 举报
回复
动态库跟静态库好像不一样,动态库运行的时候也得对库有依赖。或者把库拷贝到usr/lib目录下试试看。
hijack00 2016-08-27
  • 打赏
  • 举报
回复
如果依赖的是动态链接库,将其路径加入LD_LIBRARY_PATH环境变量试试
lbaihao 2016-08-27
  • 打赏
  • 举报
回复
加入LD_LIBRARY_PATH环境变量
nswcfd 2016-07-19
  • 打赏
  • 举报
回复
又说错了,是gdb找不到lib的源文件,通常是目录的问题。 如果安装了gdb.info的话,可以参考info gdb 'Source' 'Source Path' `directory DIRNAME ...' `dir DIRNAME ...' Add directory DIRNAME to the front of the source path. Several directory names may be given to this command, separated by `:' (`;' on MS-DOS and MS-Windows, where `:' usually appears as part of absolute file names) or whitespace. You may specify a directory that is already in the source path; this moves it forward, so GDB searches it sooner. You can use the string `$cdir' to refer to the compilation directory (if one is recorded), and `$cwd' to refer to the current working directory. `$cwd' is not the same as `.'--the former tracks the current working directory as it changes during your GDB session, while the latter is immediately expanded to the current directory at the time you add an entry to the source path. `directory' Reset the source path to its default value (`$cdir:$cwd' on Unix systems). This requires confirmation. `show directories' Print the source path: show which directories it contains.
nswcfd 2016-07-19
  • 打赏
  • 举报
回复
不好意思,看错了,这应该是gdb报的错误吧? 莫非这个库悄悄的chdir了?
nswcfd 2016-07-19
  • 打赏
  • 举报
回复
编译库、链接库没有问题,就是使用的那个库需要一个配置文件。 去查库的使用手册吧。

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧