Recent

Author Topic: LCL without Lazarus  (Read 580 times)

OneHitWonder

  • Newbie
  • Posts: 3
LCL without Lazarus
« on: May 03, 2020, 07:17:37 pm »
Hello all,

First of all I'd like to just point out that I am new to Pascal and Lazarus and have only been using it for a couple of days now. I am coming from a Java background mainly for Android development. A lot of tutorials on Pascal seem to involve Lazarus quiet heavily. To the point where I think a beginner would find it difficult to differentiate the two.

That said I have focused mainly on trying to learn Pascal without the Lazarus IDE and work more with the FPC. I want to create a basic Window / Form without using Lazarus. I managed to locate this wiki page https://wiki.lazarus.freepascal.org/Using_the_LCL_without_Lazarus but it feels incomplete or I am missing something.

I am trying to compile my program using
Code: Pascal  [Select][+][-]
  1. fpc -Fu/usr/lib/lazarus/1.8.2/units/x86_64-linux/gtk2 test.pas
but I am getting a compiler error regarding the Forms unit cannot be found. What am I missing?

Thank you.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2515
    • havefunsoft.com
Re: LCL without Lazarus
« Reply #1 on: May 03, 2020, 07:32:25 pm »
I'd think you also need to add this path to your -Fu options
Code: [Select]
/usr/lib/lazarus/1.8.2/units/x86_64-linux
LCL comes in two parts:
cross-platform part (which Forms unit in your case)
and platform part (aka widgetset) which you're already looking at by specifying "gtk2"

What IDE are you using?

(it might be the biggest downside of not using Lazarus is you might be missing the visual editor. But... it might not be a big deal)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

m.abudrais

  • Jr. Member
  • **
  • Posts: 51
Re: LCL without Lazarus
« Reply #2 on: May 03, 2020, 07:50:08 pm »
you need to add  many units path to compile lcl app.
you can see the argument which lazrus send to fpc and modify it. open lazarus and create LCL app, then
from the menu project->project option press show option.
this is mine
Code: Pascal  [Select][+][-]
  1. C:\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.exe
  2. -MObjFPC
  3. -Scghi
  4. -O1
  5. -g
  6. -gl
  7. -WG
  8. -l
  9. -vewnhibq
  10. -FiC:\Users\moh\AppData\Local\Temp\lib\x86_64-win64
  11. -FuC:\lazarus\lcl\units\x86_64-win64\win32
  12. -FuC:\lazarus\lcl\units\x86_64-win64
  13. -FuC:\lazarus\components\lazutils\lib\x86_64-win64
  14. -FuC:\lazarus\packager\units\x86_64-win64
  15. -Fu.
  16. -FUC:\Users\moh\AppData\Local\Temp\lib\x86_64-win64\
  17. -FEC:\Users\moh\AppData\Local\Temp\
  18. -oC:\Users\moh\AppData\Local\Temp\project1.exe
  19. -dLCL
  20. -dLCLwin32
  21.  

OneHitWonder

  • Newbie
  • Posts: 3
Re: LCL without Lazarus
« Reply #3 on: May 03, 2020, 09:00:59 pm »
What IDE are you using?

(it might be the biggest downside of not using Lazarus is you might be missing the visual editor. But... it might not be a big deal)

I am currently using VIM but I will be using Lazarus once I understand a little more how things work.

you need to add  many units path to compile lcl app.
you can see the argument which lazrus send to fpc and modify it. open lazarus and create LCL app, then
from the menu project->project option press show option.
this is mine
Code: Pascal  [Select][+][-]
  1. C:\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.exe
  2. -MObjFPC
  3. -Scghi
  4. -O1
  5. -g
  6. -gl
  7. -WG
  8. -l
  9. -vewnhibq
  10. -FiC:\Users\moh\AppData\Local\Temp\lib\x86_64-win64
  11. -FuC:\lazarus\lcl\units\x86_64-win64\win32
  12. -FuC:\lazarus\lcl\units\x86_64-win64
  13. -FuC:\lazarus\components\lazutils\lib\x86_64-win64
  14. -FuC:\lazarus\packager\units\x86_64-win64
  15. -Fu.
  16. -FUC:\Users\moh\AppData\Local\Temp\lib\x86_64-win64\
  17. -FEC:\Users\moh\AppData\Local\Temp\
  18. -oC:\Users\moh\AppData\Local\Temp\project1.exe
  19. -dLCL
  20. -dLCLwin32
  21.  

