linux环境编译libssh2
来源:互联网 发布:iphone蜂窝数据用不了 编辑:程序博客网 时间:2024/05/09 02:14
1.编译zlib (貌似在linux上没有用到这个库)
./configure
make
make install
./config
生成makefile文件后,打开makefile文件,在CFLAG添加-fPIC
make
make install
用到的include和lib会安装到/usr/local/ssl下面
3.编译libssh2
chmod 777 configure
./configure --with-libssl-prefix=/usr/local/ssl
make
这时候会报错,查看错误:
Making all in simple
make[2]: Entering directory `/root/tool/libssh2-1.1/example/simple'
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -o scp scp.o ../../src/libssh2.la
gcc -g -O2 -o .libs/scp scp.o ../../src/.libs/libssh2.so -Wl,--rpath -Wl,/usr/local/lib
../../src/.libs/libssh2.so: undefined reference to `dlsym'
../../src/.libs/libssh2.so: undefined reference to `dlerror'
../../src/.libs/libssh2.so: undefined reference to `dlopen'
../../src/.libs/libssh2.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status
原因:编译simple时未添加dl库的链接,修改方法:
cd /root/tool/libssh2-1.1/example/simple
vi Makefile
LDFLAGS = -ldl
make
继续回报上述错误,用同样发方法修改,直至编译成功
编译完后会在/usr/local/lib下面生成libssh2.a libssh2.la libssh2.so libssh2.so.1 libssh2.so.1.0.1
编译完成后,会在libssh2-1.1/src下面生成libssh2_config.h文件
cp libssh2_config.h至include
./configure
make
make install
2.编译openssl
我用的是openssl-0.9.8k.tar.gz
chmod 777 config./config
生成makefile文件后,打开makefile文件,在CFLAG添加-fPIC
make
make install
用到的include和lib会安装到/usr/local/ssl下面
3.编译libssh2
chmod 777 configure
./configure --with-libssl-prefix=/usr/local/ssl
make
这时候会报错,查看错误:
Making all in simple
make[2]: Entering directory `/root/tool/libssh2-1.1/example/simple'
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -o scp scp.o ../../src/libssh2.la
gcc -g -O2 -o .libs/scp scp.o ../../src/.libs/libssh2.so -Wl,--rpath -Wl,/usr/local/lib
../../src/.libs/libssh2.so: undefined reference to `dlsym'
../../src/.libs/libssh2.so: undefined reference to `dlerror'
../../src/.libs/libssh2.so: undefined reference to `dlopen'
../../src/.libs/libssh2.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status
原因:编译simple时未添加dl库的链接,修改方法:
cd /root/tool/libssh2-1.1/example/simple
vi Makefile
LDFLAGS = -ldl
make
继续回报上述错误,用同样发方法修改,直至编译成功
编译完后会在/usr/local/lib下面生成libssh2.a libssh2.la libssh2.so libssh2.so.1 libssh2.so.1.0.1
编译完成后,会在libssh2-1.1/src下面生成libssh2_config.h文件
cp libssh2_config.h至include
0 0
- linux环境编译libssh2
- mingw编译libssh2
- libssh2静态库编译
- vs2010 编译 libssh2-1.4.2
- win32下vs2012 编译 libssh2
- libssh2的windows下编译
- OpenSSL+zlib+libssh2编译(windows)
- libxml2,openssl,libssh2交叉编译
- windows搭建libssh2+VS2005开发环境
- libssh2进行远程执行LINUX命令
- libssh2 1.6版更改编译通过(OpenSSL 1.0.2d)
- 使用VS编译libcurl库(支持libSSH2和OpenSSL)
- linux 编译环境准备
- flash-linux编译环境
- Linux 交叉编译环境
- linux编译驱动环境
- linux交叉编译环境
- linux环境编译FFMPEG
- GDAL综合整理--1:简介
- 语音群呼旅行社节假日促销广告
- selenium+python+eclipse 之selenium常用函数用法摘要
- mysql控制台操作介绍
- poj2528
- linux环境编译libssh2
- Python之isinstance
- 详解C++引用——带你走进引用的世界
- IO流中出现的装饰设计模式
- oracle经典练习
- GDAL综合整理--2:大体结构
- Python的网页爬虫&文本处理&科学计&机器学习&数据挖掘工具集
- 编程易错积累
- C++学习网站集锦