小议linux中的软链接------顺便谈谈为什么编译有时会出现cannot find -lssl, cannot find -lcrypto
来源:互联网 发布:北大青鸟云计算 编辑:程序博客网 时间:2024/04/28 17:42
linux中的软链接其实是很好理解的, 非常类似于Windows下的快捷方式, 我们来做个简单的实验玩玩:
[taoge@localhost test]$ echo hello > a.txt[taoge@localhost test]$ ln -s a.txt b.txt[taoge@localhost test]$ diff a.txt b.txt [taoge@localhost test]$ lltotal 4-rw-rw-r-- 1 taoge taoge 6 Nov 4 07:27 a.txtlrwxrwxrwx 1 taoge taoge 5 Nov 4 07:27 b.txt -> a.txt[taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ echo world >> a.txt[taoge@localhost test]$ diff a.txt b.txt [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ echo c++ >> b.txt[taoge@localhost test]$ diff a.txt b.txt [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ rm b.txt [taoge@localhost test]$ cat a.txt helloworldc++[taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ ln -s a.txt b.txt[taoge@localhost test]$ diff a.txt b.txt [taoge@localhost test]$ rm a.txt[taoge@localhost test]$ cat b.txt cat: b.txt: No such file or directory[taoge@localhost test]$ lltotal 0lrwxrwxrwx 1 taoge taoge 5 Nov 4 07:29 b.txt -> a.txt (注意, 此处的a.txt在闪动)[taoge@localhost test]$
根据如上实验和结果, 我们知道, 软链接其实就是快捷方式。 有时候, 我们也把软链接叫符号链接。 大家可以根据上述小实验轻易地总结出软链接的特点, 我就不费口舌了。
下面, 我们继续来看小实验:
[taoge@localhost test]$ lsmain.c[taoge@localhost test]$ cat main.c #include <stdio.h>int main(){ printf("hello world\n"); return 0;}[taoge@localhost test]$ gcc main.c [taoge@localhost test]$ ./a.out hello world[taoge@localhost test]$ [taoge@localhost test]$ [taoge@localhost test]$ ./x-bash: ./x: No such file or directory[taoge@localhost test]$ ln -s a.out x[taoge@localhost test]$ ./xhello world[taoge@localhost test]$看了这个小实验, 我无需多说软连接的用法和用途了。
在实际开发中, 偶尔会遇到cannot find -lssl, cannot find -lcrypto这样的问题, 是什么原因呢? 因为找不到libssl.so库和libcrypto.so这样的库,那怎么办呢? 用软链接吧。 在root权限下进入到/usr/lib中去:
[root@localhost lib]# ll | grep ssl-rwxr-xr-x 1 root root 216656 Aug 27 2010 libssl3.solrwxrwxrwx. 1 root root 15 Mar 24 2015 libssl.so.10 -> libssl.so.1.0.0-rwxr-xr-x 1 root root 355280 Jun 30 2010 libssl.so.1.0.0drwxr-xr-x. 3 root root 4096 Mar 24 2015 openssl[root@localhost lib]# [root@localhost lib]# [root@localhost lib]# ll | grep cryptolrwxrwxrwx. 1 root root 18 Mar 24 2015 libcrypto.so.10 -> libcrypto.so.1.0.0-rwxr-xr-x 1 root root 1596748 Jun 30 2010 libcrypto.so.1.0.0[root@localhost lib]#可以看到, 是有类似库的, 只是文件名不完全吻合, 现在又不想改原来的文件名, 那怎么办呢? 用软链接吧, 搞定。
软链接的本质就是快捷方式,很常用, 更多的讲述似乎没有必要了。
0 0
- 小议linux中的软链接------顺便谈谈为什么编译有时会出现cannot find -lssl, cannot find -lcrypto
- 编译时候出现/usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned
- 编译出现“/usr/bin/ld cannot find -lssl“问题
- suse环境编译找不到cannot find -lcrypto
- SUSE环境编译cannot find -lcrypto
- linux下编译代码遇到“/usr/bin/ld: cannot find -lcrypto”的问题
- /usr/bin/ld: cannot find -lssl
- RedHat5.8 cannot find -lssl解决方法
- Linux编译静态链接出现:/usr/bin/ld: cannot find -lc
- linux下Qt5 编译出现cannot find -IGL问题修复
- linux下Qt5 编译出现cannot find -IGL问题修复
- linux下编译Qt程序出现 cannot find –lGL
- 解决”/usr/bin/ld cannot find -lssl“问题
- 关于/usr/bin/ld: cannot find -lcrypto 的错误
- /usr/bin/ld: cannot find -lcrypto 错误的解决方法
- 编译qvfb出现cannot find -lXtst解决
- PHP动态编译出现Cannot find autoconf
- android编译时出现cannot find symbol
- MySql之按周,按月,按日分组统计数据
- GIS相关的博客
- Stem-and-Leaf Plot in R
- nyoj904 search
- 接手项目准备
- 小议linux中的软链接------顺便谈谈为什么编译有时会出现cannot find -lssl, cannot find -lcrypto
- mysql之分组 取前二
- Elasticsearch 基本操作
- FTP两种工作模式:主动模式(Active FTP)和被动模式(Passive FTP)
- 关于EnumerateObjectsUsingBlock和for-in之间的较量
- 如何挑选适合的前端框架?
- 菜鸟猿大战Java之线程初接触
- opencv2中CamShift方法的参数
- 挨踢人的脚步(2015.11.04)