FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows batch file for building lm, and compilation issue.

 
Post new topic   Reply to topic     Forum Index -> The Language Machine
View previous topic :: View next topic  
Author Message
gamerChad



Joined: 13 Aug 2005
Posts: 21
Location: Cydonia, Mars

PostPosted: Sat Jul 28, 2007 8:14 pm    Post subject: Windows batch file for building lm, and compilation issue. Reply with quote

Here's a batch file for building lm under Windows with DMD.
It might work with GDC too, but I forget if the -I switch does the same thing on GDC.
It is intended to be placed in the languagemachine\ folder. That means the folders src, bin, and lib must share the same folder with it.

Code:
:: Build the lm toolset
build src\lm\lmdxMain.d -ofbin\lm -clean -Isrc
build src\lmn\lmn2d src\lmnBootstrap\lmddmain -ofbin\lmn2d -clean -Isrc
build src\lmn\lmn4d src\lmnBootstrap\lmddmain -ofbin\lmn4d -clean -Isrc
build src\lmn\lmn2c src\lmnBootstrap\lmddmain -ofbin\lmn2c -clean -Isrc
build src\lmn\lmn4c src\lmnBootstrap\lmddmain -ofbin\lmn4c -clean -Isrc
build src\lmn\lmn2m src\lmnBootstrap\lmddmain -ofbin\lmn2m -clean -Isrc

:: Build the calc example.
lmn2d src\examples\calc.lmn > src\examples\calc.d
build src\examples\calc src\examples\calcmaind -clean -Isrc

:: Build d2d
lmn2d src\d2d\d2xfe.lmn src\d2d\d2dbe.lmn > src\d2d\d2d.d
build src\d2d\d2d src\lmnBootstrap\lmddmain -ofbin\d2d -clean -Isrc


Of course better could be done, but I'm not a MSDOS prompt wizard and I have better things to learn (like lm).

I am compiling with DMD 1.014 and I came up with a couple problems. I also don't really feel like messing with DMD 2.0+ at the moment, or installing later versions of DMD.
- 'ref' became a keyword, or something like that. Replacing all instances of 'ref' with something else fixed the problem.
- I ran into a compile time error in element.d:
Code:
C:\Downloads\Programming\lm\languagemachine>build src\lm\lmdxMain.d -ofbin\lm -clean -Isrc
src\lm\element.d(1169): Error: function expected before (), not this.f of type bit*
src\lm\element.d(1169): function lm.engine.stream.pushx (element) does not match parameter types (int)
src\lm\element.d(1169): Error: cannot implicitly convert expression ((this.f)(sr)) of type int to lm.element.element

Apparently the type lmnFunc wasn't defined, so I replaced the offending line with this:
Code:
element nullFun(inout stream s) { return null; }; // yoinked from engine.d
mode act(inout stream sr, mode b) { sr.pushx(nullFun(sr)); return b; }

Then it (perhaps wrongly) compiled, and lm still works as far as I can tell.

That's all for the business portion of this post.
I'm back here after taking a long break, which involved a year of school with only very little coding. Now I have some summer time to play around with things like lm. There is a higher priority project I have in mind, but porting an already-made game to another platform is just not as entertaining as learning unusual and seemingly powerful things like lm Wink
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Mon Jul 30, 2007 7:07 am    Post subject: Reply with quote

I suspect you'd get better results with an older version of DMD. (I can't tell what part of DMD could have changed to give you those error messages, so I can't tell you what you need to change in the code.) I looked at the changes for the last 300 days:
Quote:
06/04/07:

07:31 Changeset [51] by mpah
added src/dmd directory for testing with dmd

06/03/07:

09:54 Changeset [50] by mpah
modifications for compatibility with gdc-0.22 and dmd-1.010



It looks like the code has been updated to work with DMD 1.010, so I'd try using that and see if it runs. Also, you could look at the DMD 1.x changelog to see what changed between DMD 1.010 and DMD 1.014.
Back to top
View user's profile Send private message AIM Address
gamerChad



Joined: 13 Aug 2005
Posts: 21
Location: Cydonia, Mars

PostPosted: Tue Jul 31, 2007 3:01 pm    Post subject: Reply with quote

After testing a simple lmn program that used to work, I'm beginning to worry that this compile error and the hack to fix it are the cause of my problem in the other post I just made about a lmn program.

I tried dmd 1.010, dmd 1.000, and dmd 1.020. They all have the same problem. Hmmm.

Right now I am trying to use gdc 0.23 on windows to do this. Unfortunately I am running into a slew of problems, all seem unrelated to the language machine. Currently I get this error:
C:\Downloads\Programming\lm4\languagemachine>build src\lm\lmdxMain.d -obin\lm -B
src -V -v -names
Current Dir 'C:\Downloads\Programming\lm4\languagemachine\'
[ src\lm\lmdxMain.d ]
gdc.exe: @src\lm\lmdxMain.rsp: No such file or directory
gdc.exe: no input files

I'm about to give up on doing this stuff in windows and just boot into linux... at least gdc works for me there. I didn't do this already because my last setup of linux went into the trash (it was glitchy as hell anyways) with my last harddrive so I have to set everything up again, ha ... haha ... hahaha ... ugh.
Back to top
View user's profile Send private message
gamerChad



Joined: 13 Aug 2005
Posts: 21
Location: Cydonia, Mars

PostPosted: Thu Aug 02, 2007 4:12 pm    Post subject: Reply with quote

Well, linux didn't go so well. I built lm with gdc 0.23. I didn't go any further because lmn2d would seg fault upon executing.

Back in windows land I found out that compiling with lmddMain.d instead of lmdxMain.d as the entry point made the element.d compilation problem go away. That means I can't use lm.exe, but I still have lmn2d which is all I need. I tested it on a simple lmn file and it runs and produces correct output.
Back to top
View user's profile Send private message
Theophilus



Joined: 05 Jan 2008
Posts: 2

PostPosted: Sat Jan 05, 2008 2:57 pm    Post subject: perhapse a better fix Reply with quote

I looked into this problem as I was trying to compile lm on dmd 1.015
I placed the following from engine.d into element.d
Code:

//this was undefined
extern (C) {
element nullFun(inout stream s);
}
alias typeof(nullFun) *                   lmnFunc;


this fixed the undefined lmnFunc problem.
note I didn't redefine nullFun I just created a forward reference to it.
now src/lm/lmndxMain.d will compile. Smile
Back to top
View user's profile Send private message
Theophilus



Joined: 05 Jan 2008
Posts: 2

PostPosted: Sat Jan 05, 2008 5:41 pm    Post subject: Except... Reply with quote

Embarassed
The formar patch works when compiling lmdxMain but breaks the other targets.
To fix that I added this to element.d instead of my previous change
Code:

extern (C) {
element nullFun(inout stream s);
}
alias typeof(nullFun) *                   lmnFunc2;

Then I changed the Class lmnFuncF in element.d.
Both references to lmnFunc are now lmnFunc2
Now everything compiles with the above batch file.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> The Language Machine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group