www.digitalmars.com         C & C++   DMDScript  

D - How do you compile the front end?

reply kinghajj <kinghajj_member pathlink.com> writes:
I tried, and got lots of errors: can you include a makefile in the next release,
please? That would be *very* helpfull.
Apr 01 2004
parent reply Ilya Minkov <minkov cs.tum.edu> writes:
kinghajj schrieb:
 I tried, and got lots of errors: can you include a makefile in the next
release,
 please? That would be *very* helpfull.
You cannot compile this front-end because you don't have a back-end. ;) It is primarily thought for other compiler and tool maintainers, as well as for everyone who wants to read the code. Join D.gnu and grab one there, they compile against GCC source. -eye
Apr 02 2004
parent reply kinghajj <kinghajj_member pathlink.com> writes:
You cannot compile this front-end because you don't have a back-end. ;) 
It is primarily thought for other compiler and tool maintainers, as well 
as for everyone who wants to read the code.

Join D.gnu and grab one there, they compile against GCC source.

-eye
..I thought that DMD made the OBJ files, and DMC made the exe from those. If not windows, isn't that how it works on Linux, since it already has GCC on it (usually). I was trying to build the front end for Darwin (MacOS X).
Apr 02 2004
parent reply Ilya Minkov <minkov cs.tum.edu> writes:
kinghajj schrieb:
 ..I thought that DMD made the OBJ files, and DMC made the exe from those.
 If not windows, isn't that how it works on Linux, since it already has GCC on
it
 (usually).
From DMC installation, only the linker is used directly. DMD is compiled statically against that part of DMC called "back-end" which generates object code (.obj files) from an abstract (C-level) representation of a program. Thus "back-end" is not included in the compiler source, but is included in every executable, and it's the same with GCC version. BTW, .obj file format is different between compilers. But they always contain already compiled machine code, which only has placeholders for the code which has to be found in other .obj files. The linker connects many .obj files to an executable by editing this placeholders and writing an OS-standard file format. DMD for Linux contains a modified version of DMC back-end which outputs object files in the format which GNU linker understands under Linux, and uses the GCC linker. However, it's still a DMC back-end and it can only generate code for Intel CPUs, and it is an enormous amount of work to add support for different CPUs (exception may be AMD64), so don't expect it to ever be ported over to IBMs.
 I was trying to build the front end for Darwin (MacOS X).
Then you definately need one from D.gnu, namely the recent GDC, or you can ask resistor or someone else of the MacOS guys to send you a compiled one. Please read their discussion, i guess they have just made it work with MacOS X. BTW, its principle is exactly the same as with DMC, the compiler executable will contain the GCC back-and and only make use of the already installed GCC linker. -eye
Apr 02 2004
parent reply Manfred Nowak <svv1999 hotmail.com> writes:
Ilya Minkov wrote:

 DMD for Linux contains a modified version of DMC back-end which outputs 
 object files in the format which GNU linker understands under Linux, and 
 uses the GCC linker.
Are the formats different between linux and windows? If they are the same, I would like to have a windows dmd to use with cygwin or msys. So long!
Apr 02 2004
parent reply Ilya Minkov <minkov cs.tum.edu> writes:
Manfred Nowak schrieb:

 Ilya Minkov wrote:
 
 
