Today, I decided to try again looking at why Firefox 2.0 fails to build on Gentoo/FreeBSD whereas the 1.5 version built out of the box and worked fine.

The problem was that by linking to libc_r, the implicit link to libc was dropped (it’s one of the mangling of defaults by GCC I suppose, and that is supposed to happen anyway, for things like libc_p.a); the result was that functions like strlen() were undefined (obviously) and thus the link couldn’t continue.

The ports just forced -lc to every link, which is kinda rough way to get away with it, especially since libc_r is told to be deprecated in recent versions of FreeBSD, being the userland implementation of threads, taht is, yes, the only way to run 32-bit applications under 64-bit kernels, but also is almost the slowest implementation available.

As libxcb’s pthread problem is now solved upstream (thanks to Jamey and Josh who created pthread-stubs, that’s a really cool thing, it would be even better if gettext used that instead of coming with yet another set of weak links), I’ve decided to try fixing this issue too.

The first thing is that mixing libc_r and libpthread (that is used for instance by glib) is likely to produce bad results, as the symbols gets mixed together, so I’ve tried to make sure that libc_r was not used and libpthread was used instead.. one can always use libmap.conf to change the selection of threading libraries to use, the choice at link time is mostly a backward compatibility.

Unfortunately to fix this, I had not only to remove -lc_r from being used, but also to relax the checks, allowing undefined references in shared objects (as they are left by -pthread flag). So now Firefox 2.0 builds on Gentoo/FreeBSD!

But it seems like one of the changes I did in the mean time (removed -Bsymbolic, thinking it was just for pthread problems) broke Firefox during runtime, so I’m now waiting for a new build. Unfortunately on the Duron, building Firefox takes something like two hours, especially since it only has enterprise to rely on (I haven’t upgraded farragut’s compiler to 6.2 yet). The SPARC is really faster at this point..