Jump to content


Photo

Free compiler compiles to empty .js file

free compiler

  • Please log in to reply
11 replies to this topic

#1 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 20 August 2016 - 07:47 PM

It was a long time since the last time I used the sms free compiler.  Today I tried because I'm planning a project, but I found that it generates empty javascript files.  No error message involved.  Even my old test programs, that were compiled few months ago.

 

May be it is because I installed the evaluation version of the IDE?  If so, how should I clean my system so I can use the free compiler?  If not, why it doesn't create valid javascript files?


  • AlexissNag likes this

#2 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 15 September 2016 - 03:05 PM

So, nobody answer?

 

More info:

 

I've removed the Wine directory and configuration, then reinstalled the command line compiler again.  It still doesn't work.  Trying to compile a project gives this output:

# wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Smart\ Mobile\ Studio/smsc.exe game.pas -output-name=game.js
SmartMS command-line compiler, (c) 2016 The Smart Company AS
Building src\game.pas
[INFO] Building project ''...
[INFO] Compiling...
[INFO] Generating JavaScript...
[INFO] Linking...

 

Results in an empty game.js file.  The same project generated valid JavaScript project few months ago.

 

Any clue?



#3 Laksekjønn

Laksekjønn
  • Members
  • 440 posts

Posted 15 September 2016 - 05:10 PM

Unfortunately, I can not reproduce smsc on linux environment. Maybe directory name containing spaces in the bash. Anyway, alternatively: 

I) try to move sms command line compile to .wine/drive_c/sms

II) create this core-bare-minimum sms project on projGame directory with 3 files: projGame.sproj, projGame.spr and game.pas

 

projGame.sproj

<SMART>
  <Project version="2" subversion="2">
    <Name>projGame</Name>
    <Created>T00:00:00.000</Created>
    <Modified>2016-09-15T15:50:30.593</Modified>
    <Version>
      <Major>0</Major>
      <Minor>0</Minor>
      <Revision>0</Revision>
    </Version>
    <VendorSpecific>
      <Apple>
        <FormatDetection>1</FormatDetection>
        <StatusBarStyle>default</StatusBarStyle>
        <WebAppCapable>1</WebAppCapable>
      </Apple>
      <ChromeApp>
        <Kiosk>0</Kiosk>
        <KioskOnly>1</KioskOnly>
        <OfflineEnabled>1</OfflineEnabled>
      </ChromeApp>
      <Cordova>
        <WidgetID>com.smartmobilestudio.app</WidgetID>
        <AllowIntent>http://*/*&#13;&#10;https://*/*&#13;&#10;tel:*&#13;&#10;sms:*&#13;&#10;mailto:*&#13;&#10;geo:*</AllowIntent>
      </Cordova>
    </VendorSpecific>
    <Options>
      <Compiler>
        <Assertions>1</Assertions>
        <Optimize>1</Optimize>
        <HintsLevel>2</HintsLevel>
      </Compiler>
      <Codegen>
        <Obfuscation>0</Obfuscation>
        <RangeChecking>0</RangeChecking>
        <InstanceChecking>0</InstanceChecking>
        <ConditionChecking>0</ConditionChecking>
        <LoopChecking>0</LoopChecking>
        <InlineMagics>1</InlineMagics>
        <IgnorePublishedInImplementation>0</IgnorePublishedInImplementation>
        <EmitSourceLocation>0</EmitSourceLocation>
        <EmitRTTI>0</EmitRTTI>
        <Devirtualize>1</Devirtualize>
        <MainBody>0</MainBody>
        <CodePacking>0</CodePacking>
        <SmartLinking>1</SmartLinking>
        <Verbosity>0</Verbosity>
      </Codegen>
      <ConditionalDefines>
        <HandleExceptions>0</HandleExceptions>
        <AutoRefresh>0</AutoRefresh>
        <LegacySupportForIE>0</LegacySupportForIE>
      </ConditionalDefines>
      <Linker>
        <SourceMap>0</SourceMap>
        <CompressCSS>0</CompressCSS>
        <GenerateAppCacheManifest>1</GenerateAppCacheManifest>
        <GenerateChromeAppManifest>1</GenerateChromeAppManifest>
        <GenerateFireFoxManifest>1</GenerateFireFoxManifest>
        <GenerateWebAppManifest>1</GenerateWebAppManifest>
        <GenerateWidgetPackageConfigXML>0</GenerateWidgetPackageConfigXML>
        <GenerateCordovaConfigXML>0</GenerateCordovaConfigXML>
        <ExternalCSS>1</ExternalCSS>
        <Theme>Android-Holo.css</Theme>
        <CustomTheme>0</CustomTheme>
        <EmbedJavaScript>0</EmbedJavaScript>
      </Linker>
      <Output>
        <JavaScriptFileName>%projectname%.js</JavaScriptFileName>
        <OutputFilePath>www\</OutputFilePath>
      </Output>
      <Import />
      <Execute>
        <ServeManifest>0</ServeManifest>
        <Server>1</Server>
        <CustomFile></CustomFile>
        <LoadCustomFile>0</LoadCustomFile>
        <PauseAfterExecution>0</PauseAfterExecution>
        <ExecuteType>4</ExecuteType>
      </Execute>
    </Options>
    <Files>
      <File type="main">
        <Name>projGame</Name>
        <Created>2016-09-15T15:39:20.906Z</Created>
        <Modified>2016-09-15T15:50:25.531</Modified>
        <Filename>projGame.spr</Filename>
      </File>
      <File type="unit">
        <Name>game</Name>
        <Created>2016-09-15T15:42:00.250Z</Created>
        <Modified>2016-09-15T15:43:41.046</Modified>
        <Filename>game.pas</Filename>
      </File>
    </Files>
    <Target>Espruino</Target>
    <Generator>Espruino Project</Generator>
    <Statistics>
      <BackgroundCompilations>162</BackgroundCompilations>
      <EditTime>00:02:19.672</EditTime>
      <CompileTime>00:00:00.234</CompileTime>
      <TotalTime>00:09:59.796</TotalTime>
      <DesigningTime>00:00:00.000</DesigningTime>
      <RunningTime>00:00:00.000</RunningTime>
    </Statistics>
  </Project>
