Archive

Author Archive

Cross Compile SDL

August 3rd, 2010 BianJiang No comments

==============================
jpeg-8b

./configure –host=arm-linux –prefix=/opt/rootfs/cross/arm/usr
make
make install

==============================
libpng-1.2.44

./configure –host=arm-linux –prefix=/opt/rootfs/cross/arm/usr/
make
make install

==============================
zlib-1.2.5

export CC=arm-linux-gcc
./configure –shared –prefix=/opt/rootfs/cross/arm/usr
make
make install

==============================
e2fsprogs-1.41.12

./configure –host=arm-linux –prefix=/opt/rootfs/cross/arm/usr
make
make install

==============================
freetype-2.3.12

./configure –host=arm-linux –prefix=/opt/rootfs/cross/arm/usr
make
make install

==============================
DirectFB-1.4.3
依赖: JPEG, libpng, e2fsprogs(uuid), zlib, freetype2
make的时候如果在Makefile里面出现没有相关的头文件就进相关的Makefile修改CFLAGS增加你头文件和库文件的地址, 如果你不是Davinci平台,就进入gfxdrivers/Makefile把”DAVINCI_DIR”相关的东西都屏蔽掉。

./configure –host=arm-linux –prefix=/opt/rootfs/cross/arm/usr
make
make install

==============================
SDL-1.2.14
依赖: JPEG, libpng, e2fsprogs(uuid), zlib,
——

export NM=arm-linux-nm
export LD=arm-linux-ld
export CC=arm-linux-gcc
export CXX=arm-linux-g++
export RANLIB=arm-linux-ranlib
export AR=arm-linux-ar

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/arm/4.2.2-eabi/:/usr/local/arm/4.2.2-eabi/usr/:/opt/rootfs/cross/arm/usr/

如果找不到directfb库,修改Makefile, 在CFLAGS中增加你的相关库文件的路径

CFLAGS = -g -O2 -I/opt/rootfs/cross/arm/usr/include -L/opt/rootfs/cross/arm/usr/lib
LDFLAGS = $(CFLAGS)

./configure –enable-video-qtopia –enable-video-directfb –enable-video-opengl –disable-video-dummy –disable-video-fbcon –disable-video-dga –disable-arts-shared –disable-arts –disable-esd –disable-esd-shared –disable-alsa –disable-cdrom –disable-video-x11 –disable-nasm –disable-diskaudio –disable-mintaudio –disable-video-ps2gs –disable-atari-ldg –disable-video-photon –disable-nas –host=arm-linux –prefix=/opt/rootfs/cross/arm/libsdl

编译sdltest
cd test
修改Makefile增加一些库

CFLAGS = -g -O2 -I/opt/rootfs/cross/arm/libsdl/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -L/opt/rootfs/cross/arm/libsdl/lib -I/opt/rootfs/cross/arm/libsdl/include -I/opt/rootfs/cross/arm/usr/include -L/opt/rootfs/cross/arm/usr/lib -I/opt/rootfs/cross/arm/libsdl/include/SDL
LIBS = -L/opt/rootfs/cross/arm/libsdl/lib -lSDL -lpthread -ldirectfb -ljpeg -lpng -ldirect -lpng12 -lz -lfusion -lfreetype

*****************************************

1. 挂接命令:

mount -o nolock -t nfs 10.0.3.244:/long_nfs /tmp/
mount -o nolock 10.0.3.244:/long_nfs /tmp/

这两个都可以。
2. 可能出现的错误类型
a. 错误类型:

rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
lockd_up: makesock failed, error=-5
rpcbind: server localhost not responding, timed out
RPC: failed to contact local rpcbind server (errno 5).
mount: mounting 10.0.3.244:/long_nfs on /tmp/ failed: Input/output error

这个问题是因为挂接命令不对,要加上参数-o nolock就可以了

但是NFS不稳定

nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 OK
nfs: server 192.168.2.213 not responding, still trying
nfs: server 192.168.2.213 not responding, still trying

=============================

Categories: Embedded, Tech.Notes Tags: , ,

Go 语言中文社区成立

February 3rd, 2010 BianJiang No comments
Go 中文社区
  1. Go官方网站
  2. Go中文官网
  3. 中文论坛(测试中…)
  4. 中文用户讨论组(邮件)
  5. 中文翻译(SVN)
  6. GitHub与Google Code同步(GIT)
  7. QQ群: 102319854(申请加入请到中文论坛留言)

Go中文文档翻译计划

  1. Install Go 初稿完成
  2. Go Tutorial 初稿完成
  3. Effective Go 初稿25%

翻译的详细信息参考 翻译计划

TODO

1. 创建一个wiki用于资料的收集和整理

2. 把翻译的中文文档发送给Go官方。

3. 翻译PKG相关的文档。

4. 创建一个Blog用于发布有关Go的新闻

5. 用Go做个具体的开源项目。

