轉(zhuǎn)載:http://blog.csdn.net/ztguang/article/details/51015587
參考:http://www.centoscn.com/image-text/install/2014/0905/3684.html
在CentOS7上安裝Codelocks的過(guò)程泊愧。
1.安裝gcc,需要c和c++兩部分,默認(rèn)安裝下,CentOS不安裝編譯器的,在終端輸入以下命令即可
yum install gcc
yum install gcc-c++
2.安裝gtk2-devel,因?yàn)槟J(rèn)已經(jīng)安裝了正式產(chǎn)品需要的支持庫(kù),但是沒(méi)有安裝開發(fā)所需要的文檔.
yum install gtk2*
3. 安裝wxGTK(或者wxwidgets)眠寿,下載地址:http://www.wxwidgets.org/downloads/,下載的文件為:wxWidgets-3.0.2.tar.bz2,
解壓之后,進(jìn)入目錄后執(zhí)行命令
./configure --enable-xrc --enable-monolithic --enable-unicode
make -j5
make install
------------------------------------------------------
The installation of wxWidgets is finished.? On certain
platforms (e.g. Linux) you'll now have to run ldconfig
if you installed a shared library and also modify the
LD_LIBRARY_PATH (or equivalent) environment variable.
wxWidgets comes with no guarantees and doesn't claim
to be suitable for any purpose.
Read the wxWindows Licence on licencing conditions.
------------------------------------------------------
ldconfig
4. 安裝codeblocks,下載codeblocks安裝包,下載地址:http://www.codeblocks.org/downloads/
這里有兩種方式進(jìn)行安裝:
第一種方式是直接下載rpm包,可以直接進(jìn)行安裝,但是rpm安裝形式,沒(méi)有默認(rèn)安裝可視設(shè)計(jì)wxsmith逻恐。
第二種方式是下載源代碼包,后綴為.tar.gz(.tar.bz2)峻黍,下載之后复隆,解壓縮,進(jìn)入目錄姆涩,執(zhí)行命令
./configure --prefix=/codeblocks --with-contrib-plugins=all
(如果只是./configure那默認(rèn)情況是不會(huì)安裝可視設(shè)計(jì)wssmith挽拂,如果不需要圖形界面開發(fā)的話可以直接使用第一種安裝方式)
-------------------------------------------------------------------------------
checking for GTK2... yes
checking for GAMIN... no
configure: error: Package requirements (gamin) were not met:
No package 'gamin' 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 GAMIN_CFLAGS
and GAMIN_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-------------------------------------------------------------------------------
解決上面問(wèn)題的方法:yum install gamin*
make -j5
make install
[root@localhost bin]# pwd
/codeblocks/bin
[root@localhost bin]# ./codeblocks
./codeblocks: error while loading shared libraries: libwx_gtk2u-3.0.so.0: cannot open shared object file: No such file or directory
----------------------------------------
vim /etc/ld.so.conf
最后一行添加:/usr/local/lib
保存退出,然后運(yùn)行l(wèi)dconfig即可骨饿。
----------------------------------------
[root@localhost bin]#ln -s /codeblocks/bin/codeblocks /root/桌面/codeblocks
+++++++++++++++++++++++++++++++下面供參考
5.安裝好codeblocks后亏栈,在application下會(huì)出現(xiàn)programming菜單項(xiàng),在這里可以啟動(dòng)codeblocks.
6.安裝一下xterm:yum install xterm
7.如果沒(méi)有看到codeblocks菜單項(xiàng)宏赘,可以:創(chuàng)建桌面啟動(dòng)器如下:
1绒北、點(diǎn)擊應(yīng)用程序--系統(tǒng)工具
2、選擇“啟動(dòng)應(yīng)用程序”
3察署、在啟動(dòng)用程序首選項(xiàng)中選擇“添加”
4闷游、會(huì)出現(xiàn)和以前一樣的添加啟動(dòng)程序?qū)υ捒颍M(jìn)行設(shè)置
5、設(shè)置完名稱和命令(路徑)后脐往,點(diǎn)擊“添加”休吠,啟動(dòng)器就被添加到列表里了
6、用鼠標(biāo)選中剛添加的啟動(dòng)器业簿,將其拖到桌面
7瘤礁、右擊新建的起動(dòng)器,選擇屬性梅尤,在權(quán)限選項(xiàng)卡中勾選——執(zhí)行:允許以程序執(zhí)行文件
8柜思、同上步,在基本選項(xiàng)卡中點(diǎn)擊圖標(biāo)巷燥,可以設(shè)置啟動(dòng)器的桌面圖標(biāo)赡盘。
+++++++++++++++++++++++++++++++下面不用看
++++++++++++++++++安裝wxWidgets
[root@localhost wxWidgets-3.0.2]# pwd
/opt/wxWidgets-3.0.2
[root@localhost wxWidgets-3.0.2]#./configure --prefix=/opt/wxWidgets --enable-xrc --enable-monolithic --enable-unicode
[root@localhost wxWidgets-3.0.2]#make -j5
[root@localhost wxWidgets-3.0.2]#make install
++++++++++++++++++安裝codeblocks
[root@localhost codeblocks-13.12]#./configure --prefix=/opt/codeblocks LDFLAGS="-Wl,-R /opt/wxWidgets/lib" --with-wx-config=/opt/wxWidgets/bin/wx-config
[root@localhost codeblocks-13.12]#make -j5
[root@localhost codeblocks-13.12]#make install
[root@localhost codeblocks-13.12]#/opt/codeblocks/bin/codeblocks
出現(xiàn)如下錯(cuò)誤:
codeblocks: error while loading shared libraries: libwx_gtk2u-3.0.so.0: cannot open shared object file
在/etc/ld.so.conf末尾加入一行:/opt/wxWidgets/lib/,
保存之后矾湃,再運(yùn)行:/sbin/ldconfig -v即可
[root@localhost codeblocks-13.12]#ln -s /opt/codeblocks/bin/codeblocks /root/桌面/codeblocks
++++++++++++++++++ 下面無(wú)用
操作系統(tǒng):CentOS 5.2
開發(fā)庫(kù):wxWidgets-2.8.12
軟件版本:codeblocks-10.05
一、安裝wxWidgets
./configure?? ??? ??? ?最好不要加上prefix參數(shù)堕澄,使用默認(rèn)設(shè)置會(huì)比較有利于后面步驟的順利推進(jìn))
make -j5
make install
二邀跃、設(shè)定環(huán)境變量LD_LIBRAY_PATH
1.仍在第一大步打開的終端,不改變目錄蛙紫,輸入以下命令:
ldconfig?? ??? ??? ?(這完全是根據(jù)第一步最后的提示信息來(lái)的)
export -p?? ??? ?(查看系統(tǒng)當(dāng)前環(huán)境變量的值拍屑,此步僅為了和設(shè)置后的效果作對(duì)比,可省略)
可以看到現(xiàn)在坑傅,LD_LIBRAY_PATH的值是空的(結(jié)果中沒(méi)有此項(xiàng)的存在)僵驰。
2.繼續(xù)輸入命令:
./wx-config --libs
得到結(jié)果(安裝目錄不同結(jié)果會(huì)有小差異):
-L/opt/wxWidgets-3.0.2/lib -pthread?? -Wl,-rpath,/opt/wxWidgets-3.0.2/lib -lwx_gtk2u-3.0
3.在/etc目錄下找到文件profile,打開它唁毒,在里面添加以下命令:
export LD_LIBRARY_PATH="…………"
引號(hào)里的內(nèi)容為上一小步“./wx-config --libs”的執(zhí)行結(jié)果蒜茴。export命令用于編輯環(huán)境變量,如果你不知道該加在什么位置浆西,請(qǐng)?jiān)谖募须S意另找一條export命令粉私,跟在他后面即可。保存profile文件近零。
4.還是在前面打開的終端诺核,繼續(xù)輸入命令:
source /etc/profile?? ??? ?(在不用重啟系統(tǒng)的情況下使profile修改的內(nèi)容生效)
export -p ?? ??? ??? ??? ?(查看系統(tǒng)當(dāng)前環(huán)境變量的值)
這回可以看到,LD_LIBRAY_PATH的值被成功設(shè)定為第2小步里“./wx-config --libs”的執(zhí)行結(jié)果久信。
三窖杀、安裝codeblocks
./configure --prefix=/opt/codeblocks (prefix參數(shù)用以指定安裝路徑)
make -j5
make install
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@localhost wxWidgets-3.0.2]# pwd
/opt/wxWidgets-3.0.2
[root@localhost wxWidgets-3.0.2]# ./configure --prefix=/opt/wxWidgets --enable-xrc --enable-monolithic --enable-unicode
[root@localhost wxWidgets-3.0.2]# make -j5
[root@localhost wxWidgets-3.0.2]# make install
export LDFLAGS="-Wl,-R /opt/wxWidgets/lib"
./configure --prefix=/opt/codeblocks --with-wx-config=/opt/wxWidgets-3.0.2/bin/wx-config
make -j5
make install
[root@localhost codeblocks-13.12]# ./bootstrap
./configure --prefix=/opt/codeblocks LDFLAGS="-Wl,-R /opt/wxWidgets/lib" --with-wx-config=/opt/wxWidgets/bin/wx-config
make -j5
make install
An alternative solution (untested) according to comments would be:
$ ./configure LDFLAGS="-Wl,-R /path/to/wxGTK/lib" # other configure flags omitted
$ make
$ make install
http://stackoverflow.com/questions/2203946/error-while-loading-shared-libraries
++++++++++++++++++
在/etc/ld.so.conf中加入/usr/local/lib這一行,保存之后裙士,再運(yùn)行:/sbin/ldconfig –v更新一下配置即可
./configure --prefix=/opt/codeblocks LDFLAGS="-Wl,-R /opt/wxWidgets/lib" --with-wx-config=/opt/wxWidgets/bin/wx-config
make -j5
make install
./configure --prefix=/opt/codeblocks --with-contrib-plugins=all
(如果只是./configure那默認(rèn)情況是不會(huì)安裝可視設(shè)計(jì)wssmith入客,如果不需要圖形界面開發(fā)的話可以直接使用第一種安裝方式)
make -j5
make install
++++++++++++++++++
[root@localhost codeblocks-13.12]# /opt/wxWidgets/bin/wx-config --prefix
/opt/wxWidgets
[root@localhost codeblocks-13.12]# /opt/wxWidgets/bin/wx-config --libs
-L/opt/wxWidgets/lib -pthread?? -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
[root@localhost codeblocks-13.12]# ./bootstrap
Found revision: '0' ''
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:86: warning: macro 'AM_OPTIONS_WXCONFIG' not found in library
configure.ac:87: warning: macro 'AM_PATH_WXCONFIG' not found in library
configure.ac:86: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:87: error: possibly undefined macro: AM_PATH_WXCONFIG
[root@localhost codeblocks-13.12]# find /opt/ -name wxwin.m4
^C
[root@localhost codeblocks-13.12]# find /opt/wxWidgets* -name wxwin.m4
/opt/wxWidgets/share/aclocal/wxwin.m4
/opt/wxWidgets-3.0.2/wxwin.m4
[root@localhost codeblocks-13.12]# cp /opt/wxWidgets-3.0.2/wxwin.m4 /usr/share/aclocal
aclocal/????? aclocal-1.13/
[root@localhost codeblocks-13.12]# cp /opt/wxWidgets-3.0.2/wxwin.m4 /usr/share/aclocal
[root@localhost codeblocks-13.12]# ./bootstrap
Found revision: '0' ''
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
[root@localhost codeblocks-13.12]#