www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compiling DMD for *nix platforms

reply Leo Singer <aronnax umd.edu> writes:
Does anyone know how to build DMD from source?

I am using gdc on Mac OS X and I am finding that it does not support all the
bizarre syntax features I am throwing at it, probably because it is based on
version 1 of the D language.  I'd like to try out DMD, and luckily source code
comes in the archives on the download page
(http://www.digitalmars.com/d/download.html).  Unfortunately, there is no build
script to make the compiler, and just trying to run g++ on all the .c files in
the source directory is no good.
May 04 2008
parent reply "Anders Bergh" <anders1 gmail.com> writes:
On Mon, May 5, 2008 at 7:48 AM, Leo Singer <aronnax umd.edu> wrote:
 Does anyone know how to build DMD from source?

  I am using gdc on Mac OS X and I am finding that it does not support all the
bizarre syntax features I am throwing at it, probably because it is based on
version 1 of the D language.  I'd like to try out DMD, and luckily source code
comes in the archives on the download page
(http://www.digitalmars.com/d/download.html).  Unfortunately, there is no build
script to make the compiler, and just trying to run g++ on all the .c files in
the source directory is no good.
You can't compile dmd because it's not 100% open source, only the frontend is. If you download the latest gdc code using svn then you can do something like this to enable D 2 support: ./gcc/d/setup-gcc --enable-d-language=2 (or so, I don't remember) Anders
May 04 2008
next sibling parent =?UTF-8?B?QW5kZXJzIEYgQmrDtnJrbHVuZA==?= <afb algonet.se> writes:
Anders Bergh wrote:
 On Mon, May 5, 2008 at 7:48 AM, Leo Singer <aronnax umd.edu> wrote:
 Does anyone know how to build DMD from source?

  I am using gdc on Mac OS X and I am finding that it does not support all the
bizarre syntax features I am throwing at it, probably because it is based on
version 1 of the D language.  I'd like to try out DMD, and luckily source code
comes in the archives on the download page
(http://www.digitalmars.com/d/download.html).  Unfortunately, there is no build
script to make the compiler, and just trying to run g++ on all the .c files in
the source directory is no good.
You can't compile dmd because it's not 100% open source, only the frontend is.
Another reason is that DMD isn't portable, so even if you managed to build it - it would generate code for Windows or x86 "linux".
 If you download the latest gdc code using svn then you
 can do something like this to enable D 2 support:
 
 ./gcc/d/setup-gcc --enable-d-language=2 (or so, I don't remember)
./gcc/d/setup-gcc.sh --d-language-version=2 (see INSTALL doc) http://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d/INSTALL --anders
May 05 2008
prev sibling parent reply Leo Singer <aronnax umd.edu> writes:
== Quote from Anders Bergh (anders1 gmail.com)'s article

 You can't compile dmd because it's not 100% open source, only the
 frontend is. If you download the latest gdc code using svn then you
 can do something like this to enable D 2 support:
 ./gcc/d/setup-gcc --enable-d-language=2 (or so, I don't remember)
Sweet! That's exactly what I want. I've heard some rumors about using gcc's backends for other platforms to use D on embedded systems. That's exactly why I'm interested in D. What would need to be done to make a cross-compiler for <insert favorite gcc backend here>?
May 06 2008
parent reply "Anders Bergh" <anders1 gmail.com> writes:
On Wed, May 7, 2008 at 8:03 AM, Leo Singer <aronnax umd.edu> wrote:
  Sweet!  That's exactly what I want.
  I've heard some rumors about using gcc's backends for other platforms to use
D on embedded systems.
  That's exactly why I'm interested in D.  What would need to be done to make a
cross-compiler for <insert
  favorite gcc backend here>?
Same as with any other gcc frontend, I don't know the details 100% but I did have a gdc cross compiler for an ARM target. But you need to port the runtime library too for any useful apps to run. Anders
May 06 2008
parent reply Leo Singer <aronnax umd.edu> writes:
I followed the instructions in the INSTALL file on the repository, downloading
the newest 4.1 release of
GCC, which happened to be 4.1.2.  I ran the setup script, and then ran gcc's
configure script, then ran
make.  The following link command causes make to fail:

c++   -g -O2  -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prototypes -
pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition
-Wmissing-format-attribute
-DHAVE_CONFIG_H -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include
-I./../intl -
I../.././gcc/../libcpp/include     -I. -I. -I../.././gcc -I../.././gcc/.
-I../.././gcc/../include -I./../intl -
I../.././gcc/../libcpp/include  -I../.././gcc/d -I../.././gcc/d/dmd -Id
-D_GNU_SOURCE=1 -D_DH=1 -
DD_NO_TRAMPOLINES=1 -DELFOBJ=1 -DLIBPHOBOS=\"-lgphobos\" -DLIBPHOBOS_PROFILE=\"-
lgphobos\" -DD_GCC_VER=41 -Wno-missing-braces -fmessage-length=0  -o cc1d \
		d/id.gen.o d/impcnvtab.gen.o attribs.o cppdefault.o stub-objc.o prefix.o
darwin-c.o
d/access.dmd.o d/array.dmd.o d/attrib.dmd.o d/cast.dmd.o d/class.dmd.o
d/cond.dmd.o
d/constfold.dmd.o d/dchar.dmd.o d/declaration.dmd.o d/delegatize.dmd.o
d/doc.dmd.o
d/dsymbol.dmd.o d/dump.dmd.o d/entity.dmd.o d/enum.dmd.o d/expression.dmd.o
d/func.dmd.o
d/gnuc.dmd.o d/hdrgen.dmd.o d/html.dmd.o d/identifier.dmd.o d/import.dmd.o
d/init.dmd.o
d/inline.dmd.o d/interpret.dmd.o d/lexer.dmd.o d/lstring.dmd.o d/macro.dmd.o
d/mangle.dmd.o
d/mars.dmd.o d/mem.dmd.o d/mtype.dmd.o d/module.dmd.o d/opover.dmd.o
d/optimize.dmd.o
d/parse.dmd.o d/root.dmd.o d/scope.dmd.o d/statement.dmd.o d/staticassert.dmd.o
d/stringtable.dmd.o d/struct.dmd.o d/template.dmd.o d/todt.dmd.o d/toobj.dmd.o
d/typinf.dmd.o
d/unialpha.dmd.o d/utf.dmd.o d/version.dmd.o d/d-lang.glue.o d/d-decls.glue.o
d/d-codegen.glue.o
d/d-objfile.glue.o d/d-irstate.glue.o d/d-glue.glue.o d/d-convert.glue.o
d/d-todt.glue.o d/d-gcc-
real.glue.o d/d-gt.cglue.o d/d-builtins.cglue.o d/d-misc.cglue.o
d/d-builtins2.glue.o d/symbol.glue.o
d/asmstmt.glue.o d/dt.glue.o  d/d-c-stubs.cglue.o main.o  libbackend.a
../libcpp/libcpp.a
../libcpp/libcpp.a ./../intl/libintl.a -liconv  ../libiberty/libiberty.a
Undefined symbols:
  "AggregateDeclaration::buildDtor(Scope*)", referenced from:
      ClassDeclaration::semantic(Scope*)      in class.dmd.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [cc1d] Error 1
make[1]: *** [all-gcc] Error 2
make: *** [all] Error 2

Any ideas?

I compiling on Mac OS X 10.5.2.
May 06 2008
next sibling parent "Anders Bergh" <anders1 gmail.com> writes:
On Wed, May 7, 2008 at 8:58 AM, Leo Singer <aronnax umd.edu> wrote:
 I followed the instructions in the INSTALL file on the repository, downloading
the newest 4.1 release of
  GCC, which happened to be 4.1.2.  I ran the setup script, and then ran gcc's
configure script, then ran
  make.  The following link command causes make to fail:

 [snip]
  Undefined symbols:
   "AggregateDeclaration::buildDtor(Scope*)", referenced from:
       ClassDeclaration::semantic(Scope*)      in class.dmd.o
  ld: symbol(s) not found
  collect2: ld returned 1 exit status
  make[2]: *** [cc1d] Error 1
  make[1]: *** [all-gcc] Error 2
  make: *** [all] Error 2

  Any ideas?

  I compiling on Mac OS X 10.5.2.
Not really, but, you should try fetching the Apple-modified gcc from http://developer.apple.com/opensource (I think that's the right URL). Anyway, Anders F Bjorklund knows way more about this stuff than me (apple stuff). Anders
May 07 2008
prev sibling parent reply =?UTF-8?B?QW5kZXJzIEYgQmrDtnJrbHVuZA==?= <afb algonet.se> writes:
Leo Singer wrote:

 Undefined symbols:
"AggregateDeclaration::buildDtor(Scope*)", referenced from: ClassDeclaration::semantic(Scope*) in class.dmd.o ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [cc1d] Error 1 make[1]: *** [all-gcc] Error 2 make: *** [all] Error 2 Any ideas? I compiling on Mac OS X 10.5.2.
Your GCC versions and setup seems OK, it seems like symbols from "clone.c" are missing in the library creation though ? Which version of GDC and which language was this ? trunk/D2 ? Maybe you need to add d/clone.dmd.o to D_DMD_OBJS, or wait... --anders
May 07 2008
next sibling parent reply Leo Singer <aronnax umd.edu> writes:
== Quote from Anders F Björklund (afb algonet.se)'s article
 Leo Singer wrote:
 Undefined symbols:
"AggregateDeclaration::buildDtor(Scope*)", referenced from: ClassDeclaration::semantic(Scope*) in class.dmd.o ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [cc1d] Error 1 make[1]: *** [all-gcc] Error 2 make: *** [all] Error 2 Any ideas? I compiling on Mac OS X 10.5.2.
Your GCC versions and setup seems OK, it seems like symbols from "clone.c" are missing in the library creation though ? Which version of GDC and which language was this ? trunk/D2 ? Maybe you need to add d/clone.dmd.o to D_DMD_OBJS, or wait... --anders
I used the trunk: svn co http://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
May 07 2008
next sibling parent reply =?UTF-8?B?QW5kZXJzIEYgQmrDtnJrbHVuZA==?= <afb algonet.se> writes:
Leo Singer wrote:

 Which version of GDC and which language was this ? trunk/D2 ?
 Maybe you need to add d/clone.dmd.o to D_DMD_OBJS, or wait...
I used the trunk: svn co http://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
You probably need to step down a few revisions from the bleeding edge, e.g. Ubuntu uses r197 and gdcmac uses r199. It'll be fixed eventually, but trunk is *not* guaranteed to always build. Unfortunately gdc 0.25 has been delayed... But it is getting very off-topic, so suggest you continue any problems with building GDC trunk in the D.gnu newsgroup ? BTW; If you want try out DMD on your Mac you can use either Wine and the Windows version or by running* a Linux distro ? --anders * by e.g. booting a LiveCD or using a virtualization solution
May 07 2008
parent Leo Singer <aronnax umd.edu> writes:
Anders F Björklund Wrote:

 But it is getting very off-topic, so suggest you continue
 any problems with building GDC trunk in the D.gnu newsgroup ?
I'm moving this thread to that forum.
May 07 2008
prev sibling parent Fawzi Mohamed <fmohamed mac.com> writes:
On 2008-05-07 09:41:22 +0200, Leo Singer <aronnax umd.edu> said:

 == Quote from Anders F Bjrklund (afb algonet.se)'s article
 Leo Singer wrote:
 Undefined symbols:
"AggregateDeclaration::buildDtor(Scope*)", referenced from: ClassDeclaration::semantic(Scope*) in class.dmd.o ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [cc1d] Error 1 make[1]: *** [all-gcc] Error 2 make: *** [all] Error 2 Any ideas? I compiling on Mac OS X 10.5.2.
Your GCC versions and setup seems OK, it seems like symbols from "clone.c" are missing in the library creation though ? Which version of GDC and which language was this ? trunk/D2 ? Maybe you need to add d/clone.dmd.o to D_DMD_OBJS, or wait... --anders
I used the trunk: svn co http://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
I have successfully compiled gdc on leopard using revision 209. I had just to change "--strip-underscores" to "--strip-underscore" in "gcc-4.1.2/libstdc++-v3/scripts/make_exports.pl" to enable c++. I have described the procedure by updating http://www.dsource.org/projects/tango/wiki/GdcInstallation just pay attention to the comments like ("on mac do this" :) It might be that the latest trunk has other problems, in that case revert to 209... ciao Fawzi
May 07 2008
prev sibling parent Leo Singer <aronnax umd.edu> writes:
== Quote from Anders F Björklund (afb algonet.se)'s article
 Your GCC versions and setup seems OK, it seems like symbols
 from "clone.c" are missing in the library creation though ?
 Which version of GDC and which language was this ? trunk/D2 ?
 Maybe you need to add d/clone.dmd.o to D_DMD_OBJS, or wait...
Uh-oh! The build did not generate any files named 'clone.dmd.o'. $ find . -name 'clone.*' ./gcc/d/dmd/.svn/text-base/clone.c.svn-base ./gcc/d/dmd/clone.c ./gcc/d/dmd2/.svn/text-base/clone.c.svn-base ./gcc/d/dmd2/clone.c
May 07 2008