Page 1 of 1
GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 12:26 pm
by Columbus
I installed GCC with languages C, D and C++ enabled, using the GCC and GDC tutorials from the wiki, but now I'm asking me:
How to compile a D program/kernel properly?
I don't have much D experience, but know C++ pretty well.
When I try to compile a main.d with "gdc -c -o main.o main.d"
and a main.d like:
GDC returns:
Code: Select all
cc1d: error: cannot find source code for runtime library file 'object.d'
So I "touch"ed object.d . Now it returns:
Code: Select all
cc1d: error: module __entrypoint is in file '__entrypoint.d' which cannot be read
So I "touch" again. This time __entrypoint.d
And it throws another error:
Code: Select all
cc1d: error: ModuleInfo not found. object.d may be incorrectly installed or corrupt.
What is object.d? With what information should I fill it, and so on.
Shortly: What should I do?
Re: GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 12:36 pm
by EgeO
That's wrong code. I suggest you to learn the language first before wanting to make kernel with it.
http://www.dprogramming.com/tutorial.php
Re: GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 12:46 pm
by Columbus
Where's the problem?
I tried now tried a "Hello World!" with a native GDC.
It is:
Code: Select all
import std.stdio;
int main()
{
writefln("Hello World!");
return 0;
}
And it works.
Why? I'mean, where's the problem with an empty function?
I'm eager to know what causes the problem.
Re: GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 1:05 pm
by Columbus
I don't see any fault in the code, I mean, I just wanted to try, if the compiler works correctly (and so on).
But it just won't compile with the cross-compiler!
Re: GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 2:09 pm
by Columbus
So I checked it again:
The code in main.d is correct. With the native GDC it works. Also with the -c argument.
With the cross GDC compiler it throws the described errors.
I would be very happy, if someone could explain the problem to me.
Re: GDC - D Compiler Usage
Posted: Sat Sep 13, 2014 5:11 pm
by max
EDIT: ah uhm. Maybe you should just read the
wiki article about D...
Re: GDC - D Compiler Usage
Posted: Sun Sep 14, 2014 12:04 am
by Satoshi
You need link modified Druntime to your kernel and define some basic functions like malloc/free/calloc/memcpy/... Wiki about D is totaly useless and D barebones are for D1.
Here is my modified Druntime but actually im trying to rewrite it from scratch.
http://git.gshost.eu/trinix/trinix/tree ... e/druntime
GC, synchronization, shared (only __gshared)) is not working and D without GC is practically useless becasue u cant catch every memory leak maked with merging strings, reallocating arrays...
And here are defined basic C fucntions
http://git.gshost.eu/trinix/trinix/blob ... /Runtime.c
Re: GDC - D Compiler Usage
Posted: Sun Sep 14, 2014 2:07 am
by Columbus
Ok, I couldn't compile your lib.
I think I'll wait with D as OSdev language, until there are usable tutorials.
For now, I'll continue with C/C++
Thanks for the help
Re: GDC - D Compiler Usage
Posted: Mon Sep 15, 2014 10:24 pm
by arseniuss
I would recommend XomB:
https://github.com/xomboverlord
He (probably he) is making exokernel in D and have D bare bones for bare metal programming. He is using dmd and I havent tested it on gdc.
Enjoy!
Re: GDC - D Compiler Usage
Posted: Thu Sep 25, 2014 7:13 am
by Satoshi
arseniuss wrote:I would recommend XomB:
https://github.com/xomboverlord
He (probably he) is making exokernel in D and have D bare bones for bare metal programming. He is using dmd and I havent tested it on gdc.
Enjoy!
But its for old D1 lang.
Re: GDC - D Compiler Usage
Posted: Mon Aug 15, 2016 11:17 pm
by dan99
Columbus --- this is an old post, and i'm sure you've moved on to something else by now.
But it seems to be the top match on google for the error message cited, and i ran across this article when i was confronted with the same message and needed to cope with it. So here's a very late reply.
The deal is that object.d (or, alternatively, object.di) and some of those other files are needed by the compiler because they serve the same function as .h files for the c compiler. d is like java, and does not require .h files, but it does require something to determine if calls are being made correctly. And if you know where object.d (or object.di) is on your target, then you can specify where the compiler should look for them with a -I argument (just like for c).
Finally, a very good reference for d is Andrei Alexandrescu's book on the subject --- roughly comparable to one of Stroustrup's books on c++, but quite a bit shorter since d doesn't have nearly as much cruft.