Category Archives: Gentoo

Dealing with MinGw cross compiler

Since i’m working on an open-source project to provide easy-to-use asynchronous network I/O framework, and with the aim to make this project as portable as possible, i had to deal with building a cross-compiler for Windows platform, and i’m sorry to say that it wasn’t an «out-of-the-box» task.

When i first started this, i tried to use Mingw, but their website was just hacked the same time i needed it, so back on google, where i found w64 cross compiler project. The documentation was quite easy to follow, and it took me around 1 day to get it working.

I followed theses instructions with an half success. Actually, they are saying that we can build a multilib compiler, but i found out that only the 32 bits compiler was able to build. For the multilib, it fails to build because of incompatible registers name in the early stage 1 of gcc. Also, i wanted to use JNI interface without the need to uses a JDK (mostly because JNI headers are not located in standard locations, for instance with Gentoo, it was under /opt), so i needed to build the GCJ compiler, which is mostly a pain in the ass ! First of all, it seems the cross-compiling is very difficult to reach, mostly because it seems there is no maintainers for the Makefiles, for example, compiling ecjx.exe fails with original sources, as it is trying to build it with the cross compiler, instead of the host’s one. Fixing it was not easy, but i manage to get it to work.

Well, after some time tweaking the Makefiles by myself, i finally got my w64-mingw32 gcc 4.6.0 compiler, and it’s working like a charm. I managed to use most of win32 API without any problem, except that for Condition Variables, i had to take the mingw trunk crt.

So if some of you needs help to develop portable applications for both Win32 and Linux, i am now able to point you things out 😉

In a future article, i will try to describe the steps to have a fully working i686-w64-mingw32-{gcc,ecj} toolchain, so see you soon !

French gentoo mirrors

I have one dedicated server on which is located this blog, and i provide Gentoo mirrors on both IPv4 and IPv6, for syncing portage tree through Rsync, or getting latests distfiles. Hereby are the needed informations to access these :

The bug number on is #184177 . You can report me bugs or problems regarding these mirrors on , or using comments on this article.

Hope this will help the Gentoo Community,

Dynamic DNS using Bind

Today, we’ll see how to configure bind to perform dynamic DNS updates according to your public IP address changes.

Prerequisites: net-dns/bind, net-dns/bind-tools, control a nameserver and a domain of course

First, we have to use a TSIG key, which will be used by server to allow someone to update a zone, and by the client to identify itself to the nameserver. To generate one, issue the following on your favorite shell prompt:

dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST yourkey

This will generate two files in the current directory named Kyourkey.+xxx+yyyy.key containing the public key and Kyourkey.+xxx+yyyy.private containing the private key, where xxx stand for the algorithm identifier (for HMAC-SHA512, 161) and yyyy is the id of the key.

Then, assuming you will name your dynamic host, and the zone is then, you have to edit the /etc/bind/named.conf to add first the allowed key, and then the update-policy for the zone

key yourkey {
algorithm HMACSHA512;
secret [Key: data of the .private file];
zone {
updatepolicy { grant yourkey name A; };

Some explanations now:
– with the key statement, you give a name to the private key, to reuse it later in the zone statement
– with the update-policy statement in the zone, you allow the key named yourkey to update the A record of (note the dot at the end: this is a FQDN)

Tip: You can use this update-policy statement to update more than the A statement

Then it is time to add the name to the zonefile:

rndc freeze

Then edit the zonefile of adding the following:

$TTL 600
dyn IN A

Do not forget to update the SOA serial record to allows bind to propage the changes to the slaves nameservers, if any.
The IP address is by default, and will be updated later from the client. The TTL is set to 600 (10 minutes), because a dynamic IP can change at anytime, so this allows the DNS cache servers to be quickly up-to-date, but keep in mind that a too short TTL imply much requests to your nameserver…
Finally, propage changes to bind:

rndc reload
rndc thaw

Then it’s time to update the IP address of your client. For this we will use nsupdate. You need to have both .key and .private files to get the update working.
If you use a modem line connected directly to your computer client, get your external/public IP address from your ppp0 interface, if you are connected to a local network, get your external IP address using websites like . For example, we will take as your external IP address, assuming you use as primary nameserver:

nsupdate -v -k Kyourkey.+xxx+yyyy.key <<EOF
update delete A
update add 600 A

And that’s done !

You can have a look using dig to get the IP address of your host:

dig A

Hello World !

under active writing

under active writing

This blog is actually under writing…
Be patient, some useful Gentoo tips may appears here soon 🙂