Recent

Author Topic: Compileserver (simpleserver) with pas2js  (Read 3951 times)

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Compileserver (simpleserver) with pas2js
« on: February 25, 2019, 03:02:06 pm »
I have in options the path to the simpleserver (now compileserver) set to C:\lazarus\components\pas2js\bin\compileserver.exe on port 3000. If I create a new app, I set in the configfile that a server is needed on port 3000.
Then I put the line writeln('hello') and compile it without errors. Then I run the app without debugging. Nothing happens. When I want to run for the second time, it comes with the errer "file not open"

How can I use simpleserver with pas2js?
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

mattias

  • Administrator
  • Full Member
  • *
  • Posts: 184
    • http://www.lazarus.freepascal.org
Re: Compileserver (simpleserver) with pas2js
« Reply #1 on: February 25, 2019, 03:14:16 pm »
You can start compilerserver with option -s, then it will behave like simpleserver.

Or you can build simpleserver. Its sources can be found in fpc trunk packages/fcl-web/examples/simpleserver/

d-_-b

  • New Member
  • *
  • Posts: 43
Re: Compileserver (simpleserver) with pas2js
« Reply #2 on: February 16, 2024, 11:56:48 am »
Im trying to create a Web Browser Application from New Project.

I setup my global options as on the wiki.

Compiled `fpcsrc\packages\fcl-web\examples\simpleserver` manually and changed path of compileserver from $MakeExe(IDE,simpleserver)
to `C:\lazarus\fpc\3.2.2\source\packages\fcl-web\examples\simpleserver\simpleserver.exe`.

When I run the project I get the following:

Simple Web Server:
Wrong compileserver exe: simpleserver does not support --version, maybe this is an old version?
see Tools / Options / Environment / Simple Web Server / Simpleserver


Where can i find the correct compileserver.exe with --version support?

I'm using Lazarus 3.0 (rev lazarus_3_0) FPC 3.2.2 x86_64-win64-win32/win64 with the latest pas2js main git branch.

Thanks,
Code: Pascal  [Select][+][-]
  1. mov     ax,0013h
  2. int     10h
Denthor thanks for the vga programming tutorials | Download all tutorials

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: Compileserver (simpleserver) with pas2js
« Reply #3 on: February 16, 2024, 12:22:47 pm »
Where can i find the correct compileserver.exe with --version support?
The version option was added last year in trunk (see commit) so you would have to download the sources from trunk and compile it manually to create the (correct) executable.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Compileserver (simpleserver) with pas2js
« Reply #4 on: February 16, 2024, 05:51:04 pm »
You are aware the compiler itself can run as cgi? You only need to provide an interface.
Specialize a type, not a var.

d-_-b

  • New Member
  • *
  • Posts: 43
Re: Compileserver (simpleserver) with pas2js
« Reply #5 on: February 19, 2024, 09:05:26 am »
The version option was added last year in trunk (see commit) so you would have to download the sources from trunk and compile it manually to create the (correct) executable.

Thank you,

I used fpcupdeluxe-x86_64-win64.exe and compiled fpc trunk(lazarus failed see below), I then compiled C:\fpcupdeluxe\fpcsrc\packages\fcl-web\examples\simpleserver using lazarus 3 ide i download from the web. Had to change lazarus Tools > Options > Env, compiler to C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.exe and fpc source to C:\fpcupdeluxe\fpcsrc\.

Now I can run "Web Browser Application from New Project".

I had another problem,

c:\prj\pas>pas2js -Jc -Jirtl.js -Tbrowser astar.js
astar.js(1,4) Error: can't find unit "System"
Fatal: Compilation aborted


I added -vt to pas2js for more verbose config debugging and realised the pas2js.cfg is broken for package directory using unix pathing(/) instead of windows pathing(\), changed:

#IFDEF FPC_SUBTARGET_NAMESPACED
-Fu$CfgDir\..\..\packages/*/*/namespaced
-Fi$CfgDir\..\..\packages/*/*/src
#else
-Fu$CfgDir\..\..\packages/*/*/src


To

#IFDEF FPC_SUBTARGET_NAMESPACED
-Fu$CfgDir\..\..\packages\*\namespaced
-Fi$CfgDir\..\..\packages\*\src
#else
-Fu$CfgDir\..\..\packages\*\src


Enabling me to compile the pas2js trunk demo's and the stackoverflow astar.pas example(running on jsfiddle).




C:/fpcupdeluxe/fpc/bin/x86_64-win64/fpc.exe -MObjFPC -Scghi -O1 -g -gl -l -venibq -vw-h- -vm6058,3057 -Fu. -Fu../../packager/units/x86_64-win64 -Fu../lazdebuggers/lazdebuggerintf/lib/x86_64-win64 -Fu../lazutils/lib/x86_64-win64 -Fu../debuggerintf/lib/x86_64-win64 -Fu../freetype/lib/x86_64-win64 -Fu../../lcl/units/x86_64-win64 -FuC:/fpcupdeluxe/fpcsrc/rtl -FE. -FUlib/x86_64-win64 -vw-n-h-l-d-u-t-p-c- -g -gl -dx86_64 fpdebug.pas
(1002) Target OS: Win64 for x64
(3104) Compiling fpdebug.pas
(3104) Compiling fpdbgclasses.pp
(3104) Compiling fpdbgutil.pp
C:\fpcupdeluxe\lazarus\components\fpdebug\fpdbgutil.pp(115,52) Error: (4003) Type identifier expected
C:\fpcupdeluxe\lazarus\components\fpdebug\fpdbgutil.pp(115,52) Error: (4009) Class type expected, but got "<erroneous type>"
C:\fpcupdeluxe\lazarus\components\fpdebug\fpdbgutil.pp(116,16) Error: (3058) There is no method in an ancestor class to be overridden: "PushItem(const TFpThreadWorkerItem):System.Boolean;"
C:\fpcupdeluxe\lazarus\components\fpdebug\fpdbgutil.pp(229,1) Fatal: (10026) There were 3 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode
make.exe[1]: *** [lazbuildlclpackages] Error 2
C:\fpcupdeluxe\fpcbootstrap\make.exe: *** [lazbuild] Error 2
fpcupdeluxe: ERROR: Lazarus Native Installer (BuildModuleCustom: Lazbuild): make.exe returned exit status #2.




You are aware the compiler itself can run as cgi? You only need to provide an interface.

No, want to give a example? Was just following the docs on pas2js on the wiki,

Code: Pascal  [Select][+][-]
  1. mov     ax,0013h
  2. int     10h
Denthor thanks for the vga programming tutorials | Download all tutorials

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: Compileserver (simpleserver) with pas2js
« Reply #6 on: February 19, 2024, 09:16:12 am »
Thank you,
You're welcome  :)

Quote
I used fpcupdeluxe-x86_64-win64.exe and compiled fpc trunk(lazarus failed see below), ....
You must have had the worst timing ever  :-X

This issue was closed a couple of hours ago so if you try to compile trunk again then the particular issue for which you posted the error-log, should be fixed now. BTW thank you very much for posting the error-log as it make things more clear about what exactly you are dealing with. Also thank you very6 much for the other hints and tips.

 

TinyPortal © 2005-2018