Recent

Author Topic: GTK2Int of package LCL does not find xlib.  (Read 1107 times)

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
GTK2Int of package LCL does not find xlib.
« on: August 20, 2023, 03:33:33 pm »
Newcomer here to Lazarus. Installed 3.0RC1 with fpc 3.2.2
Just to test the installation, I wrote a very simple application with a just a button and a text field, nothing more.
Trying to build it, I am greeted with this error message :

gtk2int.pas(37,6) Fatal: Cannot find xlib used by Gtk2Int of package LCL.

As said, I am a newcomer to Lazarus, so I am in search of help...Thanks

Fred

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #1 on: August 20, 2023, 03:40:17 pm »
To complete the info above, the computer is the RADXA Rock 5A board, with the ARM RK3588s CPU, and the os is the Debian 11 customized for this board.

TRon

  • Hero Member
  • *****
  • Posts: 2189
Re: GTK2Int of package LCL does not find xlib.
« Reply #2 on: August 20, 2023, 03:40:25 pm »
Newcomer here to Lazarus. Installed 3.0RC1 with fpc 3.2.2
Hello and welcome. Also a newcomer at Linux ?

Dependencies for deployment (also means for development as minimum). Depending on our Linux distribution and if you distribution support it : install the "-dev" packages.

For packages required for building lazarus, see https://wiki.lazarus.freepascal.org/Installing_Lazarus_on_Linux#Required_Linux_packages
« Last Edit: August 20, 2023, 03:42:31 pm by TRon »

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #3 on: August 20, 2023, 03:42:47 pm »
Yes, newcomer also to Linux... could you please elaborate a bit more about the -dev packages to be installed ? Thanks

Fred

TRon

  • Hero Member
  • *****
  • Posts: 2189
Re: GTK2Int of package LCL does not find xlib.
« Reply #4 on: August 20, 2023, 03:56:26 pm »
Yes, newcomer also to Linux... could you please elaborate a bit more about the -dev packages to be installed ? Thanks
Sure. I see you mentioned running debian so that is -dev territory  :)

I usually use apt to install software. So whenever you see something like a dependency named "libpango-1.0-0" then you can do "apt search libpango.*" from a terminal window. for me that displays:
Code: [Select]
Sorting... Done
Full Text Search... Done
libpango1.0-dev/stable,now 1.50.12+ds-1 amd64 [installed]
  Development files for the Pango

libpangomm-1.4-dev/stable 2.46.3-1 amd64
  C++ Wrapper for pango (development files)

libpangomm-2.48-dev/stable 2.50.1-2 amd64
  C++ Wrapper for pango (development files)

Which tells me that the dev package is already installed. Would none of the libpango files be installed then you can issue a "apt-get install libpango1.0-dev" and it will install the correct library + dev package for you. if it is only missing the -dev package then it will install only the dev package.

for answering in more detail about what -dev packages are there are people that do a better job, see for exampe https://stackoverflow.com/questions/1157192/what-do-the-dev-packages-in-the-linux-package-repositories-actually-contain

The development files (headers) itself are not interesting for us but the dev package also takes care for making sure that the correct version of the library is linked in your programs (when you compile them). Otherwise you would have to do that manually.

So either your libx is not installed at all (is a bit problematic if you are seeing a desktop in front of you (unless not using x)  :D ) or it is missing the -dev package and tries to find a specific version for libx and is unable to link it in (which is probably the cause for the error you are receiving).

Hopefully that is enough to get you started, if not he case then please let us know.

PS: as per example you can also use "apt list libpango\*" in a terminal to list all file starting with libpango, which includes all the different version numbers and other libpango named files (including their dev variant). It is preferable over "apt search libpango" as f.e. that will also list bindings for other languages which we usually do not care about.
« Last Edit: August 20, 2023, 04:21:34 pm by TRon »

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #5 on: August 20, 2023, 04:19:40 pm »
Thanks TRon, now I am more confused than before... I understand that the Linux way is not for the faint of hearth...
Frankly don't know which package(s) I have to install to make that error go away...
And the fact that this processor is an ARM and not an AMD or Intel does not make things easy...