Thank you, this was a good place to start, I managed to narrow it down to the following:
Code: Pascal  [Select][+][-]
  1. fpc -MObjFPC -Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/gtk2 -Fu/usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux -Fu/usr/lib/lazarus/1.8.2/components/lazutils/lib/x86_64-linux test.pas

OneHitWonder

  • Newbie
  • Posts: 3
Re: LCL without Lazarus
« Reply #4 on: May 03, 2020, 10:23:02 pm »
So it compiles just fine now but I am having some issues linking. Anyone got any ideas how to resolve these?

Code: Pascal  [Select][+][-]
  1. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsimglist.o: In function `REGISTERCUSTOMIMAGELIST':
  2. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsimglist.pp:262: undefined reference to `WSRegisterCustomImageList'
  3. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsmenus.o: In function `REGISTERMENUITEM':
  4. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsmenus.pp:221: undefined reference to `WSRegisterMenuItem'
  5. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsmenus.o: In function `REGISTERMENU':
  6. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsmenus.pp:232: undefined reference to `WSRegisterMenu'
  7. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsmenus.o: In function `REGISTERMAINMENU':
  8. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsmenus.pp:243: undefined reference to `WSRegisterMainMenu'
  9. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsmenus.o: In function `REGISTERPOPUPMENU':
  10. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsmenus.pp:254: undefined reference to `WSRegisterPopupMenu'
  11. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERDRAGIMAGELIST':
  12. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:442: undefined reference to `WSRegisterDragImageList'
  13. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERLAZACCESSIBLEOBJECT':
  14. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:452: undefined reference to `WSRegisterLazAccessibleObject'
  15. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERCONTROL':
  16. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:462: undefined reference to `WSRegisterControl'
  17. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERWINCONTROL':
  18. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:472: undefined reference to `WSRegisterWinControl'
  19. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERGRAPHICCONTROL':
  20. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:482: undefined reference to `WSRegisterGraphicControl'
  21. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wscontrols.o: In function `REGISTERCUSTOMCONTROL':
  22. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wscontrols.pp:493: undefined reference to `WSRegisterCustomControl'
  23. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsforms.o: In function `REGISTERSCROLLINGWINCONTROL':
  24. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsforms.pp:264: undefined reference to `WSRegisterScrollingWinControl'
  25. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsforms.o: In function `REGISTERSCROLLBOX':
  26. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsforms.pp:275: undefined reference to `WSRegisterScrollBox'
  27. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsforms.o: In function `REGISTERCUSTOMFRAME':
  28. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsforms.pp:286: undefined reference to `WSRegisterCustomFrame'
  29. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsforms.o: In function `REGISTERCUSTOMFORM':
  30. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsforms.pp:297: undefined reference to `WSRegisterCustomForm'
  31. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsforms.o: In function `REGISTERHINTWINDOW':
  32. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsforms.pp:308: undefined reference to `WSRegisterHintWindow'
  33. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMSCROLLBAR':
  34. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:734: undefined reference to `WSRegisterCustomScrollBar'
  35. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMGROUPBOX':
  36. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:745: undefined reference to `WSRegisterCustomGroupBox'
  37. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMCOMBOBOX':
  38. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:756: undefined reference to `WSRegisterCustomComboBox'
  39. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMLISTBOX':
  40. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:767: undefined reference to `WSRegisterCustomListBox'
  41. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMEDIT':
  42. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:778: undefined reference to `WSRegisterCustomEdit'
  43. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMMEMO':
  44. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:789: undefined reference to `WSRegisterCustomMemo'
  45. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERBUTTONCONTROL':
  46. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:805: undefined reference to `WSRegisterButtonControl'
  47. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMBUTTON':
  48. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:819: undefined reference to `WSRegisterCustomButton'
  49. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMCHECKBOX':
  50. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:830: undefined reference to `WSRegisterCustomCheckBox'
  51. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERTOGGLEBOX':
  52. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:843: undefined reference to `WSRegisterToggleBox'
  53. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERRADIOBUTTON':
  54. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:854: undefined reference to `WSRegisterRadioButton'
  55. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMSTATICTEXT':
  56. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:867: undefined reference to `WSRegisterCustomStaticText'
  57. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsstdctrls.o: In function `REGISTERCUSTOMLABEL':
  58. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsstdctrls.pp:878: undefined reference to `WSRegisterCustomLabel'
  59. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsbuttons.o: In function `REGISTERCUSTOMBITBTN':
  60. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsbuttons.pp:107: undefined reference to `WSRegisterCustomBitBtn'
  61. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsbuttons.o: In function `REGISTERCUSTOMSPEEDBUTTON':
  62. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsbuttons.pp:119: undefined reference to `WSRegisterCustomSpeedButton'
  63. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERSHAPE':
  64. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:232: undefined reference to `WSRegisterShape'
  65. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMSPLITTER':
  66. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:243: undefined reference to `WSRegisterCustomSplitter'
  67. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERPAINTBOX':
  68. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:254: undefined reference to `WSRegisterPaintBox'
  69. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMIMAGE':
  70. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:265: undefined reference to `WSRegisterCustomImage'
  71. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERBEVEL':
  72. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:276: undefined reference to `WSRegisterBevel'
  73. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMRADIOGROUP':
  74. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:287: undefined reference to `WSRegisterCustomRadioGroup'
  75. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMCHECKGROUP':
  76. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:298: undefined reference to `WSRegisterCustomCheckGroup'
  77. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMLABELEDEDIT':
  78. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:309: undefined reference to `WSRegisterCustomLabeledEdit'
  79. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMPANEL':
  80. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:320: undefined reference to `WSRegisterCustomPanel'
  81. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsextctrls.o: In function `REGISTERCUSTOMTRAYICON':
  82. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsextctrls.pp:337: undefined reference to `WSRegisterCustomTrayIcon'
  83. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERCOMMONDIALOG':
  84. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:141: undefined reference to `WSRegisterCommonDialog'
  85. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERFILEDIALOG':
  86. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:152: undefined reference to `WSRegisterFileDialog'
  87. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTEROPENDIALOG':
  88. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:163: undefined reference to `WSRegisterOpenDialog'
  89. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERSAVEDIALOG':
  90. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:174: undefined reference to `WSRegisterSaveDialog'
  91. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERSELECTDIRECTORYDIALOG':
  92. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:185: undefined reference to `WSRegisterSelectDirectoryDialog'
  93. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERCOLORDIALOG':
  94. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:196: undefined reference to `WSRegisterColorDialog'
  95. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERCOLORBUTTON':
  96. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:207: undefined reference to `WSRegisterColorButton'
  97. /usr/lib/lazarus/1.8.2/lcl/units/x86_64-linux/wsdialogs.o: In function `REGISTERFONTDIALOG':
  98. /build/lazarus-Sur0jK/lazarus-1.8.2+dfsg/lcl//widgetset/wsdialogs.pp:218: undefined reference to `WSRegisterFontDialog'
  99.  

Thanks

m.abudrais

  • Jr. Member
  • **
  • Posts: 51
Re: LCL without Lazarus
« Reply #5 on: May 03, 2020, 11:56:46 pm »
i don't know  your problem, but this command worked for
in virtual box ubuntu 17 lazarus 1.6.4(very old  :)) and fpc 3.02.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2515
    • havefunsoft.com
Re: LCL without Lazarus
« Reply #6 on: May 04, 2020, 12:35:17 am »
So it compiles just fine now but I am having some issues linking. Anyone got any ideas how to resolve these?
make sure you're using "Interfaces" unit at least once in your program.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

 

TinyPortal © 2005-2018