GDC - D Compiler Usage

Programming, for all ages and all languages.
Post Reply
Columbus
Posts: 18
Joined: Sat Sep 13, 2014 2:26 am

GDC - D Compiler Usage

Post 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:

Code: Select all

int main() { return 0; }
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?
EgeO
Posts: 9
Joined: Wed Jul 23, 2014 2:03 am

Re: GDC - D Compiler Usage

Post 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
Columbus
Posts: 18
Joined: Sat Sep 13, 2014 2:26 am

Re: GDC - D Compiler Usage

Post 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.
Columbus
Posts: 18
Joined: Sat Sep 13, 2014 2:26 am

Re: GDC - D Compiler Usage

Post 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!
Columbus
Posts: 18
Joined: Sat Sep 13, 2014 2:26 am

Re: GDC - D Compiler Usage

Post 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.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: GDC - D Compiler Usage

Post by max »

EDIT: ah uhm. Maybe you should just read the wiki article about D... ;)
Last edited by max on Sat Sep 13, 2014 5:16 pm, edited 1 time in total.
User avatar
Satoshi
Member
Member
Posts: 28
Joined: Thu Sep 13, 2012 2:18 pm

Re: GDC - D Compiler Usage

Post 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
Trinix (written in D) https://github.com/Rikarin/Trinix
Streaming OS development https://www.livecoding.tv/satoshi/
Columbus
Posts: 18
Joined: Sat Sep 13, 2014 2:26 am

Re: GDC - D Compiler Usage

Post 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
User avatar
arseniuss
Member
Member
Posts: 32
Joined: Tue Aug 10, 2010 12:13 am
Location: Latvia
Contact:

Re: GDC - D Compiler Usage

Post 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!
Hobby stuff (suckless libs, compilators, game engines, kernels): github. Work @ zabbix: arseniuss@zabbix
User avatar
Satoshi
Member
Member
Posts: 28
Joined: Thu Sep 13, 2012 2:18 pm

Re: GDC - D Compiler Usage

Post 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.
Trinix (written in D) https://github.com/Rikarin/Trinix
Streaming OS development https://www.livecoding.tv/satoshi/
dan99
Posts: 1
Joined: Mon Aug 15, 2016 10:46 pm

Re: GDC - D Compiler Usage

Post 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.
Post Reply