Moblin:创建第一个application

在netbook上安装了Moblin 2有好几天,网络不太好用,应该说还很有问题,出现下面两种情况:

  一、无线网络能够配置并且正常使用,密码那里设置为保存。后来我们的AP修改了密码,但是无线网络一直在连(当然是连不上),不能退出到配置密码的地方,而提供的GNOME配置界面也无法进入相关配置。嘿,就是无法修改密码。

  二、有限网口出现问题,插上网线,灯正常,交换机也显示正常,但是Moblin2的网络一直显示Cable unplungged,物理都搞不通,就不用往后了。

  在两种方式上网未遂的情况下,最后只好重新安装了一次,将无线起起来。这个网络部分要整一下。网线的情况,我不确定是硬件问题还是moblin的问题,过几天在刷一台netbook看看情况。网络搞通后,继续根据moblin网站学习创建一个application。

  使用Ubuntu作为host,netbook作为target。先根据指引在host上安装我们的开发环境。需要具备gcc, g++, make, man, autoconf, automake, git, libtoolize, gtkdocize, gettext, and a good source code editor(使用emacs)使用命令:sudo apt-get install build-essential man-db autoconf automake git-core devhelp libtool gtk-doc-tools gettext emacs devhelp,用于获取man-db autoconf automake git-core devhelp libtool gtk-doc-tools gettext emacs的最新版本并且安装。主要是安装GNU的开发环境。

  根据moblin的步骤,这个例子是clutter的hello world例子。从moblin网站上download一个例子,使用git clone git://git.moblin.org/sample_apps.git。这是一个使用clutter的例子,所以需要现安装好clutter,由于 clutter目前仍然没有正是的release版本,给版本之间有时不能兼容,所以需要确定clutter是否符合例子的需求。当前这个例子需要 clutter 0.9的版本,已安装。下载之后,一般按autogen.sh、make、make install的顺序进行。但是我总觉得autogen.sh是个比较复杂的东东,这些makefile也罢,configure也罢,都是在炫耀对GUN的各种参数的和环境的理解和熟悉,显然我不属于这类,而且一向属于比较糊涂,那么一大堆的东西,要么改现成的模板,要么通过开发工具来生产。这里实际上需要调用clutter-0.9的lib,仅此而已,因此可以直接写个简单的Makefile:

GCC = gcc
LIBS = clutter-0.9
FLAGS = `pkg-config --cflags --libs $(LIBS)`

all:
$(GCC) -o helloworld helloworld.c $(FLAGS)

  这种方式是比较土,反正就在阿土的环境上,去查一下gcc的参数,看看自己要什么适,至少自己知道在干什么。运行,成功。下一个步骤就是将应用从host弄到target上。根据网站介绍,使用scp,但是无论是host还是target,都不是ssh server,需要在其中一台上安装server,当然选择host。使用sudo apt-get install openssh-server获取。这样我们可以在target机器上使用scp –r username@host_ip:/文件路径 dst_name来download我们在host生成的应用文件helloworld。

  都搞好之后,我们在target上运行helloworld,O,no,报段错误。为什么呢?查了很久,原因是clutter的lib的版本有问题,虽然两者都是clutter 0.9,但是在/usr/lib具体查看,host的是903,target的是900,小版本不对,文件大小也有差异。我们对比两台机器,从host那里下载最新的clutter lib,重新对应链接文件,就可以正确执行。

  在host上的helloworld例子中,如果使用他的make install,可以在应用程序中的其他菜单那里有程序的入口。make install执行了下面:

test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c 'helloworld' '/usr/local/bin/helloworld'
test -z "/usr/local/share/applications" || /bin/mkdir -p "/usr/local/share/applications"
/usr/bin/install -c -m 644 'helloworld.desktop' '/usr/local/share/applications/helloworld.desktop'
test -z "/usr/local/share/icons/hicolor/32x32/apps" || /bin/mkdir -p "/usr/local/share/icons/hicolor/32x32/apps"
/usr/bin/install -c -m 644 'clutter_helloworld.png' '/usr/local/share/icons/hicolor/32x32/apps/clutter_helloworld.png'

  包括将执行文件放置在/usr/local/bin的目录下,在/usr/local/share/applications的目录下面增加一个helloworld.desktop,里面的内容如下

[Desktop Entry]
Version=0.1.0
Encoding=UTF-8
Name=Hello World with Clutter
Comment=A "Hello World" application with simple animations using Clutter
Type=Application
Categories=Application
Icon=clutter_helloworld
Exec=helloworld
Name[en_US]=Hello World with Clutter

  并放置图标在"/usr/local/share/icons/hicolor/32x32/apps即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值