Showing posts from 2007

Some progress on Loongson

The Qt-3.3.8-r4 linking problem is solved. The problem is caused by a bug in binutils which has already been fixed. I have already put an live ebuild for binutils in my loongson overlay.

Loongson already got binutils' support. Please check the links below:

Loongson's gcc support which is also developed by codesourcery is coming on the way, maybe in the next couple of month. Gcc is "in Stage 3 at the moment, which essentially amounts to regression fixes only, so the patches can't be committed yet". They will submit the patch to gcc when gcc comes to stage 1 again. In the meantime, we (some audacious guys from's forum) have made our own gcc patch, which is already available on my overlay. Honestly, I don't think our patch would be as elegant as codesourcery's. After all, they make a living by making such patches. But we can cat…

Be aware that both cscope and make honor $SOURCEDIRS

Emerging media-sound/cdparanoia failed lately on my box when I was running "sudo emerge...".
The error was that an archive file was missing.
However, I didn't find any bug report related to that on bug.g.o.
So, I decided to take a look myself. I found that if I emerged it using root user, then everything was ok. So, I suspected this might have something to do with my environment setting, coz I don't reset env for users in wheel group(so that I can "USE=... sudo emerge").
I ran ebuild unpack/install/compile/install separately using normal user and root to determine which stage caused the difference. Finally, I found the difference happened when "make"ing in the paranoia directory. An target called "lib" defines the rule to build that archive file. The lib is not a real file, however it is not labeled as PHONY. Apparently, the target is not run. But why?
I straced make as normal user. I found something strange. The strange thing was make lo…

the myths about stardict-3.0.1's text-to-speech feature

stardict-3 is now available via gentoo-china overlay. (I wish I could pass ebuild quiz soon and become stardict's maintainer in gentoo...)
stardict-3 has got tts feature. It could use festival or espeak to play an arbitrary sequence of characters.
There are two ways to use this feature. One way is via tts plugin, one for each tts engine. In fact, tts plugin does more than that - it could set the voice of its corresponding tts engine as well. The other way is to specify the command to play yourself, and there are two options which you can choose from, "echo %s | festival --tts" and "espeak %s".
My experience is the first way has priority over the latter one.
My suggestion is to use the latter one. Because tts plugin's functionality is redundant. You can choose tts engine's voices anyway. And you can use tts engine without them. Moreover, the festival plugin will segfault the program[1]. So, IMHO, the tts plugins are dispensable. So in my stardict-3.0.1-r2.eb…

failed to build qt-3.3.8-r4 on loongson

Haven't solve it yet.
I have already tried to add -mxgot to CFLAGS and CXXFLAGS. But it didn't work for me.
Some useful link:

Fixed a bug in xml2po

The condition to trigger the bug is that opening tag or the content of the tag contains non-ascii chars. e.g:
<title>Quotes are for weak people, strong people have their own opinions
- Dawid Węgliński (cla)</title>
<figure link="/images/gwn/20070917_cla.jpg"
short="cla" caption="Dawid Węgliński, aka cla"/>
The symptom is:
Stack trace:
Traceback (most recent call last):
File "", line 856, in ?
File "", line 589, in doSerialize
outtxt += doSerialize(child)
File "", line 583, in doSerialize
(starttag, content, endtag, translation) = processElementTag(node, repl, 1)
File "", line 525, in processElementTag
translation = translation.replace('' % (i), replacement)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
635: ordinal not in range(128)

official Simplified Chinese doc translation team lead

I have passed doc quiz, :)
Now I can commit docs direclty.

The following is what neysx sent to me.

Zhang Le wrote:
> Hi, neysx!
> Please find my quiz answer and fix-me.xml in the attachment.

Not perfect, but good enough :)
You're now in charge of /doc/zh_cn/

/ Xavier Neys
\_ Gentoo Documentation Project

Pulseaudio-0.96 on MIPS

Pulseaudio depends on libatomic_ops. However, libatomic_ops don't have support for mips.
I've created a patch for mips, though only work on 32bit userland. Get it here.

Pulseaudio now compiled and installed on my loongson box. Can't use it to play though. The following is some detailed info, if you are interested in.

My setup is to use alsa's pulse plugin.
I tried aplay, for example:
$ aplay /usr/share/sounds/alsa/Front_Right.wav
aplay: pulsecore/mutex-posix.c:75: pa_mutex_lock: Assertion `_r == 0' failed.
AbortedBefore this assertion failed, aplay is stuck on a futex system call.
connect(7, {sa_family=AF_FILE, path="/var/run/pulse/native"}, 110) = 0
send(6, "W", 1, MSG_NOSIGNAL) = -1 ENOTSOCK (Socket operation on non-socket)
write(6, "W", 1) = 1
gettimeofday({1187375795, 973686}, NULL) = 0
write(6, "W", 1) = 1
futex(0x45dd1c, FUTEX_WAIT, 1, NULL

Chinese docs committed

Thanks to neysx!
Take a look:
I have just submitted /doc/zh_cn/{index,metadoc}.xml

Two problems have been discovered since I wrote the stardict 3.0.0's ebuild.
One is that stardict 3.0.0 needs gconf-2.m4 file in the m4 dir in order to run eautoreconf successfully. Because stardict can disable gnome support, and as a result user may not have gconf installed.
The other problem is related to newest speech-tools. This one is stardict 3.0.0's dependency. you can find details here:

I have written an ebuild for stardict-3.0.0

layman -a gentoo-china to get it, or view it online:
I wrote two patches which could make it compile when --disable-gnome-support.
Stardict 3.0.0 supports text-to-speech engine festival.
It requires the latest version of festival and speech-tools.
So I wrote ebuilds for them.
They are also in gentoo-china overlay now.
I haven't become an ebuild dev yet, so I can just put them there.
I will submit to bugs.g.o later.

I have reported relevant issues to You can find it here.

Simplified Chinese Gentoo Handbook all finished!

Synced with English version.

Take a look:


BTW, this website is powered by my loongson machine, ;)

More on mldonkey and loongson

My little patch to mldonkey's Makefile donesn't satisfy mldonkey developer. I didn't come up with a better solution. So I resorted to modify mldonkey's ebuild. Maybe not so elegant, but it works, at least for me.

I added the following snippet to src_install():
EXE="mlnet mld_hash get_range copysources make_torrent subconv"

if [ -f mlnet.byte ]; then
for i in $EXE; do
mv $i.byte $i
dobin $EXE || die "dobin failed"
The ebuild could found here:

This overlay is independent from the one on, although the latter was actually registered by me. Because I can't access's svn repository, probably due to network problem. So I just maintain this overlay locally, using git. To get it, run:
BTW, I have just registered a domain name: I will make it theportal site of Chinese …

Mldonkey can work on Loongson

In short, ocaml doesn't have native code compiler for mips linux, but it can compile byte code which is also an ELF executable. The only difference is that bytecode runs slower than native code. But there is a little problem with mldoney's Makefile. I will try to make a patch to solve the problem.

PS: maybe i misunderstood something. I found that mlnet.byte can't run on its own, it needs bytecode file.

PPS: I found the mlnet.byte i have installed into /usr/bin is not the right one.

PPPS: it is the right one, but gentoo stripped it, haha, now it works, finally!

The following is a conversation happened on #mldonkey @ freenode

(r0bertz) what is the difference between mlnet and mlnet.byte
* lb001_ has quit (Remote closed the connection)
* lb001_ (i=irc@gateway/tor/x-f2c1251672831851) has joined #mldonkey
(jave) r0bertz: mlnet.byte is byte compiled
(jave) you will normaly use plain mlnet binar…

Misunderstanding of free in free software

I bought a digital product magazine this afternoon.
It is called e-zone. It is issue 464, released on July 05 2007.
This magazine is the No.1 computer/digital product magazine in Hong Kong.
There is an article talked about GPLv3 in this issue.
However, they translate "free software foundation" as "免费软件基金会"(gratis software foundation).
This is an unacceptable mistake.
Free here means freedom, not gratis.
I've already send them an email.
I hope they can fix it immediately.

my patch to strace was accepted

How to use trads.rb to manage translations and generate a Lead Translator's page
gotta read this
this will help me to generate a beautiful page showing the status of translation.
Our current status page is beautiful too, but it is missing some functions, e.g. the diff between the latest translated en doc and the latest en doc.
The script in the above mentioned doc could do this. Wonderful!
The result could be seen at
However, this script only works with gorg.
That means is no longer a suitable place to hold the status page (which is known as progress.xml currently)

RMS: Why Upgrade to GPL Version 3

What does a Linux newbie need to know to successfully install Gentoo?

According to Ted
- What is GNU?
- What are the main parts of an operating system and what does each part do?
- What is a GNU/Linux distribution?
- What is VMware?
- What is a .iso file?
- What does the ifconfig program do?
- What does the ping command do?
- What is a file?
- What is a filesystem?
- What is a hierarchal filesystem?
- What is a directory?
- What does the cd command do?
- What does the pwd command do?
- What does the ls command do?
- What does the -l option do when passed to the ls command?
- What is a symbolic link?
- In an ls long listing, how does one know which entries are files, directories
and links?
- What is the purpose of the /mnt directory?
- What is a path?
- What is a path separator?
- What is contained in the /bin directory?
- What does the "more" command do?
- What does a "pipe" do and what is its symbol?
- What does the -a option do when passed to the ls command?
- What is the purpose of the /proc directory…


首先,说明一下我准备把 加入 gentoo planet。
鉴于我们伟大的防火长城间歇性的屏蔽blogspot,建议使用抓虾、google reader等来订阅这个blog。
给zhlly说声抱歉,zhllg.livejournal.com我要回来也没有怎么好好利用。不过我还没有归还的打算。问题的关键在于,我不想让别人误解我转投了fedora core的阵营,;)


getdate() {
grep Header $1 | egrep -o '200[0-9]/[0-9]{2}/[0-9]{2}'
getver() {
grep Header $1 | egrep -o 'v [0-9]+\.[0-9]+'


for i in `grep -o '/doc/en/handbook/.*\.xml' progress.xml`
olddate=$(grep -A 1 $i progress.xml | egrep -o 200[0-9]/[0-9]\{2\}/[0-9]\{2\})
newdate=$(getdate $PREFIX$i)

if [[ $olddate != $newdate ]]; then

sed -i -e "
/$j/ {
s#$i.*\n <ti>200[0-9]/[0-9]\{2\}/[0-9]\{2\}#$i\">$(getver $PREFIX$i)</uri></ti>\n <t…


改的原因是 zhllg 不好发音

The Gentoo Linuxoperating system ( pronounced/ˈdʒɛntu/) is a Linux distribution named after the Gentoo penguin. It is designed to be modular, portable , easy to maintain, flexible, and optimized for the user's machine. All tools and utilities are built from source code.





Gentoo loongson overlay我还会继续维护。BTW:今天我做了个cgi页面,可实时查看我的龙芯盒子的系统信息:还有Acevery贡献了一篇锐捷认证上网的HOWTO:锐捷认证

Gentoo 2006.1 x86/amd64手册全部完成



其中Gentoo portage将由我讲解


这台机器是我的龙芯盒子(loongson box),里面内容是gentoo手册的镜像,简体中文版(预览版)What is a geek?A geek is an individual who is fascinated by knowledge and
imagination, usually electronic or virtual in nature.
-- from

LWN quote of the week

But being a subsystem maintainer requires that you trust contributors
to some degree, and you just can't trust contributors when you're a
perfectionist. This means that the maintainer should be less of a
perfectionist than the contributors, otherwise he/she ends up doing
everything by him/herself.
-- Jean Delvare"Ends up doing everything by him/herself"!




首先,和Gentoo Weekly Newsletter翻译一样,Gentoo文档的翻译也还在继续。不过我最近捣鼓龙芯比较多,GWN和文档上花的时间不是很多。
The <c>video</c> statement controls framebuffer display options. It needs to be
given the framebuffer driver (<c>vesafb</c> for 2.6 kernels, or <c>vesa</c> for
2.4 kernels) followed by the control statements you wish to enable.

loongson patch against linux 2.6.21-rc5

Foxsen(Zhang Fuxin, 张福新) has released a patch against linux
2.6.21-rc5. I have tried it today. It works well so far.My gentoo on loongson still have two minor problems, related to audio
and video playback respectively.
First of all, please be aware that none of these programs I used to
play audio and video has any loongson specific patch. loongson has
implemented its own multimedia instructions. So theoretically if
properly patched, the performance will be better.
On the audio side, audacious doesn't perform well when the frequency
is low, while mplayer works fine. Maybe it's because they use
difference libraries.
On the video side, when mplayer plays some mpeg2 or divx video, video
will fall behind audio, especially when the video's resolution is
high.Last but not least, I heard some devs talked about loongson's profile on
#gentoo-mips. It is widely accepted that it is not necessary to have a specific
profile for loongson. Well, I am not insisting that we should have
one, nor can I …

loongson specific profile

If loongson finally were officially supported by gentoo, it must have
its own profile.
Currently, it uses cobalt's profile. Of course, one has to do some
dirty hacks to make it usable with loongson. For example, cheat
portage to make it think colo is already installed. Loongson box uses
pmon as bios and bootloader, doesn't use colo which is cobalt's
Recently, I have read PMS draft. For me, it is quite informative. I've
learned some internals about our package manager, specifically I've
learned something about profile which i don't know before.
Then I applied those knowledge into reality.
I created a loongson specific profile in loongson overlay and used it.
The main trick here is to write absolute path of parent directory into
PARENT file, instead of "..". And it turned out to work well.

Loongson got license from MIPS Technologies

Loongson Gentoo stage 4

I have uploaded a stage4 to,
under the directory of Gentoo.
FEATURES include but not limited to:
1. nptl pthread library, the debian shipped with box uses Linuxthreads
pthread library.
2. complete KDE 3.5.5
3. 4 kernels, 32bit/64bit, with/without kgdb
4. partial mirror of, include half-translated Simplifid
Chinese handbook
5. firefox, mplayer, audacious...
I used binutils-2.17 when compiling firefox, USE flag of binutils is
"multislot -multitarget nls -test -vanilla"
This mplayer doesn't contain any loongson specific patch, but it works.

Gentoo 2007.0 livecd will have Simplified Chinese interface


目前只支持IRIX和n32 ABI
现在龙芯还只能运行于Linux,Linux上的应用程序主要还是用o32 ABI
The problem with n32 though, is that few applications actually handle
this case well. Debugging tools like strace and gdb are not coded to
handle this... KDE works sort-of, but is broken in several key areas.
Gnome is totally useless on n32.
两个解决方案,一个是multilib,一个是移植到o32 ABI。似乎都不太容易。
you'll need your userland CHOST set to mips64 instead of mips, a gcc
and binutils capable of handling all the binary formats you want to
use, and appropriate system libraries for all the ABIs
The optimal solution would be multilib, however the necessary code for
Portage has not been written. Architectures like AMD64 work because
of shear ugly kludges ... the actual multilib case isn't handled at
一是增加一个汇编文件mipsel.s(SGI的mips是大头端的,龙芯是小头端),改成o32 ABI

KDE on loongson


Redhatter has released mips1(little endian) stages
They should work on loongson, however i haven't tried it yet.
I will soon release a stage4 for loongson, including KDE.
Stay tuned.

representative of the Gentoo community

Remember, the moment you participate in a public discussion on the
Gentoo fora, you have made yourself a representative of the Gentoo
community.Every gentoo user/dev should read this:



Gentoo Etiquette Policy

Re: [RFC]possible improvements to --with-sysroot

On 3/6/07, Daniel Jacobowitz <> wrote:
> On Tue, Mar 06, 2007 at 02:05:06AM +0800, Zhang Le wrote:
> > I have used "strace -f" to check where linker looked for -lqt-mt. From
> > what I have observed, it seems that ld didn't use
> > $SYSROOT/etc/
> Well, it's supposed to, so I suggest you check what's happened in ld.
I found a clue which may lead to a neat solution to this problem. And
this has something to do with gcc, so I still posted it here.
First of all, $SYSROOT/etc/ solution maybe an overkill, so I
think we can ignore it for now.
The finding is if ld is invoked with --sysroot option and if the dir
specified by -L has a leading "=", for example:
--sysroot=/usr/mipsel-unknown-linux-gnu -L=/usr/qt/3/lib -L/usr/lib -lqt-mt
Then when ld will looking for in
/usr/mipsel-unknown-linux-gnu/usr/qt/3/lib, instead of /usr/qt/3/lib.
Thus problem solved.
So I am wondering if there is a way to de…

videos from fosdem

FOSDEM means Free and Open source Software Developers' European Meeting

Daniel has left again

This is what he said:
Gentoo is only going to be fun and productive again if we:1) maintain a courteous and professional atmosphere
2) focus on good, transparent project management and collaboration
3) deliver cool technologies to Gentoo usersAND IN THAT ORDER ONLY, which is the only order that works long-term.
It makes no sense to try to do this in reverse order. It does not
work. 3 requires 2 and 2 requires 1. Right now these three pillars are
being treated as mutually exclusive goals which is absolutely
ridiculous and wrong, where we accept failure in point 1 in the hope
of achieving 3.

没有键盘鼠标的是client,执行synergyc serverip
$ cat /etc/synergy.conf
# sample synergy configuration file
# comments begin with the # character and continue to the end of
# line. comments may appear anywhere the syntax permits.section: screens
# three hosts named: moe, larry, and curly
endsection: links
down = adriano
up = loongson
endsection: options
switchDelay = 500


Distcc is working.
Howerver, I didn't get it working at the beginning.
Because I am curious about what messages distccd's pass between
themselves. So I fired up wireshark, then I go to sleep.
As you would expect, eventually wireshark occupied all free space on
/tmp which is also used by distcc to produce object files. And as a
consequence, distcc failed.
Originally, the distcc run with "--log-level critical", so it sent
nothing to syslog.
By using this command, you can see what distcc is doing in real time:
distccd --verbose --log-stderr --daemon --user distcc --allow --no-detach

I will give up cross compiling KDE

some ideas about DEPEND/RDEPEND

(zhllg) Is it possible that a runtime dependency is not a build time dependency? or could a package be built without some package, but require it in order to run?
(igli) yes
(zhllg) igli, any example?
(igli) not necessarily required at run time; in any case eg an app that runs a cmd
(igli) might not need to be built against the other app
(zhllg) oh that is true
(igli) synfig has run time deps for i think jpeg and stuff
(igli) need to work on ebuild.. :(
(zhllg) igli, what about the runtime dependency is a library
(igli) usu if it's a dep against a lib, it's compile time
(marienz) both.
(igli) depends on whether it looks for the .h files
(marienz) normally both.
(igli) oh sorry, yes runtime as well of course
(igli) as lib needed on system when app is running :) doh!
(zhllg) then IMHO maybe in that case just specify the dependency in RDEPEND is enough, what do you think?
(marienz) you normally need the lib present at build time or the link will fail.
(zhllg) yes
(igli) yup
(igli) zhllg: if only RD…

[RFC]possible improvements to --with-sysroot

The following suggestion is based on my understanding of
--with-sysroot, if there were any error, please correct me.
To my understanding, currently if cross-compile tool chain (including
gcc) is configured with --with-sysroot when installing them, then when
cross compiling, ld will look for libraries in $SYSROOT/usr/lib and
Wouldn't it be great that we go one step further that we let ld look
for libraries in the dir listed in $SYSROOT/etc/, if this
file ever exits? Of course for each entry in $SYSROOT/etc/,
we prefix $SYSROOT to it.
Comments are welcomed.
Zhang Le, Robert
This is an email I have posted to gcc mailing list.

emerging KDE on loongson

I have got DRI working in Gentoo on loongson.
mesa/libdrm/kernel/xorg-server/xf86-video-ati need to be patched in
order to achieve this.
I have set up a loongson overlay, including the necessary patches.
Get it here:

kgdb and 64bit loongson kernel

The kernel crashed at last.
But it didn't drop into gdb.
I have set up a breakpoint at panic(), so it is not a panic.
My speculation proved wrong, and I have no idea what went wrong here.
I will give up for the time being.
Gotta read some books and help to make the 32bit loongson port stable.

gorg on loongson box

I have successfully run gorg on my loongson box.
Find more info about gorg here:
more info about loongson here:


echo -e "\003" > /dev/ttyS1

gentoo's mips toolchain

Gentoo's mips64el toolchain(created by 'crossdev') support n32 by default.
However, I want o32.
Good news is I don't need mips64el, instead I need mipsel.
Thanks to spbecker for pointing it out to me.
I think mips64 here is the name of processor architecture.
Apparently loongson doesn't belong to that category.

按音序排序的utf8和gb18030 locale
cd locale-pinyin-0.1
sudo cp zh_CN.hacked /usr/share/i18n/locales/zh_CN
sudo cp iso14651_t1.pinyin /usr/share/i18n/locales/

 $ cat /etc/env.d/100i18n

the difference between GB18030 charmap of redhat's glibc and that of GNU's glibc

GB18030 charmap of redhat's glibc is different from that of GNU's glibc.
I don't know exactly what this difference means to users.
But I wonder why this difference exists.

Get the former at
Get the latter at

I've created a diff which could be get here:

be careful when you are on #paludis

In my opinion, a good community should treat new comers well.
But some people think otherwise.

(zhllg) i think many people like the idea installation could resume automatically when failure occur, is it possible with paludis?
(mlangc) zhllg:
 mlangc maskd masterdriverz maxauthority midnite__ mzli
 mlangc maskd masterdriverz maxauthority midnite__ mzli
(zhllg) mlangc, i've seen that actually, just wonder why, is it difficult to implement technically?
(mlangc) i don't think so; as far as i know it is not implemented by __design__ - but you should better ask someone that actually works on paludis; i'm a simple user myself
(rbrown`) zhllg: er no. Too unreliable, too flaky and far too widely abused;
(zlin) zhllg: wouldn't it be much better to fix the packages that cause it to fail in the first place...
(zhllg) zlin, yeah, from a developer's perspective
* dleverton is …