</SMART>

projGame.spr

uses W3C.Console, game;

var obj: TGame;

try
  obj := TGame.Create;
  obj.Test;
except
  on e: Exception do
    console.log(e.Message);
end;

game.pas

unit game;

interface

uses W3C.Console;

type
  TGame = class
  public
    procedure Test;
  end;

implementation

procedure TGame.Test;
begin
  console.log('Test Game');
end;

end.

sms command line compiler should work both with game.pas and projGame.sproj



#4 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 19 September 2016 - 02:00 PM

Hi.  Sorry for the late post.

 

I've tried but it still generates an empty .js file.  No error messages.  This is really making me angry.

 

[edit]

I'm thinking if this is a Wine problem. I'll try in an old WindXP later and see if it works.



#5 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 21 September 2016 - 01:56 PM

Tested on actual Windows XP, no emulation. Same result.



#6 ielite

ielite
  • Members
  • 704 posts

Posted 21 September 2016 - 04:34 PM

You may want to ask the question on the SMS Facebook page.

Ill bet they will answer there. They do not seem to be following this forum at all.

Be sure to just post a link to your question here on the forum  :)



#7 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 15 October 2016 - 08:21 PM

Thanks for the advice. I'll try.



#8 gabr42

gabr42

    Boss

  • Administrators
  • 192 posts

Posted 24 October 2016 - 07:26 PM

