免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1661 | 回复: 6
打印 上一主题 下一主题

[函数] 关于函数库的调用问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-08 22:34 |只看该作者 |倒序浏览
程序运行时出现如下错误:
0509-036 cannot load program ./test beacuse of the following errros
0509-150 dependent module libc.a(shr.o)could not be loaded
0509-022 cannot load module libc.a(shr.o) could not be loaded
              system error: a file or directory in the path name does not exist
编译环境:AIX4.3
运行环境:AIX5.3

有两种方法可以解决此问题:
1)编译时,设定环境变量 setenv LIBPATH /usr/lib;运行时,可以不设定
2)编译时,不设定环境变量LIBPAHT;运行时,设定setenv LIBPATH /usr/lib

以上两点是我的解决办法,经过测试确实可行。
我找到了解决办法,但不知道为什么,哪个大侠帮忙解释一下?



PS:
libc.a是个静态库吧,为啥编译时不指定环境变量LIBPATH也可以编译通过?

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2007-03-08 22:58 |只看该作者
你怎么编译的?
/usr/lib下面有没有libc.so?

论坛徽章:
0
3 [报告]
发表于 2007-03-11 17:20 |只看该作者
原帖由 lenovo 于 2007-3-8 22:58 发表
你怎么编译的?
/usr/lib下面有没有libc.so?




没有。

论坛徽章:
0
4 [报告]
发表于 2007-03-11 17:27 |只看该作者
原帖由 lenovo 于 2007-3-8 22:58 发表
你怎么编译的?
/usr/lib下面有没有libc.so?

你是指libc.a?
编译里才需要找.a文件,运行时则是.so文件。

论坛徽章:
0
5 [报告]
发表于 2007-03-11 18:44 |只看该作者
编译和运行的环境里只有libc.a,没有libc.so .
从错误提示看,应该跟libc.so没关系吧?

论坛徽章:
0
6 [报告]
发表于 2007-03-11 19:01 |只看该作者
编译环境:AIX4.3
运行环境:AIX5.3


It's clear you are attempting to run an executable on a platform other than where you have compiled it. So this might fail. You need to recompile the program on the latter one and it will run, I think.

.

论坛徽章:
0
7 [报告]
发表于 2007-03-11 19:04 |只看该作者
原帖由 langue 于 2007-3-11 19:01 发表


It's clear you are attempting to run an executable on a platform other than where you have compiled it. So this might fail. You need to recompile the program on the latter one and it will run,  ...



没有用的,我也试过: 同在AIX4.3上编译、运行,结果是一样的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP