D2 and FreeBSD

Shin Fujishiro rsinfu at gmail.com
Wed Aug 4 13:43:55 PDT 2010


Marco Righele <marco_righele at yahoo.it> wrote:
> Thanks, I didn't realize that the zip comes with the full source :D.
> The patches apply cleanly, but I found number of issues though.
> 
> (The DMD version I used is 2.047, the one downloadable from the site,
> while my box is running FreeBSD 8.1/x86)

Thanks for testing!

By the way, how did you apply the patches?  You might need to set an -l
option to deal with recent newline changes in dmd source:

.../dmd2/src/dmd/src% patch -l -p2 < 4191.patch
.../dmd2/src/dmd/src% patch -l -p1 < 4198.patch


> When compiling dmd, the linker complains about missing C++ symbols.
> Changing the linker from gcc to g++ in freebsd.mak seemed to solve
> the problem.

Hmm... that's strange.  I haven't got such an error.  I'm sorry but I can't
tell what's going wrong.

I could build dmd 2.047 as follows:
--------------------
% mkdir 2.047
% cd 2.047
% fetch http://ftp.digitalmars.com/dmd.2.047.zip
% unzip dmd.2.047.zip
% cd dmd2/src/dmd/src
% fetch -o 4191.patch 'http://d.puremagic.com/issues/attachment.cgi?id=629'
% fetch -o 4198.patch 'http://d.puremagic.com/issues/attachment.cgi?id=632'
% patch -l -p2 < 4191.patch
% patch -l -p1 < 4198.patch
% gmake -f freebsd.mak
% cp dmd ~/bin
--------------------
Compiler is gcc 4.2.1 on FreeBSD/i386 8-STABLE.  Does this work for you?


> When compiling druntime, a static assertion triggers during linking:
> 
> src/rt/llmath.d(286): Error: static assert  (0x1p+63L == 0x1p+52L) is false
> gmake: *** [lib/libdruntime.a] Error 1

I'm not sure, but you might be using a non-patched version accidentally.
Have you copied the newly-built dmd executable to, for example, ~/bin?

I built druntime with the patched dmd 2.047:
--------------------
% cd 2.047/dmd2/src/druntime
% fetch -o 3528.patch 'http://d.puremagic.com/issues/attachment.cgi?id=703'
% patch -l -p0 < 3528.patch
% gmake -f posix.mak
--------------------


> Finally I was unable to compile phobos, as I encountered errors in
> different modules, including references to freebsd related files that
> aren't in the zip I downloaded.

The following file is not in the release zip.  Please download it:
http://svn.dsource.org/projects/phobos/trunk/phobos/std/c/freebsd/socket.d

And here's a quick-hacked FreeBSD makefile that I use:
http://gist.github.com/508638

I could build Phobos with the following command lines:
--------------------
% cd 2.047/dmd2/src/phobos
% mkdir std/c/freebsd
% fetch -o std/c/freebsd/socket.d 'http://svn.dsource.org/projects/phobos/trunk/phobos/std/c/freebsd/socket.d'
% fetch -o my-freebsd.mak 'http://gist.github.com/raw/508638/b4f85e2de4f41a22a09fb895aa48b7a62fefb71e/my-freebsd.mak'
% gmake -f my-freebsd.mak
--------------------


> Am I supposed to use a different version of the compiler/libraries ?

The patches should be valid for recent few releases including 2.047.
I may be wrong though...


> If so, is it publicly available ?

Compiler and libraries are under open source. :-)

  http://www.dsource.org/projects/dmd/
  http://www.dsource.org/projects/druntime/
  http://www.dsource.org/projects/phobos/

I'm tracking these repositories with git-svn.


Shin


More information about the Digitalmars-d mailing list