當前位置:首頁 » 編程軟體 » androidcentos編譯環境

androidcentos編譯環境

發布時間: 2023-05-20 08:37:00

A. centos7系統源碼編譯安裝php7.3.5版本

新增系統用戶組和用戶:

下載 PHP7.3.5

[root@localhost ~]# mkdir devdir

[root@localhost ~]# cd devdir/

[root@localhost devdir]# wget https://www.php.net/distributions/php-7.3.5.tar.gz

-bash: wget: 未找到命令

[root@localhost devdir]# rpm -qa|grep wget

[root@localhost devdir]# yum -y install wget

[root@localhost devdir]# rpm -qa|grep wget

wget-1.14-18.el7.x86_64

下載PHP7 解壓 編譯

wget -c https://downloads.php.net/~cmb/php-7.3.4.tar.gz

編譯參數解釋

--with-fpm-user=webu --with-fpm-group=webg 添加PHP運行用戶和用戶組

配置信息出錯:

下載gcc軟體編譯器 yum install -y gcc

configure: error: libxml2 not found. Please check your libxml2 installation.

下載libzip-1.5.2.tar.gz

https://libzip.org/download/libzip-1.5.2.tar.gz

解決libzip 和cmake版本問題

重新配置PHP7編譯環境參數

libzip-1.5.2 無法安裝,已經取消了。

提示off_t類型沒有定義 undefind,解決方法:

編譯安裝

測試PHP是否安裝成功

轉載自:https://my.oschina.net/u/4127346/blog/3047778

B. centos7怎麼編譯安裝gcc-c++

方法/步驟
1
yum install glibc-static libstdc++-static -y
安裝c和c++的靜態庫(據說如果系統中缺少libc.a和libstdc++.a編譯時會出錯,但是我沒有那麼多閑情逸致去試,實踐過的朋友可以回復一下,分享一下經驗,讓大家都長長見識)

2
下載解壓gcc,我的gcc目錄是gcc-4.8.0
3
進入gcc目錄,執行:
./contrib/download_prerequisites
這個神奇的腳本文件會幫我們下載、配置、安裝那三個依賴的庫。可以節約我們大量的時間和精力。
4
你以為這三個庫自動下載了、自動make install了就沒事了嗎?錯!
很多人在編譯gcc的時候出現各種奇奇怪怪的錯誤就是這步沒有做好。
它們還不在.so文件的搜索路徑裡面,需要加進去,最後切記切記一定要執行一下ldconfig。
大致做法為:
1,找到你的共享庫文件被install到哪個目錄了(updatedb+locate命令)。
2,如果你的庫不是直接放在/lib或/usr/lib下,需要修改/etc/ld.so.conf文件,加入你的共享庫的路徑
3,如果在2中添加了共享庫路徑,切記要執行一下ldconfig,更新響應cache文件讓系統能找到你的共享庫。
5
建立臨時目錄,這個目錄用以存放編譯時的大量臨時文件,是文檔要求中必須的。
我是在gcc-4.8.0下建立了一個名為gcc-build-4.8.0的目錄,進入它。
mkdir gcc-build-4.8.0
cd gcc-build-4.8.0
配置gcc編譯選項
6
強烈建議閱讀INSTALL目錄下的說明文檔,尤其是configure.html,以確定你的編譯選項。
比較基本的選項有--enable-languages,說明你要讓你的gcc支持那些語言,--disable-multilib不生成編譯為其他平台可執行代碼的交叉編譯器。--disable-checking生成的編譯器在編譯過程中不做額外檢查,也可以使用--enable-checking=xxx來增加一些檢查。
網上還說了什麼--with-gmp、--with-mpfr、--with-mpc這三個選項,但是如果你3,4步做好了,就不要配了,反之你還是老實點吧別抱僥幸心理了。
調用gcc-4.8.0目錄下的configure文件:
例如:
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
7
執行
../make #不解釋