DMD for Linux contains a modified version of DMC back-end which outputs 
object files in the format which GNU linker understands under Linux, and 
uses the GCC linker.
Are the formats different between linux and windows? If they are the same, I would like to have a windows dmd to use with cygwin or msys.
They are different. DMD on Windows uses OMF also used by Intel, Watcom, Borland (mutually not completely compatible!). DMD and GCC on Linux use ELF. Cygwin GCC and MinGW on Windows use COFF very (but not quite) similar to that of Microsoft compilers. Perhaps you can use something like coff2omf available from Walter in his extended utility package, but i think it is somewhat unstable where it comes to code which imports from DLLs... There is also a Linker from Christof Meerwald (http://cmeerw.org/prog/owtools/) adapted from OpenWatcom, you can try if it links together DigitalMars code and MS and GCC code - it should understand many variants of COFF and OMF. COFF is also a basis for executable file format on Windows, while ELF is executable on Linux. Otherwise than linking with GCC you should not have any problem at all using DM tools from cygwin or msys. ;) -eye
Apr 02 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Ilya Minkov wrote:

 They are different. DMD on Windows uses OMF also used by Intel, 
 Watcom, Borland (mutually not completely compatible!).  DMD and GCC on 
 Linux use ELF. Cygwin GCC and MinGW on Windows use COFF very (but not 
 quite) similar to that of Microsoft compilers. Perhaps you can use 
 something like coff2omf available from Walter in his extended utility 
 package, but i think it is somewhat unstable where it comes to code 
 which imports from DLLs... There is also a Linker from Christof 
 Meerwald (http://cmeerw.org/prog/owtools/) adapted from OpenWatcom, 
 you can try if it links together DigitalMars code and MS and GCC code 
 - it should understand many variants of COFF and OMF.

 COFF is also a basis for executable file format on Windows, while ELF 
 is executable on Linux.

 Otherwise than linking with GCC you should not have any problem at all 
 using DM tools from cygwin or msys. ;)

 -eye
Interesting. So do you know much about the CodeView format and how it differs from the COFF format? That's vague I know. I'm just been trying to get my head around the format for this debugger me and Charles are writing and wonder if your a good resource for this subject. -- -Anderson: http://badmama.com.au/~anderson/
Apr 02 2004
next sibling parent reply Ilya Minkov <minkov cs.tum.edu> writes:
J Anderson schrieb:

 Interesting.
 
 So do you know much about the CodeView format and how it differs from 
 the COFF format? That's vague I know.
I don't know how debugging information is embedded into executable. It also seems that it is not very dependant of the object file format?
 I'm just been trying to get my head around the format for this debugger 
 me and Charles are writing and wonder if your a good resource for this 
 subject.
No, no, i don't know anything. All i can do is give useless advice to clueless newbee users. ;) BTW, why are you writing a debugger? You'll have an unportable Windows debugger then... I would say it possibly makes more sense to change the GNU debugger to unmangle D mangles correctly, i heard that GDC already outputs debugging info. And steering of GDB can be fairly easily embedded into IDEs. This will also shift the situation of GDC being the new playground for language features. I believe many would like to see, e.g. serialization being ported over from DLI - i just recently discovered to my surprise it's *not* in DMD! -eye
Apr 02 2004
next sibling parent reply Ilya Minkov <minkov cs.tum.edu> writes:
Ilya Minkov schrieb:

 No, no, i don't know anything. All i can do is give useless advice to
 clueless newbee users. ;)
Nontheless, i can be useful by googling. http://www.jorgon.freeserve.co.uk/Other/pdb.htm Describes the CodeView format. It states that executables only contain a link to a PDB file, which contains the complete information. According to this, PDB CodeView format changes and is for some versions not documented, but there exists an API to access it. http://www.objmedia.demon.co.uk/freeSoftware/peFileExplorer.html Open source to access information in executables. http://www.orgon.com/w2k_internals/cd.html These examples from a book can hook on debugger interface and read CodeView information. Here they are in executable form, they come with full source code with a book. BTW, have you been thinking of reusing at least OpenWatcom debugger's source? It also understands CodeView, even if it dislikes it sometimes. People have reported that it likes to crash on DMC generated executables, but i was able to use it. From the GoBug documentation it also appears that there was some other debug information type called COFF besides CodeView, on the other hand COFF is the .obj format and PE-COFF are executables. http://www.windowsitlibrary.com/Content/356/11/5.html This is a page from PE/COFF executable format description, about debug information. I'll see if i can find anything else useful tomorrow. -eye
Apr 02 2004
parent J Anderson <REMOVEanderson badmama.com.au> writes:
Thanks a lot for your help.


Ilya Minkov wrote:

 Ilya Minkov schrieb:

 No, no, i don't know anything. All i can do is give useless advice to
 clueless newbee users. ;)
Nontheless, i can be useful by googling. http://www.jorgon.freeserve.co.uk/Other/pdb.htm Describes the CodeView format. It states that executables only contain a link to a PDB file, which contains the complete information. According to this, PDB CodeView format changes and is for some versions not documented, but there exists an API to access it. http://www.objmedia.demon.co.uk/freeSoftware/peFileExplorer.html Open source to access information in executables. http://www.orgon.com/w2k_internals/cd.html These examples from a book can hook on debugger interface and read CodeView information. Here they are in executable form, they come with full source code with a book. BTW, have you been thinking of reusing at least OpenWatcom debugger's source? It also understands CodeView, even if it dislikes it sometimes. People have reported that it likes to crash on DMC generated executables, but i was able to use it.
I'll have a look.
 From the GoBug documentation it also appears that there was some other 
 debug information type called COFF besides CodeView, on the other hand 
 COFF is the .obj format and PE-COFF are executables.


 http://www.windowsitlibrary.com/Content/356/11/5.html

 This is a page from PE/COFF executable format description, about debug 
 information.

 I'll see if i can find anything else useful tomorrow.

 -eye
