使用MinGW 编译 iconv 库
原文链接: http://www.code-by.org/viewtopic.php?f=54&t=166
GNU页面
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
已有的环境:msys2.0, mingw, GnuWin32工具集
解压后先别急着configure
先看看 README.woe32
Building requires the mingw or cygwin development environment (includes gcc).
I recommend to use the cygwin environment as the development environment
and mingw only as the target (runtime, deployment) environment.
For this, you need to install
- cygwin,
- the mingw runtime package, also from the cygwin site.
首先安装cygwin,
进入目录后执行 ./configure , 第一个问题
checking if gcc supports -fno-rtti -fno-exceptions... ./configure: line 7594: diff:
command not found
缺个diff.exe,用everything 搜索到 C:\Program Files (x86)\GnuWin32\bin 下面有一个,复制到 C:\cygwin64\bin,
先不急着执行./configure,单独执行diff.exe 提示缺少 libintl3.dll,将这个文件也复制过来,
再次执行diff.exe 提示缺少 libiconv2.dll,再复制,没问题了。
(如果你从别的地方获取diff,可能不需要依赖dll,也可能依赖别的库,用类似的方法配置齐全就是了)
执行 ./configure 没有出现明显问题
执行 make ,提示
./relocatable.c: In function 'libcharset_relocate':
:0:12: error: expected expression before '/' token
./relocatable.c:423:37: note: in expansion of macro 'INSTALLDIR'
const char orig_installdir = INSTALLDIR;
^~~~~~~~~~
make[2]: ** [Makefile:65: relocatable.lo] Error 1
make[2]: Leaving directory 'C:/Users/ViANG/Desktop/libiconv-1.14/libcharset/lib'
make[1]: *** [Makefile:34: all] Error 2
make[1]: Leaving directory 'C:/Users/ViANG/Desktop/libiconv-1.14/libcharset'
make: *** [Makefile:42: lib/localcharset.h] Error 2
好像是说这个 INSTALLDIR 的宏里面,包含了不可预料的表达式(在/之前),但是我也不知道怎么看INSTALLDIR的值,
用grep -R "INSTALLDIR" * 看了一下
build-aux/install-reloc: -D"INSTALLPREFIX="$prefix"" -D"INSTALLDIR
="$installdir"" \
lib/Makefile:-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR="$(libdir)" -DNO
_XMALLOC \
lib/Makefile.in:-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR="$(libdir)" -
DNO_XMALLOC \
大概是从某个参数中传递进去的,既然它的内容有毒,而且只有一处,那自己改写试试:
找到:libiconv-1.14\libcharset\lib\relocatable.c
将
const char orig_installdir = INSTALLDIR;
改为
const char orig_installdir = "/usr/local/cygwin";
同时 mkdir /usr/local/cygwin
然后执行
$ ./configure --prefix=/usr/local/cygwin
$ make
提示错误
C:\MinGW\bin\ranlib.exe: '/cygdrive/c/Users/name/Desktop/libiconv-1.14/lib/libcharset.a':
No such file
试了一下,对于mingw和msys的那一套,可以接受的路径是 /c/usr/...这样的,而在cygwin中的路径是 /cygdrive/c/usr...
试着用sed和grep 批量替换,以及寻找 生成路径的 cygpath命令,修改相应的参数,但还是失败了。
分割线
既然Cygwin 路径和 Msys mingw不兼容,而我对这一系列的东西不太熟,只能再换MSYS试试了
按cygwin的方法把diff.exe和相关的文件复制到 c:/mingw/bin
打开 MSYS2 Shell
$ ./configure
configure: error: cannot guess build type; you must specify one
添加参数:
$ ./configure --build=mingw32
看上去没什么问题
$ make
跑了一大段后,出现前面同样的问题:
./relocatable.c: In function 'libiconv_relocate':
:0:12: error: 'C' undeclared (first use in this function)
./relocatable.c:423:37: note: in expansion of macro 'INSTALLDIR'
const char orig_installdir = INSTALLDIR;
^~~~~~~~~~
:0:12: note: each undeclared identifier is reported only once for
each function it appears in./relocatable.c:423:37: note: in expansion of macro 'INSTALLDIR'
const char orig_installdir = INSTALLDIR;
^~~~~~~~~~
:0:13: error: expected ',' or ';' before ':' token
./relocatable.c:423:37: note: in expansion of macro 'INSTALLDIR'
const char orig_installdir = INSTALLDIR;
^~~~~~~~~~
make[1]: ** [Makefile:87: relocatable.lo] Error 1
make[1]: Leaving directory 'C:/Users/ViANG/Desktop/libiconv-1.14/lib'
make: *** [Makefile:33: all] Error 2
找到 libiconv-1.14/lib/relocatable.c
改 INSTALLDIR 为 "/usr/local/cygwin" (忘了去mkdir,好像也没什么问题),继续
$ make
$ make install
看上去没什么问题了 :coverface1
使用MinGW 编译 iconv 库的更多相关文章
- mingw编译rtmp库
下载rtmpdump-2.4 进到里面的librtmp目录下面,执行命令:make SYS=mingw CRYPTO= 这样就编译成功静态库和动态库,如何安装到/usr/local/下面? 执行命令: ...
- Clion使用MinGW编译好的boost库
MinGW编译Boost库可以参考我之前写的编译Boost的文章. 以下是cmake链接boost静态库的配置: cmake_minimum_required(VERSION 3.8) project ...
- VS2008编译iconv静态链接库
iconv是将一种编码格式转换为还有一种编码格式的开源库,比如能够把Windows环境下通用的ASCii(中文是GB2312)编码转换为国际通用的Unicode编码 iconv最新版本号仅仅支持Min ...
- Win7 64位 VS2015及MinGW环境编译矢量库agg-2.5和cairo-1.14.6
书接上文,昨天装了MinGW,主要原因之一是要用到MSYS,所以顺手把FFMPEG又编译了一遍. 回到主题,其实我是想编译矢量库,因为最近要学习一些计算几何算法,所以找个方便的2D画图库就很重要. 说 ...
- Win7 VS2015及MinGW环境编译矢量库agg-2.5和cairo-1.14.6
书接上文,昨天装了MinGW,主要原因之一是要用到MSYS,所以顺手把FFMPEG又编译了一遍. 回到主题,其实我是想编译矢量库,因为最近要学习一些计算几何算法,所以找个方便的2D画图库就很重要. 说 ...
- QT中使用MinGW 编译的protobuf库--包含库的生成和使用
QT中使用MinGW 编译的protobuf库--包含库的生成和使用 0前言 1准备工作 2生成protobuf库文件 3在QT中测试protobuf的使用 4结语 0前言 最近要在QT中使用prot ...
- Windows 系统 vs2012 MinGW 编译ffmpeg 静态库
Windows系统下 vs2012编译ffmpeg 动态库 前面已经有文章讲述,本文将讲述如果编译生成ffmpeg静态库以方便 在vs2012下调用. 准备工作:安装MinGW环境,修改ffmpeg配 ...
- 解决嵌入式linux系统下iconv库的移植问题
一.解决问题 在arm开发板上使用framebuff,在汉字显示时,因为只有gb2312的16*16的汉字字库,而ubuntu16.04默认 的编码方式时utf-8,因此需要进行转码(ut ...
- 手把手教你在Windows下使用MinGW编译libav(参考libx264的编入)
转自:http://www.th7.cn/Program/cp/201407/242762.shtml 手把手教你在Windows下使用MinGW编译libav libav是在Linux下使用纯c语言 ...
随机推荐
- Codeforces Round #292 (Div. 1) C. Drazil and Park 线段树
C. Drazil and Park 题目连接: http://codeforces.com/contest/516/problem/C Description Drazil is a monkey. ...
- Oracle限制某个用户的连接数及PROFILE介绍
限制一个用户的链接数,可以通过ORACLE的PROFILE文件来实现 1. 查看resource_limit参数: SQL> show parameter resource_limit ...
- Snippet: align a TextView around an image
A few weeks ago I discovered the Spans on Android,after reading the wonderful post by Flavien Lauren ...
- 【转】安装OpenSSL缺失Microsoft Visual C++ 2008 Redistributables的解决方案
from: http://www.cnblogs.com/luguo3000/p/3539815.html 在安装OpenSSL的时候通常会提示以下错误: "The Win32 OpenSS ...
- The model backing the <Database> context has changed since the database was created.
Just found out the answer and thought of updating here. Just need to do the following. public class ...
- 【C#|.NET】lock(this)其实是个坑
这里不考虑分布式或者多台负载均衡的情况只考虑单台机器,多台服务器可以使用分布式锁.出于线程安全的原因,很多种场景大家可能看代码中看到lock的出现,尤其是在资金类的处理环节. 但是lock(this) ...
- iOS开发——iOS学习路线
iOS学习路线 版权声明:欢迎转载,请贴上源地址:http://www.cnblogs.com/iCocos/(iOS梦工厂) 一:自学初步学习路线 二:高级完整学习路线 三:完整知识与能力体系 思维 ...
- CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)
CentOS 7.0接触到的用户是比较少的,今天看了站长写了一篇关于centos7中安装配置LAMP服务器的教程,下面我把文章稍加整理一下转给大家学习交流,希望例子能给各位带来帮助哦. cento ...
- CentOS6下Haproxy的安装配置
Haproxy 是一个开源的负载均衡和反向代理软件,其提供了高可用的网络服务.其一般是应用于web服务,但同时也能为SMTP和终端服务等提供可靠的支持. 1.下载安装haproxy wget ftp: ...
- Quartz的线程池解析
[org.quartz.core相关类图] 可以看到核心类为QuartzScheduler [QuartzScheduler构造函数] public QuartzScheduler(QuartzSch ...