gettext库下载地 http://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.xz ./configure make make install1、zlib库的问题 如果发现报错,没有zlib库,ok,跑去安装zlib库,在终端输入sudo apt-get install zlib1g-dev configure: error: *** Working zlib library and headers not found *** 自glib-2.23开始就需要zlib,zlib是提供数据压缩用的函式库。 也可以从zlib Home Sitehttp://www.zlib.net/ (下载地址在网页的中间部分) 我下载了个zlib-1.2.8.tar.gz,解压、进目录,三部曲: ./configure make make install 2、libffi问题
No package 'libffi' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBFFI_CFLAGS and LIBFFI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. libffi
我下载了libffi-3.2.1.tar.gz,解压、进目录,三部曲: ./configure make make install3、pkg-config问题
configure: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_ConFIG environment variable to the full path to pkg-config.pkg-config能根据软件安装时软件的.pc配置文件路径找到相应的头文件路径和库文件路径。 pkg-config 我下载了pkg-config-0.29.1.tar.gz,解压、进目录,三部曲: ./configure make make install 如果第一步遇到如下错误:
configure: error: Either a previously installed pkg-config or "glib-2.0 >= 2.16" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy.只需要: ./configure --with-internal-glib 4、pcre问题
configure: error: Package requirements (libpcre >= 8.13) were not met: No package 'libpcre' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables PCRE_CFLAGS and PCRE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.PCRE - Browse /pcre at SourceForge.nethttps://sourceforge.net/projects/pcre/files/pcre/ 我下载了pcre-8.38.tar.gz,解压、进目录,改动的三部曲: ./configure --enable-utf8 --enable-unicode-properties makemake install 如果第一步只是./configure,到时候安装glib会继续报错: checking for Unicode support in PCRE... no configure: error: *** The system-supplied PCRE does not support Unicode properties or UTF-8. 所以第一步是为了解决Unicode、UTF-8的支持,仅限于pcre7.9以上版本 *安装pcre如果报错如下: configure: error: You need a C++ compiler for C++ support 那是你所用的linux没支持c++编译,只需要: apt-get install build-essential **当安装好pcre后,输入pcretest -C来打印pcre的安装情况,一般输出如下:
PCRE version 8.38 2015-11-23 Compiled with 8-bit support UTF-8 support Unicode properties support No just-in-time compiler support newline sequence is LF R matches all Unicode newlines Internal link size = 2 POSIX malloc threshold = 10 Parentheses nest limit = 250 Default match limit = 10000000 Default recursion depth limit = 10000000 Match recursion uses stack 而如果报错为: pcretest: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory pcretest: error while loading shared libraries: libpcreposix.so.0: cannot open shared object file: No such file or directory这种情况好像大多数linux都会发生,只需要自己建立一个软链接即可:
ln -s /usr/local/lib/libpcre.so.1 /lib ln -s /usr/local/lib/libpcreposix.so.0 /lib(如果之后还没用,可以考虑把/lib换/lib64) 三、 make时遇到的问题 1、
#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm); #pragma GCC diagnostic pop
进入glib中 打开gdate.c 删掉此行,复制以上代码
2、sudo vi gdbusauth.c 查找文件路径 #进入vi编辑器 根据错误找到第1295行 可在一般模式输入1302gg移动到该位置 #在错误前输入 if(line != NULL) #:wq退出保存 同理 sudo vi gdbusmessage.c #进入vi编辑器 根据错误找到第2698行 可在一般模式输入2702gg移动到该位置 输入命令 vim +2698 gdbusmessage.c #在错误前输入 if(signature_str!= NULL) #:wq退出保存四、测试安装是否成功
#include编译int main(void) { g_print("Hello, world!n"); return 0; }
gcc main.c `pkg-config --cflags --libs glib-2.0` -o hello



