Linux7.3 glib-2.49安装记录
由于 Linux系统较新,所在glib选择了较新的glib-2.49,安装过程遇到颇多错误,这里只记录正确的成功的安装记录。
# rpm -q ncurses readline lua libffi libffi-devel libiconv xz glib2 cmake popt libnl libevent libevent-devel openssl-devel
ncurses-5.9-14.20130511.el7_4.x86_64
readline-6.2-10.el7.x86_64
lua-5.1.4-15.el7.x86_64
libffi-3.0.13-18.el7.x86_64
libffi-devel-3.0.13-18.el7.x86_64
未安装软件包 libiconv
xz-5.2.2-1.el7.x86_64
glib2-2.46.2-4.el7.x86_64
cmake-2.8.12.2-2.el7.x86_64
popt-1.13-16.el7.x86_64
libnl-1.1.4-3.el7.x86_64
libevent-2.0.21-4.el7.x86_64
libevent-devel-2.0.21-4.el7.x86_64
openssl-devel-1.0.2k-8.0.1.el7.x86_64
libffi依赖包
ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz
tar -zxvf libffi-3.0.13.tar.gz
cd libffi-3.0.13/
./configure --prefix=/usr/local
make
make install
# ll /usr/local/lib | grep libffi
drwxr-xr-x 3 root root 20 11月 20 14:45 libffi-3.0.13
libiconv依赖包
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xvzf libiconv-1.14.tar.gz
cd libiconv-1.14
cd srclib
sed -i -e '/gets is a security/d' ./stdio.in.h
cd ..
注意不要建立独立目录,一定要安装在/usr/local目录下,不然安装glib时会报/usr/bin/ld: cannot find -liconv
./configure --prefix=/usr/local gl_cv_header_working_stdint_h=yes
make
make install
pkg安装
pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use gcc -o test test.c `pkg-config --libs --cflags glib-2.0` for instance,
rather than hard-coding values on where to find glib (or other libraries). It is language-agnostic, so it can be used for defining the location of documentation tools, for instance.
https://www.freedesktop.org/wiki/Software/pkg-config/
tar -zxvf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2/
./configure --enable-iconv=no --with-libiconv=gnu --with-internal-glib
make
make install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2
# pkg-config --version
0.29.2
pcre安装
https://sourceforge.net/projects/pcre/files/pcre/
tar -zxvf pcre-8.39.tar.gz
cd pcre-8.39/
./configure --enable-utf8 --enable-unicode-properties
pcre-8.39 configuration summary:
Install prefix .................. : /usr/local
C preprocessor .................. : gcc -E
C compiler ...................... : gcc
C++ preprocessor ................ : g++ -E
C++ compiler .................... : g++
Linker .......................... : /usr/bin/ld -m elf_x86_64
C preprocessor flags ............ :
C compiler flags ................ : -g -O2 -fvisibility=hidden
C++ compiler flags .............. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden
Linker flags .................... :
Extra libraries ................. :
Build 8 bit pcre library ........ : yes
Build 16 bit pcre library ....... : no
Build 32 bit pcre library ....... : no
Build C++ library ............... : yes
Enable JIT compiling support .... : no
Enable UTF-8/16/32 support ...... : yes
Unicode properties .............. : yes
Newline char/sequence ........... : lf
\R matches only ANYCRLF ......... : no
EBCDIC coding ................... : no
EBCDIC code for NL .............. : n/a
Rebuild char tables ............. : no
Use stack recursion ............. : yes
POSIX mem threshold ............. : 10
Internal link size .............. : 2
Nested parentheses limit ........ : 250
Match limit ..................... : 10000000
Match limit recursion ........... : MATCH_LIMIT
Build shared libs ............... : yes
Build static libs ............... : yes
Use JIT in pcregrep ............. : no
Buffer size for pcregrep ........ : 20480
Link pcregrep with libz ......... : no
Link pcregrep with libbz2 ....... : no
Link pcretest with libedit ...... : no
Link pcretest with libreadline .. : no
Valgrind support ................ : no
Code coverage ................... : no
make
make install
ln -s /usr/local/lib/libpcre.so.1 /lib
ln -s /usr/local/lib/libpcreposix.so.0 /lib
glib安装
http://ftp.acc.umu.se/pub/GNOME/sources/glib/
xz -d glib-2.49.7.tar.xz
chown -R root.root *
tar -xvf glib-2.49.7.tar
mkdir /usr/local/glib-2.49.7
cd glib-2.49.7/
./configure --prefix=/usr/local/glib-2.49.7 --with-libiconv=gnu LIBFFI_CFLAGS="-I/usr/local/include" LIBFFI_LIBS="-L/usr/local/lib -lffi"
# vim ./configure
在7880行之上添加如下内容:
found_iconv=yes
esac
found_iconv=yes
if test "x$found_iconv" = "xno" ; then
as_fn_error $? "*** No iconv() implementation found in C library or libiconv" "$LINENO" 5
fi
fi
make阶段
ln -s /usr/local/lib/libffi-3.0.13/include/ffi.h /usr/local/include
ln -s /usr/local/lib/libffi-3.0.13/include/ffitarget.h /usr/local/include
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2
make
make install
配置PKG-CONFIG
# find /usr/ -name pkgconfig
/usr/lib64/pkgconfig
/usr/share/pkgconfig
/usr/local/lib/pkgconfig
/usr/local/lib64/pkgconfig
/usr/local/mysql/lib/pkgconfig
/usr/local/glib-2.49.7/lib/pkgconfig
# cd /usr/local/glib-2.49.7/lib/pkgconfig
# ls
gio-2.0.pc gio-unix-2.0.pc glib-2.0.pc gmodule-2.0.pc gmodule-export-2.0.pc gmodule-no-export-2.0.pc gobject-2.0.pc gthread-2.0.pc
vim .bash_profile
export PKG_CONFIG_PATH=/usr/local/glib-2.49.7/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/mysql/lib/pkgconfig:$PKG_CONFIG_PATH
. ./.bash_profile
编译测试
vim hello.c
#include <stdio.h>
#include <glib.h>
int main(int argc, char** argv){
GList* list=NULL;
list=g_list_append(list,"Hello world!");
list=g_list_append(list,"made by pcat");
list=g_list_append(list,"http://www.cnblogs.com/perfei/");
printf("The first item is %s\n",g_list_first(list)->data);
return 0;
}
编译如下:
gcc hello.c -o hello $(pkg-config --cflags --libs glib-2.0)
# ls -ltr | grep hello
-rw-r--r-- 1 root root 305 11月 20 16:47 hello.c
-rwxr-xr-x 1 root root 8648 11月 20 17:05 hello
# ./hello
The first item is Hello world!
Linux7.3 glib-2.49安装记录的更多相关文章
- 分布式监控系统Zabbix-3.0.3-完整安装记录(7)-使用percona监控MySQL
前面已经介绍了分布式监控系统Zabbix-3.0.3-完整安装记录(2)-添加mysql监控,但是没有提供可以直接使用的Key,太过简陋,监控效果不佳.要想更加仔细的监控Mysql,业内同学们都会选择 ...
- 关于node.js和npm,cnpm的安装记录以及gulp自动构建工具的使用
关于node.js和npm,cnpm的安装记录以及gulp自动构建工具的使用 工作环境:window下 在一切的最开始,安装node.js (中文站,更新比较慢http://nodejs.cn/) ...
- sourceinsight安装记录
sourceinsight安装记录 此文章为本人使用sourceinsight一个星期之后的相关设置步骤记录和经验记录,以备以后查验,网上的相关资料都也较为完善,但是对于新手还是有一定困难的,所以在这 ...
- openerp安装记录及postgresql数据库问题解决
ubuntu-14.04下openerp安装记录1.安装PostgreSQL 数据库 a.安装 sudo apt-get install postgresql 安装后ubu ...
- Matlab安装记录 - LED Control Activex控件安装
Matlab安装记录-LED Control Activex控件安装 2013-12-01 22:06:36 最近在研究Matlab GUI技术,准备用于制作上位机程序:在Matlab GUI的技术 ...
- Arch Linux 安装记录
Arch Linux 安装记录 基本上参考wiki上的新手指南,使用arch 2014.6.1 iso安装 设置网络 有线网络 Arch Linux 默认开启DHCP. 静态ip 首先关闭DHCP:s ...
- redis5.0.3单实例简单安装记录
redis5.0.3单实例简单安装记录 日常需要测试使用,索性记录下来,免得临时又麻烦的找资料. yum -y install make gcc-c++ cmake bison-devel ncurs ...
- mysql5.7安装记录
mysql安装记录 版本5.7 windows系统 一.缺少my.ini文件 [mysql]# 设置mysql客户端默认字符集default-character-set=utf8 [mysqld]#设 ...
- Liunx/RHEL6.5 Oracle11 安装记录
1.创建用户组 groupadd oinstall #创建用户组oinstall groupadd dba #创建用户组dba useradd -g oinstall -g dba -m oracle ...
随机推荐
- 202. Happy Number 平方循环数
[抄题]: Write an algorithm to determine if a number is "happy". A happy number is a number d ...
- 在Linux里安装jdk
一.系统环境说明: [操作系统]:Ubuntu 18.04.1 Desktop [JDK]:jdk1.8.0_181,文件名称:jdk-8u181-linux-x64.tar 二.准备jdk文件 下载 ...
- 100725B Banal Tickets
传送门 题目大意 有2*n个位置,这些位置有的已经填上了数,有的还没有(用?表示),现在让你在还没有填上数的填0~9中的任意数,使得前n个数的乘积等于后n个数的乘积,问有多少种方案. 分析 首先这个题 ...
- Luogu 3008 [USACO11JAN]道路和飞机Roads and Planes
BZOJ2200 听说加上slf优化的spfa的卡过,真的不想写这些东西. 考虑使用堆优化的dij算法. 先加上所有双向边,然后dfs一下搜出所有由双向边构成的联通块,然后加上所有的单向边,一边对所有 ...
- ubuntu nvidia驱动+cuda9.0
https://blog.csdn.net/fdqw_sph/article/details/78745375
- 获取安装的apk应用信息
//获取安装的应用名称 private List<String> getInstalledAppNames(){ List<PackageInfo> packages =thi ...
- java反射机制的粗略理解
java反射机制: 涉及的对象:Class, Object, 函数:Class类:[forName(String className):static:getClass():public],Object ...
- javax.servlet.ServletConfig接口(五)
主要作用是保存web.xml文件里面的配置信息 一个servlet对应一个ServletConfig,100个servlet对应100个ServletConfig. 代码如下(单个获取和获取所有) ...
- symbol访问法及symbor注册表
symbol主要作用是防止对象属性名冲突 在ES6之前,对象的属性名只能是字符串,这样很容易造成字符串的冲突. 例:假设person对象是从外部库引入的一个对象 let person = { name ...
- [转]Marshaling a SAFEARRAY of Managed Structures by P/Invoke Part 2.
1. Introduction. 1.1 In part 1 of this series of articles, I explained how managed arrays may be tra ...