-- -Anderson: http://badmama.com.au/~anderson/
Apr 02 2004
prev sibling parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Ilya Minkov wrote:

 And steering of GDB can be fairly easily 
 embedded into IDEs. This will also shift the situation of GDC being the
 new playground for language features.
I can't get GDB to work with D in windows, I get "not in executable format: File format not recognized" I think GDB doesn't understand codeview. CDB (comes with windbg) is another dos debugger but I can't understand how to use that.
 -eye
-- -Anderson: http://badmama.com.au/~anderson/
Apr 03 2004
parent Ilya Minkov <minkov cs.tum.edu> writes:
J Anderson schrieb:
 Ilya Minkov wrote:
 I can't get GDB to work with D in windows, I get
 "not in executable format: File format not recognized"
 I think GDB doesn't understand codeview.
No, it doesn't work with DMD or DigitalMars executables. I meant using it with GDC. GCC uses its own debugging information format under Windows, i think it is stabs? The documentation is too vague and says nothing specific on the subject, as far as i can remember. Ah, this page here gives more clues: http://developer.apple.com/documentation/DeveloperTools/gdb/gdbint/gdbint_6.html#SEC40
 CDB (comes with windbg) is another dos debugger but I can't understand 
 how to use that.
You probably mean command line debugger? Wonderful, i didn't know it exists. ;) It apparently diverges from common conventions of JDB and GDB. http://www.codeproject.com/debug/windbg_part1.asp Here you can find a table with commands. This page also states that the table has been taken from a help file which is distributed with windbg. :> -eye
Apr 03 2004
prev sibling next sibling parent Mark T <Mark_member pathlink.com> writes:
So do you know much about the CodeView format and how it differs from 
the COFF format? That's vague I know.

I'm just been trying to get my head around the format for this debugger 
me and Charles are writing and wonder if your a good resource for this 
subject.
you may want look for stuff created by Al Stevens (former Dr. Dobbs columnist) he had many discussions about this in his column because he had to create a Windows debugger for GCC C++. http://sources.redhat.com/ml/gdb-patches/2002-09/msg00445.html http://www.alstevens.com/quincy.html
Apr 03 2004
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"J Anderson" <REMOVEanderson badmama.com.au> wrote in message
news:c4kkr7$2der$1 digitaldaemon.com...
 So do you know much about the CodeView format and how it differs from
 the COFF format? That's vague I know.
The debug info format is distinct from the object file format. Codeview (CV) format can be embedded in both OMF and COFF files. Neither OMF nor COFF specify any debug format other than how line numbers correspond to source files. What I'd do first is google and download specs for Codeview, ELF, Dwarf, and Portable Executable (PE) file formats. The debugger need not be concerned with OMF nor COFF, since the debugger does not deal with object files.
Apr 05 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Walter wrote:

The debug info format is distinct from the object file format. Codeview (CV)
format can be embedded in both OMF and COFF files. Neither OMF nor COFF
specify any debug format other than how line numbers correspond to source
files.

What I'd do first is google and download specs for Codeview, ELF, Dwarf, and
Portable Executable (PE) file formats. The debugger need not be concerned
with OMF nor COFF, since the debugger does not deal with object files.
  
I'm probably wrong, but unfortunately the Codeview specs don't appear to be online. There have been a few other frustrated people in other newsgroups who say the same thing. However there appears to be heaps of info about PE. -- -Anderson: http://badmama.com.au/~anderson/
Apr 07 2004
parent "Walter" <walter digitalmars.com> writes:
"J Anderson" <REMOVEanderson badmama.com.au> wrote in message
news:c50o7h$2kbv$1 digitaldaemon.com...
 Walter wrote:
The debug info format is distinct from the object file format. Codeview
(CV)
format can be embedded in both OMF and COFF files. Neither OMF nor COFF
specify any debug format other than how line numbers correspond to source
files.

What I'd do first is google and download specs for Codeview, ELF, Dwarf,
and
Portable Executable (PE) file formats. The debugger need not be concerned
with OMF nor COFF, since the debugger does not deal with object files.
I'm probably wrong, but unfortunately the Codeview specs don't appear to be online. There have been a few other frustrated people in other newsgroups who say the same thing.
Microsoft used to make it available as part of their "Open Tools" program. I suggest contacting MS and seeing if they'll release a spec to you.
Apr 13 2004