You are correct, something is indeed wrong with the version from the internet, although the exe that I just created from the 2.2.2 sources, works just fine :(

 

Please use this version until we correct the problem: https://www.dropbox....f/smsc.exe?dl=0



#9 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 27 October 2016 - 11:52 AM

Thanks.  Unfortunately I have the same results :huh:.  The compiler executable is different; this one is about 3MiB bigger than the old one.  I did several tests but no one worked.

 

I hope next release can fix this.



#10 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 25 May 2017 - 02:16 PM

I rescue this thread just because I've read about the future new release so I re-installed and did some more testings.
 
I've found why it didn't work!
 
There are some problems with hints, warnings and error identifications by the compiler . I've discovered this because, for no special reason, I've compiled the test program using options "-verbosity=verbose -hints=pedantic", so I found that the code had some mistakes as I asumed it includes some stuff that it doesn't!
 
The problem here is that compiler doesn't tell it because it identifies such problems as hints not warnings or errors.  IMHO THIS IS A BIG MISTAKE!!!
 
Next, there's the compiler output compiling the  example provided by warleyalex in this same thread.  Remember you must uninstall SMS IDE and libraries, cleaning your system, and install the free compiler only to reproduce.

C:\SMS\ejemplo>..\smsc.exe projGame
SmartMS command-line compiler, (c) 2016 The Smart Company AS
Building ejemplo\projGame.sproj
[INFO] Building project 'projGame'...
[INFO] Compiling...
[INFO] Generating JavaScript...
[INFO] Linking...

C:\SMS\ejemplo>..\smsc.exe -verbosity=verbose -hints=pedantic -stage=output projGame
SmartMS command-line compiler, (c) 2016 The Smart Company AS
Building ejemplo\projGame.sproj
[INFO] Building project 'projGame'...
[INFO] Compiling...
Hint: "console" does not match case of declaration ("Console") [line: 10, column: 5]
Hint: "console" does not match case of declaration ("Console") [line: 17, column: 3, file: game]
[INFO] Generating JavaScript...
[INFO] Linking...

As you see, there are two Hint that should be Error or Warning.  Removing any reference to Console makes it compile correclty.

 

[edit]

I'm still doing testings and still having empty js files. :(


Edited by Ñuño Martínez, 25 May 2017 - 02:45 PM.

  • Nico Wouterse likes this

#11 Laksekjønn

Laksekjønn
  • Members
  • 440 posts

Posted 26 May 2017 - 03:35 PM

The compiler spills this hint just because it expects Console.log and not "console.log". See the "console.log" on projGame.spr line 10 and "console.log" on the unit game

Hint: "console" does not match case of declaration ("Console") [line: 10, column: 5]
Hint: "console" does not match case of declaration ("Console") [line: 17, column: 3, file:

perhaps the project does not compile on the linux environment just because it depends of the SMS\RTL\APIs\W3C\W3C.Console.pas unit and can not find it in some way. Just copy W3C.Console.pas to the current project and see what happens or try the following project which does not depend of the RTL\API\W3C

I believe should compile just fine using smsc.exe ver 2.2.2.4543.

 

projGame.sproj

<SMART>
  <Project version="2" subversion="2">
    <Name>projGame</Name>
    <Created>T00:00:00.000</Created>
    <Modified>2017-05-26T14:14:41.171</Modified>
    <Version>
      <Major>0</Major>
      <Minor>0</Minor>
      <Revision>0</Revision>
    </Version>
    <VendorSpecific>
      <Apple>
        <FormatDetection>1</FormatDetection>
        <StatusBarStyle>default</StatusBarStyle>
        <WebAppCapable>1</WebAppCapable>
      </Apple>
      <ChromeApp>
        <Kiosk>0</Kiosk>
        <KioskOnly>1</KioskOnly>
        <OfflineEnabled>1</OfflineEnabled>
      </ChromeApp>
      <Cordova>
        <WidgetID>com.smartmobilestudio.app</WidgetID>
        <AllowIntent>http://*/*&#13;&#10;https://*/*&#13;&#10;tel:*&#13;&#10;sms:*&#13;&#10;mailto:*&#13;&#10;geo:*</AllowIntent>
      </Cordova>
    </VendorSpecific>
    <Options>
      <Compiler>
        <Assertions>1</Assertions>
        <Optimize>1</Optimize>
        <HintsLevel>2</HintsLevel>
      </Compiler>
      <Codegen>
        <Obfuscation>0</Obfuscation>
        <RangeChecking>0</RangeChecking>
        <InstanceChecking>0</InstanceChecking>
        <ConditionChecking>0</ConditionChecking>
        <LoopChecking>0</LoopChecking>
        <InlineMagics>1</InlineMagics>
        <IgnorePublishedInImplementation>0</IgnorePublishedInImplementation>
        <EmitSourceLocation>0</EmitSourceLocation>
        <EmitRTTI>0</EmitRTTI>
        <Devirtualize>1</Devirtualize>
        <MainBody>0</MainBody>
        <CodePacking>0</CodePacking>
        <SmartLinking>1</SmartLinking>
        <Verbosity>0</Verbosity>
      </Codegen>
      <ConditionalDefines>
        <HandleExceptions>0</HandleExceptions>
        <AutoRefresh>0</AutoRefresh>
        <LegacySupportForIE>0</LegacySupportForIE>
      </ConditionalDefines>
      <Linker>
        <SourceMap>0</SourceMap>
        <CompressCSS>0</CompressCSS>
        <GenerateAppCacheManifest>1</GenerateAppCacheManifest>
        <GenerateChromeAppManifest>1</GenerateChromeAppManifest>
        <GenerateFireFoxManifest>1</GenerateFireFoxManifest>
        <GenerateWebAppManifest>1</GenerateWebAppManifest>
        <GenerateWidgetPackageConfigXML>0</GenerateWidgetPackageConfigXML>
        <GenerateCordovaConfigXML>0</GenerateCordovaConfigXML>
        <ExternalCSS>1</ExternalCSS>
        <Theme>Android-Holo.css</Theme>
        <CustomTheme>0</CustomTheme>
        <EmbedJavaScript>0</EmbedJavaScript>
      </Linker>
      <Output>
        <JavaScriptFileName>%projectname%.js</JavaScriptFileName>
        <OutputFilePath>www\</OutputFilePath>
      </Output>
      <Import />
      <Execute>
        <ServeManifest>0</ServeManifest>
        <Server>1</Server>
        <CustomFile></CustomFile>
        <LoadCustomFile>0</LoadCustomFile>
        <PauseAfterExecution>0</PauseAfterExecution>
        <ExecuteType>4</ExecuteType>
      </Execute>
    </Options>
    <Files>
      <File type="main">
        <Name>projGame</Name>
        <Created>2016-09-15T15:39:20.906Z</Created>
        <Modified>2016-09-15T15:50:25.531</Modified>
        <Source>
          <![CDATA[
			uses game;
			var obj: TGame;
			try
			  obj := TGame.Create;
			  obj.Test;
			except
			  on e: Exception do
				console.log(e.Message);
			end;		  
		  ]]>
        </Source>
      </File>
      <File type="unit">
        <Name>game</Name>
        <Created>2016-09-15T15:42:00.250Z</Created>
        <Modified>2017-05-26T14:14:35.984</Modified>
        <Source>
          <![CDATA[unit game;

interface

type
  TGame = class
  public
    procedure Test;
  end;

var console external 'console': variant;
  
implementation

procedure TGame.Test;
begin
  console.log('Test Game');
end;

end.]]>
        </Source>
      </File>
    </Files>
    <Target>Espruino</Target>
    <Generator>Espruino Project</Generator>
    <Statistics>
      <BackgroundCompilations>165</BackgroundCompilations>
      <EditTime>00:02:19.672</EditTime>
      <CompileTime>00:00:00.266</CompileTime>
      <TotalTime>00:10:12.405</TotalTime>
      <DesigningTime>00:00:00.000</DesigningTime>
      <RunningTime>00:00:00.000</RunningTime>
    </Statistics>
  </Project>
</SMART>


#12 Ñuño Martínez

Ñuño Martínez
  • Members
  • 28 posts

Posted 13 September 2017 - 12:28 PM

Thanks Laksekjønn.

I've tested and same result (Linux only though, didn't test on Windows).

I really don't know what's wrong: SMSC, my computer or myself. Anywaw, I tested in a different computer on June (clean one, installing the free compiler only) and had same result. Then I suspect that the SMSC needs also a valid license as the first time I tested it I still had the trial-license active.

Can somebody install the SMSC (free compiler only, not the IDE) in a clean computer (one that NEVER had SMS installed before) and confirm it works?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users