Issuing the command  apt search xlib I get four or five pages of output, not much useful...

Fred
« Last Edit: August 20, 2023, 04:23:17 pm by ermeneuta »

TRon

  • Hero Member
  • *****
  • Posts: 2189
Re: GTK2Int of package LCL does not find xlib.
« Reply #6 on: August 20, 2023, 04:35:12 pm »
xlib (actually libx) is a bit of a tricky one (it doesn't really adheres to what I just wrote).

Code: [Select]
apt-get install libx11-dev

should be able to do the trick for you.

Note that for linux it doesn't really matter if you are running on arm, powerpc or intel/amd. Most found instructions can be copied 1:1 unless it is specific for your hardware (kernel/driver firmware for example).

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #7 on: August 20, 2023, 05:03:45 pm »
Thanks again TRon. Unfortunately that command did not help....
I get this :

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libx11-dev is already the newest version (2:1.7.2-1+deb11u1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

 :(

Fred

TRon

  • Hero Member
  • *****
  • Posts: 2189
Re: GTK2Int of package LCL does not find xlib.
« Reply #8 on: August 20, 2023, 05:12:55 pm »
ahem..  :-[

My apologies.

Must have been drinking thee with some drug in them. It is the unit that it can't find, not the library (as per my previous responses).

are you sure you configured Lazarus correctly when you started it for the first time  ? e.g. was it able to locate the fpc executable ? How did you install fpc and what distribution file did you use to install (or did you use PFCUpDeluxe or another tool to install it) ?

Free Pascal not being able to locate its packages usually means that the fpc.cfg file is not setup correctly.
« Last Edit: August 20, 2023, 05:16:13 pm by TRon »

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #9 on: August 20, 2023, 06:58:37 pm »
I installed both fpc and lazarus by compiling from the sources obtained from gitlab.
When the lazarus IDE started for the first time it declared OK for all the four boxes that were shown, bar what written below...

Maybe I will use the find command to locate all the instances of fpc and lazarus files, then remove them with rm -r .....  and at this point restart the installation process.... why this ? Because as a matter of facts, gitlab made me install fpc 3.3.1, and lazarus compiled without problems with this, but when lazarus started it complained that it wanted the sources of fpc 3.2.2 and not 3.3.1....
So i downloaded fpc 3.2.2 and pointed lazarus to that directory for the fpc source...

All of this is way above my head, so probably this is the reason of the error...

Fred
 

TRon

  • Hero Member
  • *****
  • Posts: 2189
Re: GTK2Int of package LCL does not find xlib.
« Reply #10 on: August 20, 2023, 08:34:29 pm »
I installed both fpc and lazarus by compiling from the sources obtained from gitlab.
If you compiled the sources manually then for sure you have to setup your fpc.cfg file correctly. It is not created by default.

Quote
When the lazarus IDE started for the first time it declared OK for all the four boxes that were shown, bar what written below...
Reading further along you mentioned having multiple installations, so it could be Lazarus picked up on the wrong version of FPC (or the right one but using the fpc.cfg file from the other version).

Quote
Maybe I will use the find command to locate all the instances of fpc and lazarus files, then remove them with rm -r ..... 
It is not a problem to have multiple installations of both Free Pascal and Lazarus but it requires some careful setup. For instance I myself use a single fpc.cfg file for all my installations of Free Pascal but tha means that the fpc.cfg file can not contain any hardcoded paths (and by default the fpmkcfg tool to create a standard fpc.cfg file with options that use hard-coded paths).


Quote
Because as a matter of facts, gitlab made me install fpc 3.3.1, and lazarus compiled without problems with this, but when lazarus started it complained that it wanted the sources of fpc 3.2.2 and not 3.3.1....
I have no idea what mght have gone wrong there, but for sure there is something off there.

Quote
All of this is way above my head, so probably this is the reason of the error...
If you are new to both Linux and Free Pascal then things can be a bit overwhelming but it is actually quite simple as long as you have control over things (that is why i personally do not use the package manager or any other tool/installer to install free pascal and/or lazarus for me as in such cases I have lost the control and are depending on what the tool/installer/package manager does). One thing is for sure and that is that using .deb files and the package manager will not allow you to properly install multiple versions as those tools do not have proficiency for such a concept.

The usualt ting to do is to make sure that you Free Pascal is installed and working correctly. You can test that by making sure that when you open up a terminal that you can execute the fpc executable and compile a (example) program with it (using unit classes , with mode objfpc). You can use "fpc -va example.pas" to see what configuration file it loaded and what paths it tried to locate that fpc.cfg file). the output will also show you how it processed the fpc.cfg file options and how it interpreted it.

A fpc.cfg file is nothing more then a list of options that can also be provided on the comandline, see https://www.freepascal.org/docs-html/user/usersu10.htmlhttps://wiki.freepascal.org/Configuration_filehttps://www.freepascal.org/docs-html/user/userap1.html and https://wiki.freepascal.org/Installation_Troubleshooting

Other than that, it is not possible to literally guide you unless posting some results and/or showing what you did exactly to compile/install. Currently there is no idea of where you have currently installed things on your system.

tetrastes

  • Sr. Member
  • ****
  • Posts: 454
Re: GTK2Int of package LCL does not find xlib.
« Reply #11 on: August 20, 2023, 11:26:15 pm »
gtk2int.pas(37,6) Fatal: Cannot find xlib used by Gtk2Int of package LCL.

xlib.pp is fpc unit, located at /your_fpc_source/packages/x11/src/
But fpc tries to find precompiled unit xlib.ppu first. For this it has to know paths to units. Usually they are defined in ~/.fpc.cfg (fpc looks for this first) or /etc/fpc.cfg, smth like
 
-Fu/fpc_dir/$fpcversion/units/$fpctarget
-Fu/fpc_dir/$fpcversion/units/$fpctarget/*
-Fu/fpc_dir/$fpcversion/units/$fpctarget/rtl

fpc version must be the same as in Lazarus "IDE Options->Files->Compiler executable" (and with which LCL and Lazarus are compiled), otherwise you will get this error.
And  "IDE Options->Files->FPC source directory" must be for the same version also.

P.S. You can find which fpc config file is used by "Lazarus menu->View->IDE Internals->About FPC".
« Last Edit: August 20, 2023, 11:45:49 pm by tetrastes »

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #12 on: August 21, 2023, 03:59:49 pm »
Thanks indeed TRon for your time spent to aid me, and to tretrastes for the last hints.
Trying to modify .fpc.cfg seems something that would need a skill level greater than mine...
IMHO my best option is to clean everything related to fpc and lazarus, every remnants, and start again from scratch, this time paying more attention to not install multiple versions of fpc.

A last question to the experts... is lazarus 3.0RC1 compatible with fpc 3.3.1, or is it mandatory fpc 3.2.2 ?

Thanks
Fred

tetrastes

  • Sr. Member
  • ****
  • Posts: 454
Re: GTK2Int of package LCL does not find xlib.
« Reply #13 on: August 21, 2023, 05:07:38 pm »
Though I'm not an expert at all...
It's not mandatory, but recommended. Official Lazarus releases and candidates are built with fpc last stable.
Trunk is for developers and testers of fpc, and for those who needs new features lack in stable.

ermeneuta

  • Jr. Member
  • **
  • Posts: 63
Re: GTK2Int of package LCL does not find xlib.
« Reply #14 on: August 21, 2023, 06:22:20 pm »
Thanks. I didn't know that fpc 3.3.1 were a trunk...

Fred

 

TinyPortal © 2005-2018