Jump to content
Niunio_Martinez

Free compiler compiles to empty .js file

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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://*/*
https://*/*
tel:*
sms:*
mailto:*
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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://*/*
https://*/*
tel:*
sms:*
mailto:*
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>

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×