OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Nov 17, 2017 6:46 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 12:26 pm 
Offline

Joined: Sat Sep 13, 2014 2:26 am
Posts: 18
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:
int main() { return 0; }

GDC returns:
Code:
cc1d: error: cannot find source code for runtime library file 'object.d'

So I "touch"ed object.d . Now it returns:
Code:
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:
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?


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 12:36 pm 
Offline

Joined: Wed Jul 23, 2014 2:03 am
Posts: 9
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


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 12:46 pm 
Offline

Joined: Sat Sep 13, 2014 2:26 am
Posts: 18
Where's the problem?
I tried now tried a "Hello World!" with a native GDC.
It is:
Code:
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.


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 1:05 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 2:09 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sat Sep 13, 2014 5:11 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 554
Location: Germany
EDIT: ah uhm. Maybe you should just read the wiki article about D... ;)

_________________
-maxdev
Ghost OS / https://github.com/maxdev1/ghost


Last edited by max on Sat Sep 13, 2014 5:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sun Sep 14, 2014 12:04 am 
Offline
Member
Member
User avatar

Joined: Thu Sep 13, 2012 2:18 pm
Posts: 28
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/


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Sun Sep 14, 2014 2:07 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Mon Sep 15, 2014 10:24 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 10, 2010 12:13 am
Posts: 27
Location: Latvia
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!

_________________
Please, correct my English ...
---------------------------------------------------------------------------------------------
Working on flos operating system: flos @ arseniuss.id.lv, blog && github


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Thu Sep 25, 2014 7:13 am 
Offline
Member
Member
User avatar

Joined: Thu Sep 13, 2012 2:18 pm
Posts: 28
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/


Top
 Profile  
 
 Post subject: Re: GDC - D Compiler Usage
PostPosted: Mon Aug 15, 2016 11:17 pm 
Offline

Joined: Mon Aug 15, 2016 10:46 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group