(OK) CentOS7 安装 Codeblocks

参考:http://www.centoscn.com/image-text/install/2014/0905/3684.html

 在CentOS7上安装Codelocks的过程。

1.安装gcc,需要c和c++两部分,默认安装下,CentOS不安装编译器的,在终端输入以下命令即可
yum install gcc
yum install gcc-c++

2.安装gtk2-devel,因为默认已经安装了正式产品需要的支持库,但是没有安装开发所需要的文档.
yum install gtk2*

3. 安装wxGTK(或者wxwidgets),下载地址:http://www.wxwidgets.org/downloads/,下载的文件为:wxWidgets-3.0.2.tar.bz2,

解压之后,进入目录后执行命令

./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/

这里有两种方式进行安装:

第一种方式是直接下载rpm包,可以直接进行安装,但是rpm安装形式,没有默认安装可视设计wxsmith。

第二种方式是下载源代码包,后缀为.tar.gz(.tar.bz2),下载之后,解压缩,进入目录,执行命令

./configure --prefix=/codeblocks --with-contrib-plugins=all
(如果只是./configure那默认情况是不会安装可视设计wssmith,如果不需要图形界面开发的话可以直接使用第一种安装方式)
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------
解决上面问题的方法: 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
保存退出,然后运行 ldconfig 即可。
----------------------------------------


[root@localhost bin]# ln -s /codeblocks/bin/codeblocks /root/桌面/codeblocks



+++++++++++++++++++++++++++++++下面供参考

5.安装好codeblocks后,在application下会出现programming菜单项,在这里可以启动codeblocks.


6.安装一下xterm:yum install xterm

7.如果没有看到codeblocks菜单项,可以:创建桌面启动器如下:

 
1、点击应用程序--系统工具
2、选择“启动应用程序”
3、在启动用程序首选项中选择“添加”
4、会出现和以前一样的添加启动程序对话框,进行设置
5、设置完名称和命令(路径)后,点击“添加”,启动器就被添加到列表里了
6、用鼠标选中刚添加的启动器,将其拖到桌面
7、右击新建的起动器,选择属性,在权限选项卡中勾选——执行:允许以程序执行文件
8、同上步,在基本选项卡中点击图标,可以设置启动器的桌面图标。


+++++++++++++++++++++++++++++++下面不用看


++++++++++++++++++安装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
出现如下错误:
codeblocks: error while loading shared libraries: libwx_gtk2u-3.0.so.0: cannot open shared object file
/etc/ld.so.conf末尾加入一行:/opt/wxWidgets/lib/,
保存之后,再运行:/sbin/ldconfig -v  即可

[root@localhost codeblocks-13.12]# ln -s /opt/codeblocks/bin/codeblocks /root/桌面/codeblocks


++++++++++++++++++ 下面无用

操作系统:CentOS 5.2
开发库:wxWidgets-2.8.12
软件版本:codeblocks-10.05

一、安装wxWidgets

./configure            最好不要加上prefix参数,使用默认设置会比较有利于后面步骤的顺利推进)
make -j5
make install

二、设定环境变量LD_LIBRAY_PATH

1.仍在第一大步打开的终端,不改变目录,输入以下命令:
ldconfig            (这完全是根据第一步最后的提示信息来的)
export -p        (查看系统当前环境变量的值,此步仅为了和设置后的效果作对比,可省略)
                可以看到现在,LD_LIBRAY_PATH的值是空的(结果中没有此项的存在)。
2.继续输入命令:
./wx-config --libs
        得到结果(安装目录不同结果会有小差异):
        -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="…………"
        引号里的内容为上一小步“./wx-config --libs”的执行结果。export命令用于编辑环境变量,如果你不知道该加在什么位置,请在文件中随意另找一条export命令,跟在他后面即可。保存profile文件。

4.还是在前面打开的终端,继续输入命令:
source /etc/profile        (在不用重启系统的情况下使profile修改的内容生效)
export -p                 (查看系统当前环境变量的值)
                        这回可以看到,LD_LIBRAY_PATH的值被成功设定为第2小步里“./wx-config --libs”的执行结果。

三、安装codeblocks

./configure --prefix=/opt/codeblocks (prefix参数用以指定安装路径)
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这一行,保存之后,再运行:/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那默认情况是不会安装可视设计wssmith,如果不需要图形界面开发的话可以直接使用第一种安装方式)
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]#



posted @ 2016-03-31 20:40  张同光  阅读(132)  评论(0编辑  收藏  举报