sq / JSIL

CIL to Javascript Compiler
http://jsil.org/
Other
1.73k stars 241 forks source link

Failed to build radegast #790

Open Feay opened 9 years ago

Feay commented 9 years ago

I just want to build radegast, here on github, you can look it up. https://github.com/radegastdev/radegast I just don't know what to do to get this app into portable JS code. Before any sharky ausburgers askes "why", just case NET sucks. The solution builds fine with sharpdevlop & VS2010, BUT when i try with JSILc it goes for like 5 minutes gets stuck and consumes 99% cpu on an 8 core! then exits with an error. my cmd D:\Desktop\GITHUB\radegast\radegast-master\JSIL bin-realese>jsilc D:\Desktop\GITHUB\radegast\radegast-master\Radegast.sln -o=JRade --sbc --nt --logVerbosity=Diagnostic This is the last log then it exits with out any output js files! I just don't know what to do. I ran JSILc with the OpenMetaverse.sln in the ..\libopenmetaverse folder that sln makes a dll when compiled normally. I got a TON of JS files. I tryed to run them and the windows js thing complained about a TON of errors. So I took "OpenMetaverseTypes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.js" and by hand I fixed 200+ hanging commas on function variables. Now there is only error shown: Script: D:\Desktop\GITHUB\radegast\JSILc output OpenMetaverse\OpenMetaverseTypes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.js Line: 3 Char: 1 Error: 'JSIL' is undefined Code: 800A1361 Source: Microsoft JScript runtime error

Line three is var $asm06 = JSIL.DeclareAssembly("OpenMetaverseTypes, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");

Here is the whole file: https://dl.dropboxusercontent.com/u/11636893/OpenMetaverseTypes%2C%20Version%3D0.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull.js

kg commented 9 years ago

Why are you running the output js files with jscript? That's not going to work. That's not what jsil is for.

Can you show me an example of the trailing commas you're talking about? That sounds like a bug, but nobody has ever reported it, so I'd like to fix it.

Feay commented 9 years ago