Categories: golang Tags: , , ,

传说中的中文编程

January 31st, 2010 BianJiang No comments
border@ubuntu:~/work/go/tutorial$ cat helloworld.go
package main
import fmt “fmt”
func 输出函数(s string) {
fmt.Printf(s)
}
func main() {
fmt.Printf(”Hello, 中文\n”)
变量 := “传说中的中文编程\n”
输出函数(变量)
}
border@ubuntu:~/work/go/tutorial$ 8g helloworld.go
border@ubuntu:~/work/go/tutorial$ 8l -o helloworld helloworld.8
border@ubuntu:~/work/go/tutorial$ ./helloworld
Hello, 中文
传说中的中文编程
GO中文资料参考: http://golang-china.org


Bian Jiang
Blog:  http://www.wifihack.net/

Categories: golang Tags: , , , ,

Go语言中的type 和 interface 相关的问题

January 30th, 2010 BianJiang No comments
在Go语言中,每个type都是不同的,这里的type和c语言中的typedef还是有些区别的,
在Go中不能用type派生出来的int类型数据去替换内置的int类型. 比如:
———————————————————-
border@wifihack:~/work/go/tutorial$ cat type1.go
package main
import “fmt”
type MyTypeA int
func printInt(i int) {
fmt.Printf(”%d\n”, i)
}
func main() {
var a MyTypeA = 0
printInt(a)
}
border@wifihack:~/work/go/tutorial$ 8g type1.go
type1.go:13: cannot use a (type MyTypeA) as type int in function argument
———————————————————-
你不能把type派生出来的int类型的MyTypeA传递给printInt(i int)函数。所以 MyTypeA 与 int 不能直接替换。
同样的道理如果你自己定义了2个相同的类型比如:
type MyTypeA int
type MyTypeB int
var a MyTypeA = 0
var b MyTypeB = 0
a = b 或 b = a 都是错误的,编译不通过。
如果你非要使用printInt(i int)这个函数也行,但是必须把传进去的数据类型转换为int类型。
printInt(a)
替换成
printInt(int(a))
就可以解决编译问题,但是Go提供了另一种解决方法接口(interface),你可以通过一个空接口来实现, 例如:
———————————————————-
border@wifihack:~/work/go/tutorial$ cat type2.go
package main
import “fmt”
type MyTypeA int
type Empty interface {}
func printInt(i Empty) {
fmt.Printf(”%d\n”, i)
}
func main() {
var a MyTypeA = 0
printInt(a)
}
border@wifihack:~/work/go/tutorial$ 8g type2.go
border@wifihack:~/work/go/tutorial$ 8l -o type2 type2.8
border@wifihack:~/work/go/tutorial$ ./type2
0
———————————————————-
如果使用接口(interface)就和类型无关,你也可以在printInt函数里面输出字符串看看效果:
———————————————————-
package main
import “fmt”
type MyTypeA int
type MyTypeB int
func printInt(i interface{}) {
fmt.Printf(”%d\n”, i)
fmt.Printf(”%s\n”, i)
}
func main() {
var a MyTypeA = 0
var b MyTypeB = 2
printInt(a)
printInt(b)
var s string = “Hello, 中文”
printInt(s)
}
border@wifihack:~/work/go/tutorial$ ./type
0
%s(main.MyTypeA=0)
2
%s(main.MyTypeB=2)
%d(string=Hello, 中文)
Hello, 中文
———————————————————-

参考: https://groups.google.com/group/golang-nuts/browse_thread/thread/bf4174fc5cbafa13#870a9034b11a8651

GO中文资料参考: http://golang-china.org

Bian Jiang
Blog:  http://www.wifihack.net/
Categories: golang Tags: , , , ,

GCC宣布对Google Go语言的支持

January 28th, 2010 BianJiang No comments

GCC项目组织宣布bumper320x180 允许gccgo(Google 推出的新语言GO)增加到gcc的主分支,更详细的信息可能要在GCC4.5或之后的版本中体现。 也就是说在不远的将来GO语言将是Linux的标配。

GO语言: http://www.golang.org

GO中文资料参考: http://golang-china.org

GO中文用户组: https://groups.google.com/group/golang-china/

Categories: OpenSource, golang Tags: , , ,

Google Code 与 Github代码同步

January 26th, 2010 BianJiang No comments
git config --global user.name "Bian Jiang"
git config --global user.email borderj@gmail.com
git svn clone https://golang-china.googlecode.com/svn/trunk -s
git remote add origin git@github.com:border/golang-china.git
git push origin master
git svn rebase // 本地与Goolge Code 代码同步
git push // 上传本地的代码到github
git svn dcommit // 上传本地的代码到Google Code 

在Github上创建ssh授权参考: http://wifihack.net/blog/2008/12/permission-denied-on-github/

–EOF–
http://www.wifihack.net

Categories: Tech.Notes Tags: , , , ,