Recent

Author Topic: [SOLVED] Not able to compile simple program using pas2js  (Read 8140 times)

heejit

  • Full Member
  • ***
  • Posts: 249
[SOLVED] Not able to compile simple program using pas2js
« on: September 21, 2018, 02:15:22 pm »
Lazaurs : 2.1
fpc        : 3.3.1

Code: Pascal  [Select][+][-]
  1. file : b.pas
  2. program hello;
  3.  
  4. begin
  5.   Writeln('Hello, world!');
  6. end.
  7.  
  8. pas2js -vtb -Jc -Jirtl.js -Tbrowser b.pas
  9. Info: Configfile search: /home/jiten/.pas2js.cfg
  10. Info: Configfile search: /home/jiten/fpc-trunk/fpc/bin/x86_64-linux/pas2js.cfg
  11. Info: Configfile search: /etc/pas2js.cfg
  12. Info: output file: ""
  13. Info: Searching file: /home/jiten/System.pp... not found
  14. Info: Searching file: /home/jiten/System.pas... not found
  15. Info: Searching file: /home/jiten/System.p... not found
  16. /home/jiten/b.pas(3,6) Error: can't find unit "System"
  17. Fatal: Compilation aborted
  18. An unhandled exception occurred at $00000000004A56A3:
  19. Exception:
  20.  $00000000004A56A3
  21.  $00000000004128DB
  22.  
« Last Edit: September 24, 2018, 06:29:26 pm by jshah »

jiutianfei

  • Newbie
  • Posts: 6
Re: Not able to compile simple program using pas2js
« Reply #1 on: September 22, 2018, 05:43:27 am »
My ~/.pas2js.cfg contains this line:


-Fu/home/jiutianfei/pas2js/packages/rtl


That directory looks like this:


browserconsole.pas   libjquery.pas   README.txt     sysutils.pas
classes.pas        math.pas        rtlconsts.pas  types.pas
contnrs.pas        nodejs.pas      rtti.pas       typinfo.pas
dateutils.pas        objpas.pas      strutils.pas   webgl.pas
hotreloadclient.pas  pas2js_rtl.lpk  system.js       web.pas
js.pas           pas2js_rtl.pas  system.pas     webrouter.pp

Thaddy

  • Hero Member
  • *****
  • Posts: 18764
  • To Europe: simply sell USA bonds: dollar collapses
Re: Not able to compile simple program using pas2js
« Reply #2 on: September 22, 2018, 10:41:34 am »
Indeed, the issue is you did not include the library path. Note with pas2js I prefer to do it like the above or create a custom fpjsc.cfg for that
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

heejit

  • Full Member
  • ***
  • Posts: 249
Re: Not able to compile simple program using pas2js
« Reply #3 on: September 22, 2018, 11:19:29 am »
I dont have directory like pas2js/package

I have installed fpc/lazarus trunk using fpcupdeluxe

do I need to install anything else again ?




heejit

  • Full Member
  • ***
  • Posts: 249
Re: Not able to compile simple program using pas2js
« Reply #4 on: September 22, 2018, 11:33:21 am »
I have installed pas2js-rtl from fpcupdeluxe

Still same error

After installing pas2js-rtl new cfg file created now there is new error
after running following

pas2js @fpc-trunk/fpc/bin/pas2js.cfg -vtb -Jc -Tbrowser b.pas

Code: Pascal  [Select][+][-]
  1. Fatal: bug: uncaught Exception:
  2. Fatal: Exception:
  3. Fatal: Compilation aborted
  4. An unhandled exception occurred at $00000000004A56A3:
  5. Exception:
  6.   $00000000004A56A3
  7.   $00000000004A630B
  8.   $00000000004A3072
  9.  
  10.  

« Last Edit: September 22, 2018, 11:41:43 am by jshah »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Not able to compile simple program using pas2js
« Reply #5 on: September 22, 2018, 11:34:34 pm »
I'd say just get a prepackaged one from here. It looks like the one in fpc source folder is just the compiler, everything else is somewhere else.
« Last Edit: September 25, 2018, 05:07:54 am by Leledumbo »

lucamar

  • Hero Member
  • *****
  • Posts: 4217
Re: Not able to compile simple program using pas2js
« Reply #6 on: September 22, 2018, 11:50:22 pm »
I'd say just get a prepackaged one from here. It looks like the one in fpc source folder is just the compiler, everything else is somewhere else.
Corrected URI: ftp://ftpmaster.freepascal.org/fpc/contrib/pas2js/1.0.1/
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

heejit

  • Full Member
  • ***
  • Posts: 249
[SOLVED] Re: Not able to compile simple program using pas2js
« Reply #7 on: September 23, 2018, 12:45:25 am »
Downloaded it is working from command line

But now not working in Lazarus
« Last Edit: September 24, 2018, 06:29:38 pm by jshah »

 

TinyPortal © 2005-2018