1. 安装libsodium-1.0.1

    执行./autogen.sh时候,报如下错误:

    automake --foreign --copy --add-missing -Woverride

    src/common/compress/Makefile.am:9: Libtool library used but `LIBTOOL' is undefined

    src/common/compress/Makefile.am:9: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'  

    src/common/compress/Makefile.am:9: to `configure.ac' and run `aclocal' and `autoconf' again.

    src/common/compress/Makefile.am:9: If `AC_PROG_LIBTOOL' is in `configure.ac', make sure src/common/compress/Makefile.am:9: its definition is in aclocal's search path.

    观点一:

    原因分析:aclocal是个扫描程序, 负责扫描configure.ac中所有的宏定义并展开,上面产生的原因就是找不到LIBTOOL宏的定义之处造成的.

    原因就是aclocal与libtool没有安装在一个相同目录下面,aclocal是去默认 安装目录 /usr/share/aclocal下面搜索所有的.m4文件找所定义的宏,安装libstool的时候最好指定--prefix=/usr,但有时候,就算将libtool安装到/usr下,有时候也会出现这个问题,这是由于安装了多个aclocal,可能aclocal目录不存在,实际目录为/usr/share/aclocal1.15等,这就造成了aclocal找不到m4文件的情况, 解决办法就是将文件夹aclocal1.15重命名为aclocal.

    当然,如果/usr/share/下有aclocal,还是报这些错误的话,那可能是aclocal里的m4文件不全,那么需要删除该aclocal,将aclocal1.15拷贝并命名为aclocal,之所以不是mv,那是因为安装libsodium-1.0.1,还需要用到aclocal1.15......

    或者显示指定路径 aclocal -I /usr/share/aclocal1.15 -I /usr/share/libtool/m4 --install

    或者把/usr/share/libtool/m4下面的文件都copy至/usr/share/aclocal1.15中.

         但这个问题解决后,也许还会报:

    configure.ac:418: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
         If this token and others are legitimate, please use m4_pattern_allow.
           See the Autoconf documentation.
    autoreconf:  /usr/bin/autoconf  failed with  exit  status: 1

    这说明的是你没有装或者系统没有识别libtool,重新安装即可!

2.安装zeromq-4.1.5报错:

configure.ac:251: error: possibly undefined macro: AC_MSG_ERROR

      If this token and others are legitimate, please use m4_pattern_allow.

      See the Autoconf documentation.

autoreconf: /usr/bin/autoconf failed with exit status: 1

autogen.sh: error: autoreconf exited with status 0

查了半天,原来是pkgconfig包需要安装,可是我用rpm -ql|grep pkgconfig发现系统有这个包,但不知为何没有识别出来,看来只能重新安装了!重新安装没有问题了!

3.CentOS在安装openssl的时候,make时有一小半几率遇到下面的错误:

rc4test.o: In function `main':
rc4test.c:(.text+0x30): undefined reference to `OPENSSL_cpuid_setup'
collect2: ld returned 1 exit status

有两种解决方法:

1)安装pycrypto-2.6.1.tar.gz,然后再次安装openssl

2)加入一个参数,./config -fPIC -DOPENSSL_PIC 下面对-fPIC参数的说明,至于第二个参数我没有找到解释:

-fPIC 作用于编译阶段,告诉编译器产生与位置无关代码(Position-Independent Code),
 
 则产生的代码中,没有绝对地址,全部使用相对地址,故而代码可以被加载器加载到内存的任意
 
 位置,都可以正确的执行。这正是共享库所要求的,共享库被加载时,在内存的位置不是固定的。

gcc -shared -fPIC -o 1.so 1.c

这里有一个-fPIC参数

PIC就是position independent code

PIC使.so文件的代码段变为真正意义上的共享

如果不加-fPIC,则加载.so文件的代码段时,代码段引用的数据对象需要重定位, 重定位会修改代码段的内容,这就造成每个使用这个.so文件代码段的进程在内核里都会生成这个.so文件代码段的copy.每个copy都不一样,取决于 这个.so文件代码段和数据段内存映射的位置.

不加fPIC编译出来的so,是要再加载时根据加载到的位置再次重定位的.(因为它里面的代码并不是位置无关代码)
如果被多个应用程序共同使用,那么它们必须每个程序维护一份so的代码副本了.(因为so被每个程序加载的位置都不同,显然这些重定位后的代码也不同,当然不能共享)
fPIC与动态链接可以说基本没有关系,libc.so一样可以不用fPIC编译,只是这样的so必须要在加载到用户程序的地址空间时重定向所有表目.


4.安装requests报错:

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python2.7/ssl.py", line 97, in <module>

    import _ssl             # if we can't import it, let the error propagate

ImportError: No module named _ssl

执行python

Python 2.7.12 (default, Oct 12 2016, 15:49:19) 

[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import ssl

执行import ssl,若是还是报ImportError: No module named _ssl,需要vim Python-2.7.12/Modules/Setup

214、219、220、221行将“#”去掉 ,如:   

 _socket socketmodule.c timemodule.c

 _ssl _ssl.c \

         -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \

         -L$(SSL)/lib -lssl -lcrypto

然后重新编译:make && make install

5.安装MySQL-python报错:

Downloading/unpacking mysql-python  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded  Running setup.py egg_info for package mysql-python
    sh: mysql_config: not found    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/zjm1126/zjm_test/mysite/build/mysql-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

需要安装mysql-devel python-devel