安裝saltstack遇到的問題錦集

  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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章