執行編譯命令(#在8核的虛擬機上進行編譯,每個核分配2個編譯任務)
make -j16
make install編譯過程CPU 核基本100%佔用,整個編譯用時11分50秒。
檢查gcc版本

#你就等吧少年,建議晚上睡覺前做
當然上面三步一定要在前一步順利結束的情況下進行,如果哪一步出錯了,結果都顯示error了,就不要再做後面的了。在shell的輸出里搜索"error"看具體的出錯點是什麼,、google一下為什麼。
如果你求穩的話,可以在make install之前先make check一下。

C. CentOS 7下的C語言程序編程與執行

若要明明腔在CentOS7下執行C語言程序,首先得給系槐畢統安裝gcc編譯環境。

輸入命令:which gcc 查看系統是否有安裝gcc,

若系統沒有安裝gcc,輸入命令:yum -y install gcc automake autoconf libtool make進行安裝

安裝完gcc後,讓咱激衫們開始來編寫第一個C語言程序吧,首先在桌面新建一個文件hello.c文件,

雙擊打開,

編寫C語言程序

點擊保存,退出

在終端輸入命令:gcc hello.c -o hello回車,進行編譯

生產可執行文件

然後輸入./hello,執行可執行文件

看見,此時終端列印出hello world!,說明執行成功.

D. centos7.0如何檢查gcc編譯環境

1,安裝gcc,執行如下的幾個yum命令即可 Java代碼 yum -y install gcc yum -y install gcc-c++ yum install make yum install autoconf automake libtool cmake ncurses-devel openssl-devel gcc* 2,安裝JDK,並設置環境變數,完成後測試安裝成功

E. centos7怎麼編譯安裝gcc-c++

下為最近升級gcc4.9.2的實際操作步驟
環境: CentOS-7.2 , 當前版本為gcc-4.8.5,用root進行安裝

1、先要執行下面這一條命令,安裝g++:
yum install gcc-c++

2、 gcc 編譯需要三個額外庫gmp、mpfr、mpc,下載並按照下面的順序安裝它們,如下:
wget ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.gz
wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.gz
wget http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz

tar -zxvf gmp-5.1.3.tar.gz
cd gmp-5.1.3
./configure
make && make install
cd ..

tar -zxvf mpfr-3.1.2.tar.gz
cd mpfr-3.1.2
./configure
make && make install
cd ..

tar -zxvf mpc-1.0.tar.gz
cd mpc-1.0
./configure
make && make install
cd ..

3、安裝gcc:
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.bz2
tar -jxvf gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./contrib/download_prerequisites
cd ..

mkdir gcc-build-4.9.2

cd gcc-build-4.9.2
../gcc-4.9.2/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

make
make install

4、修改/usr/bin/下gcc版本
執行/usr/bin/gcc --version查看版本:
gcc (GCC) 4.4.7-4
/usr/local/bin/gcc --version:
gcc (GCC) 4.8.2
發現多個版本的gcc。

此時執行以下操作:
mv /usr/bin/gcc /usr/bin/gcc4.4.7
ln -s /usr/local/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++4.4.7
ln -s /usr/local/bin/g++ /usr/bin/g++
mv /usr/bin/cc /usr/bin/cc4.4.7
ln -s /usr/local/bin/gcc /usr/bin/cc
mv /usr/bin/c++ /usr/bin/C++4.4.7
ln -s /usr/local/bin/c++ /usr/bin/c++

export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

5、檢查動態庫:
strings /usr/lib64/libstdc++.so.6 | grep GLIBC

F. 請教如何在Centos 下安裝C/C++編譯,開發環境

不知道你要使用哪種庫,現在qt比較合適,如果你要求跨平台的話。開發環境就是qtcreator

G. centos7怎麼編譯安裝nginx

安裝環境為:最小化安裝的centos7,關閉seliunx。
最小化安裝centos:
關閉selinux
sed –i 『s/SELINUX=enforcing/SELINUX=disabled/g』 /etc/selinux/config

開始安裝nginx1.7.8
創建群組
groupadd www
創建一個用戶,不允許登陸和不創主目錄
useradd -s /sbin/nologin -g www -M www
#下載最新版nginx
wget -C http://nginx.org/download/nginx-1.7.8.tar.gz
tar zxvf nginx-1.7.8.tar.gz
#編譯基本能運行的nginx
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_mole --with-http_ssl_mole --with-http_gzip_static_mole
make
make install

如果有錯誤提示:
./configure: error: C compiler cc is not found
解決方法:
yum install gcc gcc-c++

如果有錯誤提示:
./configure: error: the HTTP rewrite mole requires the PCRE library.
You can either disable the mole by using –without-http_rewrite_mole
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre=<path> option.
解決方法:
yum install pcre-devel

如果有錯誤提示:
./configure: error: SSL moles require the OpenSSL library.
You can either do not enable the moles, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using –with-openssl=<path> option.
解決方法:
yum install openssl-devel

以上錯誤提示依次解決後:再一次的運行
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_mole --with-http_ssl_mole --with-http_gzip_static_mole
make
meke install

編譯參數解釋:
#指定運行許可權的用戶
--user=www
#指定運行的許可權用戶組
--group=www
#指定安裝路徑
--prefix=/usr/local/nginx
#支持nginx狀態查詢
--with-http_stub_status_mole
#開啟ssl支持
--with-http_ssl_mole
#開啟GZIP功能
--with-http_gzip_static_mole

因此要順利的通過nginx編譯安裝必須安裝的依賴關系有:
yum install gc gcc gcc-c++ pcre-devel zlib-devel openssl-devel

2、在 centos7 中為nginx的啟動、重啟、重載配置添加腳本
nginx直接啟動的方法:
/usr/local/nginx/sbin/nginx

但是不是很方便,因此使用下面的腳本來控制nginx的啟動關閉重載更加合理一些。
編輯文件:vim /usr/lib/systemd/system/nginx.service 添加下面的腳本,注意路徑 !
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

systemctl的一些使用方法:
systemctl is-enabled servicename.service #查詢服務是否開機啟動
systemctl enable xxx.service #開機運行服務
systemctl disable xxx.service #取消開機運行
systemctl start xxx.service #啟動服務
systemctl stop xxx.service #停止服務
systemctl restart xxx.service #重啟服務
systemctl reload xxx.service #重新載入服務配置文件
systemctl status xxx.service #查詢服務運行狀態
systemctl --failed #顯示啟動失敗的服務

因此,添加上面腳本後,centos7 中操作nginx的方法有
systemctl is-enabled nginx.service #查詢nginx是否開機啟動
systemctl enable nginx.service #開機運行nginx
systemctl disable nginx.service #取消開機運行nginx
systemctl start nginx.service #啟動nginx
systemctl stop nginx.service #停止nginx
systemctl restart nginx.service #重啟nginx
systemctl reload nginx.service #重新載入nginx配置文件
systemctl status nginx.service #查詢nginx運行狀態
systemctl --failed #顯示啟動失敗的服務

熱點內容
64位access資料庫 發布:2025-07-17 05:35:58 瀏覽:374
php文件的相對路徑 發布:2025-07-17 05:34:22 瀏覽:711
矢量的叉乘運演算法則 發布:2025-07-17 05:29:41 瀏覽:661
dell雲存儲伺服器 發布:2025-07-17 05:21:06 瀏覽:255
銑床怎麼編程 發布:2025-07-17 05:20:29 瀏覽:776
sql11oracle 發布:2025-07-17 05:15:39 瀏覽:744
全國各地移動dns伺服器ip地址 發布:2025-07-17 05:07:47 瀏覽:312
sdvn加密 發布:2025-07-17 05:01:36 瀏覽:739
怎麼提取電腦緩存中的音樂 發布:2025-07-17 04:53:14 瀏覽:27
網路主根伺服器是什麼 發布:2025-07-17 04:44:31 瀏覽:350