移植gnu scientific library(gsl)到ios6 xcode4.2
来源:互联网 发布:算法谜题 pdf 百度云 编辑:程序博客网 时间:2024/05/22 01:29
最近需要在ios6上用到gnu scientific library(gsl)库,但无奈目前还没有人一直过(太小众了),只能自己研究一下了。
1.先去下载一个gsl源代码
去这下:
http://www.gnu.org/software/gsl/
2.解压
把压缩文件解压出来,并查看了INSTALL文件中的指导。
Installation Instructions========================= GSL follows the standard GNU installation procedure. To compile GSLyou will need an ANSI C-compiler. After unpacking the distributionthe Makefiles can be prepared using the configure command, ./configure You can then build the library by typing, make Both static and shared versions of the libraries will be compiled bydefault. Compilation of shared libraries can be turned off byspecifying the `--disable-shared' option to `configure', e.g. ./configure --disable-shared
需要先configure,再make.嗯,gnu的一贯风格。
3.configure参数
默认的configure会直接编译i686下的库,而ios是需要arm7的库,你懂的。所以不能使用默认的参数。
我们要做的就是指定下面的参数:
编译器,采用ios6的编译器,可以编译arm7结构的库
连接器,也用ios6的
库目录,arm自己的标准C++库
头文件目录,arm自己的C++头文件目录
目标机器架构,这里选arm
好在a/b/c都在Xcode中包含了。
我的Xcode安装目录在:/Applications/Xcode.app/Contents/Developer/
a.编译器指定为:CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
b.链接器:LD=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld
c.库目录指定为:LIBS="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system"
d.头文件:CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include
e.目标机器架构,--host=arm
所以有下面的configure命令
./configure CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include LIBS="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system" LD=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld --host=arm
4.make
开始make把。
很快就会有错误:
ldfrexp.c:63: error: 'gsl_finite' is unavailable (declared at ../gsl/gsl_sys.h:45)ldfrexp.c:88: error: 'gsl_finite' is unavailable (declared at ../gsl/gsl_sys.h:45)
别怕。arm的函数有一些不同,需要修改一下:
在文件gsl/gsl_math.h
#define GSL_IS_REAL(x) (gsl_finite(x))(第119行)下面插入
#define gsl_finite(x) (isfinite(x))
然后保存。
再make即可。
然后就会在.libs/目录下生成libgsl.a文件了。
- 移植gnu scientific library(gsl)到ios6 xcode4.2
- GSL - GNU Scientific Library
- GSL--GNU Scientific Library
- GSL--GNU Scientific Library
- GSL - GNU Scientific Library
- GSL--GNU Scientific Library 小记
- linux 下安装gsl(GNU Scientific Library)
- 使用GNU Scientific Library(GSL)及GSL的配置
- GNU科学计算函数库 GSL - GNU Scientific Library
- Visual Stdio C++ 编译器 编译 (GSL) GNU Scientific Library 的方法介绍(2)
- 用GNU Scientific Library(GSL)学习科学计算
- C/C++ GNU Scientific Library(GSL) for Windows
- 【GSL】GNU Scientific Library 科学计算库VS2010安装配置
- GSL】GNU Scientific Library 科学计算库VS2010安装配置
- GSL(GNU Scientific Library)在vs2010下的配置
- Windows下使用GSL(GNU Scientific Library)
- 如何安装C/C++ GNU Scientific Library(GSL) for Windows
- GSL(GNU Scientific Library)在vs2010下的配置
- PHP数组排序函数合集(转)
- ubuntu下无法挂载硬盘以及移动硬盘
- C# ListView用法详解
- 改变class属性修改背景
- 如何定义PI
- 移植gnu scientific library(gsl)到ios6 xcode4.2
- MyEclipse 一直initializing java tools 1%
- JSON.parse()和JSON.stringify()
- [图解]sqlserver中创建链接服务器
- 更改DB客户端的字符集
- 修改密码
- vc 在IE8下调试 ActiveX的解决方案
- vc 判断文件存在修改文件属性以及删除文件
- Oracle构造添加字段的SQL语句