Interest and Open source

One of the great things about open source software is, of course, the fact that anyone can participate, so the pool of resources is limited not by an annual hiring budget, but by interest in the project. That means you can have any number of developers, but it also means that one person may be involved in several areas if he or she finds them interesting.



xmllint -valid -noout filename.xml



TW, you do not need to use the stand-alone web server, but if you want to, it
seems something changed in webrick (ruby's www server) and the default bound
address ( does not work anymore. Edit www.rb and add the :BindAddress

s = :BindAddress => "",
:AccessLog=>access_log, :Logger => $Log, :Port => $Config["port"], :CGIPathEnv


错误的提示是sections tag不全,但这个文件里又没有sections这个tag


If your mp3's id3 tag conforms to id3v2.4, which means probably you have disabled chardet, then pay attention to your fallback encoding setting, leave it alone, don't set it. trust me!

the default brower of xchat 2.8

The logic to find default brower is changed from xchat 2.6.8 to 2.8.
The 2.8 xchat will call xdg-open to open brower, in KDE, xdg-open will call konqueror unless you have set KDE's default brower to others.
I like firefox, and older version of xchat used to call firefox for me.
So I set KDE's default brower in kcontrol: KDE components-> Component chooser -> Web brower.


upstream maintainer和ebuild maintainer为同一个人看来是有些问题……


regexec(3)'s usage:Match Results with Subexpressions
An example program:
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>

/* 取子串的函数 */
static char* substr(const char*str,
                unsigned start, unsigned end)
        unsigned n = end - start;
        static char stbuf[256];
        strncpy(stbuf, str + start, n);
        stbuf[n] = 0;
        return stbuf;
/* 主程序 */
int main(int argc, char** argv)
        int x, z, lno = 0, cflags = REG_EXTENDED;
        char ebuf[128], lbuf[256];
        regex_t reg;
        regmatch_t pm[10];
        const size_t nmatch = 10;
        /* 编译正则表达式*/
        z = regcomp(&reg, "(reg|regular)[ ]?(ex|expression)", cflags);
        /* 逐行处理输入的数据 */
        while(fgets(lbuf, sizeof(lbuf), stdin))
                if ((z = strlen(lbuf)) > 0 && lbuf[z-1]
                                == '\n')


sed -i -e  '
/在这段时间内被修正或解决的bug/ {
/\n<\/ul>/ {
}' *