LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
123
返回列表 发新帖
楼主: lrz

编译出错,cannot find -lm

[复制链接]
 楼主| 发表于 2004-7-28 19:26:29 | 显示全部楼层
最初由 doubleelec 发表
不明白为啥你的链接命令中并没有 -lm
不知是不是在写在了后面的某个 .o 文件中
如果这样,链接命令中指定了 -static 选项,要求静态链接链接
就必须有 /usr/lib/libm.a 了(.a是静态库, .so是动态库)

你的问题的确比较怪,只能慢慢试了


:!! , I really need this to be solved
i used the same with Redhat before, and everything is ok

in this case, can I delete the -static flag in the Makefile?
or , is there any possibility for me to downlaod the libm.a?

:thank
 楼主| 发表于 2004-7-28 19:28:27 | 显示全部楼层
最初由 kj501 发表
libm.so是共享库,libm.a是静态库。
用ls -l 看看libm.so@是链接到那个文件的?


ls -l /usr/lib/libm.so
lrwxrwxrwx 1 root root 19 Jul 27 21:34 /usr/lib/libm.so -> ../../lib/libm.so.6*
发表于 2004-7-28 19:29:41 | 显示全部楼层
如果动态库没有问题,那就一定是静态库的问题了。一般的linux发行版不会自动安装静态库的,你把gcc和glibc的static库安装上,应该可以解决问题了。
发表于 2004-7-28 19:34:45 | 显示全部楼层
那就去掉试试吧,
不过找到 libm.a 更好一些

libm.a 属于 glibc-devel-2.3.2-11.9.rpm (我的系统是Redhat 9.0)
如果你的系统类似
从网上或安装盘上找到合适版本的glibc-devel库然后安装
 楼主| 发表于 2004-7-28 19:37:23 | 显示全部楼层
how can i know it is static or not?
when i tried to search libc and gcc from the installing packages
too many! shall I install them all?
发表于 2004-7-28 19:41:16 | 显示全部楼层
可以完全安装,但要注意和你系统原来的
同名库版本接近, 尤其不能比原来的低
 楼主| 发表于 2004-7-28 20:07:26 | 显示全部楼层
thank you very much everyone, especially kj501 and doubleelee :thank :thank

mine is Mandrake, i have installed the glibc-devel..., seems that everything is ok, the executable file comes out, but I cannot run it, nothing happened why i tired to execute it, i decided to compile it again.

anyway, thank you!
发表于 2004-7-28 20:50:51 | 显示全部楼层
问题解决啦,头像也换啦!
 楼主| 发表于 2004-7-28 20:55:48 | 显示全部楼层
最初由 kj501 发表
问题解决啦,头像也换啦!


en, it took me almost one week to sort out the problem, change systems etc etc, well, haven completlely finished yet, but I think the reason should be the package itself, but not the system, so just took a littlle break, playing around.

but I did learn a lot during this process and I really enjoyed it.

hope I myself can helpful to other people in the future.

thank you again!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表