---> (Inner Exception #0) JSIL.Internal.FunctionTransformFailureException: Function transform pipeline stage 'ExpandCastExpressions' failed on function 'MS.Internal.Xaml.Parser.ScannerNodeType MS.Internal.Xaml.Parser.XamlScannerNode::get_NodeType()': ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Collections.Generic.Stack1..ctor(Int32 capacity) at JSIL.Ast.JSAstVisitor..ctor() in d:\Desktop\JSIL-master\JSIL-master\JSIL\AST\JSAstVisitor.cs:line 24 at JSIL.Internal.FunctionTransformPipeline.ExpandCastExpressions() in d:\Desktop\JSIL-master\JSIL-master\JSIL\FunctionTransformPipeline.cs:line 372 at JSIL.Internal.FunctionTransformPipeline.RunUntilCompletion() in d:\Desktop\JSIL-master\JSIL-master\JSIL\FunctionTransformPipeline.cs:line 126 --- End of inner exception stack trace --- at JSIL.Internal.FunctionTransformPipeline.RunUntilCompletion() in d:\Desktop\JSIL-master\JSIL-master\JSIL\FunctionTransformPipeline.cs:line 171 at JSIL.AssemblyTranslator.RunTransformsOnFunction(QualifiedMemberIdentifier memberIdentifier, JSFunctionExpression function, SpecialIdentifiers si, StringBuilder log) in d:\Desktop\JSIL-master\JSIL-master\JSIL\AssemblyTranslator.cs:line 2099 at JSIL.AssemblyTranslator.<>c__DisplayClass24.<RunTransformsOnAllFunctions>b__23(QualifiedMemberIdentifier id) in d:\Desktop\JSIL-master\JSIL-master\JSIL\AssemblyTranslator.cs:line 764 at System.Threading.Tasks.Parallel.<>c__DisplayClass322.b30() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>cDisplayClass7.b__6(Object

thats when it stops! I got the fill verbose log but its 55megs to will dropbox it if some wants to take a look. Cause I have no idea what is what

Feay commented 9 years ago

@kg
https://www.dropbox.com/s/35t5jodxompdigv/jsilcproblem.png?dl=0 example of the trailing commas

Feay commented 9 years ago

https://www.dropbox.com/s/sbzcyvj7pjxidnu/CC_Out.rtf?dl=0

kg commented 9 years ago

OK, the trailing commas are valid, that's just a bug in the old jscript runtime. You shouldn't be using jscript. JSILc doesn't support anything pre-ecmascript 5 since all modern browsers have ES5.

That stack trace looks like the compiler is running out of memory because your application is big. Try disabling threaded compilation ('UseThreads': false in a config file or the --nothreads command line argument). You may also need to run JSILc as a 64-bit application, which... I forget if there's an easy way to do that.

Feay commented 9 years ago

oh well i ran that one with -nothreads but it does the exact same....I got 4 gigs available. and no 64bit winblows. So you are saying its impossible? And what of the var $asm06 = JSIL.DeclareAssembly, where is this file at?

kg commented 9 years ago

Please read the wiki: https://github.com/sq/JSIL/wiki

If you don't have 64-bit windows and it's running out of RAM, your best bet would be to try and compile in smaller steps. It's possible your application is too large to decompile into RAM, in which case JSILc won't be able to do anything about it. Future updates might reduce the amount of memory used, but it's mostly out of my control.

Feay commented 9 years ago

well that sucks it compiles fine with msbuild, just fow bug does a progam have to be to not compile? The finished product in msci form is 30 megs or so.

kg commented 9 years ago

JSIL isn't a C# compiler, it takes your compiled application (in any language) and converts it into javascript. Doing this takes a lot of memory, and much of the memory used is being used by the third-party libraries that load your compiled application and analyze it.

iskiselev commented 9 years ago

I've looked briefly on Radegast web site - looks like Radegast is huge application with a lot of GUI controls. On current state of JSIL development it will take huge work to translate such application. It should be solved how UI should work in translated version (where do you want to run it? I suppose in browser - then probably you will need to port UI to HTML). It is definitely possible to translate near every application. You can try t translate dll one-by-one without dependencies. Main questions - do you really need it, why you need it and do you have enough time to do it?

Feay commented 9 years ago

I treid again by just isolating the core project by it self instead of using the meta solution. I still get at System.Threading.Tasks.Task.<>cDisplayClass7.b6(Object )<--- then it quits doesn't even go above 1gb of ram. still 3 left! I wish I knew where to start to even atttempt a fix

kg commented 9 years ago

Please provide the full stack trace

Feay commented 9 years ago

I have enough time. Why isnt thequestion just how. HOW to get this farily slim grid viewer to be not .net. Got to start some place. Every single tool I have found is setup for bullshit X64 windows 8 shluk. I got and tried sharpkit out but it does nothing with thier sparse instructions and they don't have documentation!! Saltarelle is even more scarce. Jsil at least trys to output something usefull. btw it was a pain to get to compile. >/ BINARY people!

full stack trace? the log out put from the build???? https://www.dropbox.com/s/sbzcyvj7pjxidnu/CC_Out.rtf?dl=0 55megs full verbose

Feay commented 9 years ago

I assume JS works diffrently than C#, if i convert each DLL one by one, how will I know if i can interface with them with the main program that will be stuck in C#? if I convert each .cs file in the project to javascript, how the hell would I build it to make a program, one that uses code refranced in the convered js dlls?

kg commented 9 years ago

The log is 55mb because you turned on verbose msbuild. There's no reason to do that in this case since msbuild is working fine. (JSILc itself doesn't ever log in a 'silent' mode.)

Feay commented 9 years ago

well this is going no where

iskiselev commented 9 years ago

@Feay, start with executing JSILc against an compiled .exe/.dll. With default configuration it will try to translate all dependencies also. Then you'll be able to create your own *.jsilconfig that will disable dependencies that you don't need or play with IncludeDependencies flag to translate one assembly in time. Are you good enough in C#? Otherwise I suppose it will be impossible to translate/rewrite everything.