樹莓派3B編譯安裝Apache,nginx,mysql,php等遇到的問題

樹莓派編譯安裝LANMP

  1. 簡介

    我這裏的樹莓派是3B版本,CPU4核,內存1G,系統我用的是Ubuntu的19.10版。鏡像採用阿里的鏡像,鏡像源如下:

    deb https://mirrors.aliyun.com/ubuntu-ports eoan main restricted
    
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-updates main restricted
    
    deb https://mirrors.aliyun.com/ubuntu-ports eoan universe
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-updates universe
    
    deb https://mirrors.aliyun.com/ubuntu-ports eoan multiverse
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-updates multiverse
    
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-backports main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-security main restricted
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-security universe
    deb https://mirrors.aliyun.com/ubuntu-ports eoan-security multiverse

------------ 問題1
編譯安裝apr-util-1.5版本時出現如下錯誤
libtool: error: 'crypto/crypt_blowfish.lo' is not a valid libtool object
這種情況有可能是前面編譯時有緩存,用make clean清除一下再次編譯安裝

---------------問題2

HTTP編譯時出現如下錯誤可能是由於apr-util版本太高,換成1.5的版本試試
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/httpd-2.4.26/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/httpd-2.4.26/support'
make: *** [all-recursive] Error 1

---------問題3
NGINX編譯時出現問題
src/http/ngx_http_script.c:698:18: error: cast between incompatible function types from ‘size_t ()(ngx_http_script_engine_t )’
{aka ‘long unsigned int ()(struct <anonymous> )’} to ‘void ()(ngx_http_script_engine_t )’ {aka ‘void ()(struct <anonymous> )’}
[-Werror=cast-function-type]
這個錯誤把MakeFile文件中的werror這個刪除調,然後清理編譯緩存,make clean 重新編譯

---------------問題4
在編譯安裝mariadb10.1.43時出現:cc: fatal error: Killed signal terminated program cc1
這種情況應該是內存不足造成的,我從網上看到的方法是使用交換內存,但是由於樹莓派是直接用TF卡安裝的,開始沒有設置swap,後來我設置了還是報這個錯誤----內部編譯錯誤
後來我的解決方法不安裝Mariadb數據庫,改用MySQL5.6,結果是編譯成功了的。

--------------問題5
編譯PHP時出現:
make: *** [Makefile:584: ext/openssl/openssl.lo] Error 1
error: storage size of ‘cipher_ctx’ isn’t known
4848 | EVP_CIPHER_CTX cipher_ctx;
這種情況是OpenSSL最新版本接口調用變化所致,更換PHP爲較新版本試一下或者使用OpenSSL較舊的版本


PHP編譯安裝配置:

./configure --prefix=/usr/local/php5.3 --enable-mbstring --enable-xml --enable-fpm --enable-sockets --with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \
--with-libxml-dir=/usr --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 \
--with-mysql=/usr/local/mysql --enable-pcntl --enable-dba --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --enable-ftp \
--enable-embedded-mysqli --with-webp-dir --enable-debug --enable-bcmath --with-ldap --with-gettext

1

NOTE樹莓派編譯安裝時出現:onfigure: error: can not guess host type; you must specify one,這種情況除了要加--build=arm-linux,還有加上--host=localhost
Php7.1.33版本要求OpenSSL必須大於1.0.1版本:--with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)
要求zlib大於1.2.0.4版本 --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.2.0.4)
2
編譯時出現:freetype-config not found錯誤時,應該是libfreetype-dev版本比較高,在Ubuntu19.10上是版本6.可以下載2.8.1解決這個問題

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