Lazarus

Programming => Networking and Web Programming => Pas2JS => Topic started by: mangakissa on February 25, 2019, 03:02:06 pm

Title: Compileserver (simpleserver) with pas2js
Post by: mangakissa 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?
Title: Re: Compileserver (simpleserver) with pas2js
Post by: mattias 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/
Title: Re: Compileserver (simpleserver) with pas2js
Post by: d-_-b 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 (https://wiki.lazarus.freepascal.org/lazarus_pas2js_integration#Global_options).

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,
Title: Re: Compileserver (simpleserver) with pas2js
Post by: TRon 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 (https://gitlab.com/freepascal.org/fpc/source/-/commit/d338206814796306ab4dc428f1a398326ee0a4df)) so you would have to download the sources from trunk and compile it manually to create the (correct) executable.
Title: Re: Compileserver (simpleserver) with pas2js
Post by: Thaddy 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.
Title: Re: Compileserver (simpleserver) with pas2js
Post by: d-_-b on February 19, 2024, 09:05:26 am
The version option was added last year in trunk (see commit (https://gitlab.com/freepascal.org/fpc/source/-/commit/d338206814796306ab4dc428f1a398326ee0a4df)) 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 (https://gitlab.com/freepascal.org/fpc/pas2js/-/tree/main/demo) and the stackoverflow astar.pas example (https://stackoverflow.com/q/9079969)(running on jsfiddle (https://jsfiddle.net/dm6cnhsw/)).




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,

Title: Re: Compileserver (simpleserver) with pas2js
Post by: TRon 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