Bookstore

Recent

Author Topic: Linux SVN Install: Access Violation when placing BGRAControls on form  (Read 408 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 585
  • Tweaking4All.com
    • Tweaking4All

I've been trying to install FPC and Lazarus from trunk on Clear Linux (virtual machine). For this I've started with a clean machine, and followed the steps below, resulting a working Lazarus/FPC (3.3.1).
Note: same issue arises when trying this on Mint Linux 19.3.


After that I'm trying to install BGRAControls (tried it through the online package manager and I've tried it manually (by placing the BGRA directories in ~/lazarus/components/ and opening, compiling and installing the LPK's). The IDE gets build just fine, zero (visible) errors, and BGRABitmaps, and BGRAControls, both compile just fine as well.


After that, no matter what I try, when placing a BGRAControl on the main form, I get an access violation. The control however displays correctly on the form (so the control "works" ?).


The appropriate unit however is not added to the "uses" clause, and when trying to run the application I get the error message that the appropriate unit for the BGRAControl cannot be found. When trying to add the unit manually, it will not list in the autocomplete either. All this makes me believe that the path to the BGRAControls cannot be found, but I have no idea where to look for this.


I've checked the paths under "Tools" - "Options", I've checked the project paths, and I've checked the "Package" - "Package Links" (no errors there either). Manually adding the paths to the controls (obviously) didn't fix it either.


I've done several installs, as a regular user, as sudo, etc etc (the beauty of a VM where you can o back to the "clean" install). Nothing seems to work.


On that note: other installed packages work just fine (incl. the online package manager).
I'm not a Linux expert, so any help would be greatly appreciated.




Steps to install Lazarus on Clear Linux from trunk

Installed extra libs/bundles:
- desktop-dev,
- package-utils,
- wget

Bundled in desktop-dev are the "usual" libraries like cairo, pango, pixbuf, atk, lib-imageformat, libx11, subversion, etc. Manually trying to install these libs confirmed that. Package-utils is needed to get "rpm".
I hope I've got all of them.


Under Linux Mint, where this happens as well, I've installed:
- libx11-dev

- libgtk2.0-dev
- libgdk-pixbuf2.0-dev
- libcairo2-dev
- libpango1.0-dev
- libgl1-mesa-dev


Install FPC and Lazarus Pascal:

Code: Bash  [Select]
  1. cd ~
  2.  
  3.  
  4. wget https://netcologne.dl.sourceforge.net/project/freepascal/Linux/3.0.4/fpc-3.0.4-1.x86_64.rpm
  5. sudo rpm -i --nodeps fpc-3.0.4-1.x86_64.rpm
  6. svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc
  7.  
  8.  
  9. cd fpc
  10. make all OPT='-gl'
  11.  
  12.  
  13. sudo make install PP=compiler/ppcx64 PREFIX=/usr
  14. sudo rm /usr/bin/ppcx64
  15. sudo ln -s /usr/lib/fpc/3.3.1/ppcx64 /usr/bin/ppcx64
  16.  
  17.  
  18. sudo make install sourceinstall PREFIX=/usr
  19. sudo ln -sf /usr/share/src/fpc-3.3.1/fpc /usr/share/fpcsrc
  20. /usr/lib/fpc/3.3.1/samplecfg /usr/lib/fpc/3.3.1 /etc
  21.  
  22.  
  23. cd ..
  24. svn checkout http://svn.freepascal.org/svn/lazarus/trunk/ lazarus
  25. cd lazarus
  26.  
  27.  
  28. make clean all
  29. sudo make install


Since /etc/ld.so.conf didn't exist, I've created this file (after a lot of testing without this file) and gave it the content "/usr/lib64" which is where the libs are.

lainz

  • Hero Member
  • *****
  • Posts: 3507
    • Lainz
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #1 on: February 22, 2020, 02:07:31 am »
That's strange since were using it on Linux on several apps and it works fine, the first example that comes to mind is LazPaint.
But I usually cross compile from windows to linux.

winni

  • Hero Member
  • *****
  • Posts: 1120
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #2 on: February 22, 2020, 02:44:11 am »

Since /etc/ld.so.conf didn't exist, I've created this file (after a lot of testing without this file) and gave it the content "/usr/lib64" which is where the libs are.

Hi!

/usr/lib and /usr/lib64 and also /lib64 should be used by default and it should not be necessary to mention them  in the /etc/ld.so.conf  .

Look at the comment in my version (Suse Tumbleweed):

Code: Text  [Select]
  1. /usr/local/lib64
  2. /usr/local/lib
  3. include /etc/ld.so.conf.d/*.conf
  4. # /lib64, /lib, /usr/lib64 and /usr/lib gets added
  5. # automatically by ldconfig after parsing this file.
  6. # So, they do not need to be listed.
  7.  

Strange

Winni

Hansaplast

  • Hero Member
  • *****
  • Posts: 585
  • Tweaking4All.com
    • Tweaking4All
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #3 on: February 22, 2020, 11:25:53 am »
Thanks for the replies ...  :D

@Lainz:
I've used BGRAControls in several Linux applications as well, without issue, and I'm very happy with the controls.  :D
However, this is the first time I'm compiling them under Linux with FPC 3.3.1 (trunk).


I switched to FPC 3.3.1 since I started having some compatibility issues when moving my code back and forth between macOS (where I use FPC 3.3.1) and Linux/Windows. Under macOS and Windows, I did not encounter the problem I'm running into right now.


The reason why I switched to a clean machine, is that setups under Linux tend to get messy over time. I'm aware this is a user problem haha ... but as a non-seasoned Linux user, I do tend to forget the little intricacies. I did pick Clear Linux (I used to use Mint Linux), just to try another Linux distro. But both Clear Linux and Mint Linux produce the exact same error (when following the steps in my initial post).


My initial thought was some sorts of incompatibility between the GTK2 widgetset and FPC 3.3.1 since on my messed up VM Lazarus would crash when loading any project with BGRAControls on the form.
Right now however, on a clean machine, having done just the steps listed above, the BGRAControls units are not even found, even when I try to manually add one of these units (autocomplete) - which to something being wrong with the path configuration.


On that note: when placing the control on the form, I get an Access Violation message instantly. But strangely enough, the control shows correctly on the form, and I can even move and resize them. Object Inspector however, does NOT list the control or show it's properties/events.
Compiling the application works as well, without error message, but when trying to run the compiled application I get the fatal error (Class "TBCButton" not found).


@Winni:
I'm not a Linux expert so please bear with me.
I've noticed that under Mint Linux /etc/ld.so.conf and /etc/ld.so.conf.d do exist.
Under Clear Linux however they do not exist.
I've created the file and added your suggested path to it (after verifying they actually exist).
Rebuild Lazarus completely, but still getting the same error.


On that note, the use of "sudo" (installing FPC and Lazarus) can be quite confusing at times as well (lack of knowledge on my end).
Would it be possible to run Lazarus completely in user space?


Also: when starting the IDE from a shell, I do not get any useful info, even when building the DEBUG-IDE.


After several days, I am getting a little frustrated with this and searching for an answer online didn't get me any further either.

Hansaplast

  • Hero Member
  • *****
  • Posts: 585
  • Tweaking4All.com
    • Tweaking4All
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #4 on: February 22, 2020, 11:31:46 am »
Just an update:
I've tried installing other 3rd party components (SQLite3/LazSQL/TaChart).
All of these compile and work as they should.
Now I'm sure BGRAControls uses a more advanced graphics, are you guys aware of any control I should test with?

Hansaplast

  • Hero Member
  • *****
  • Posts: 585
  • Tweaking4All.com
    • Tweaking4All
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #5 on: February 24, 2020, 01:50:13 pm »


Just started all over again, this time with Lazarus 2.1.0 r62665 FPC 3.3.1 x86_64-linux-gtk2 - FPC 3.3.1 SVN 44241.
My previous test was with Lazarus 62652 and FPC 44221.


Here I noticed something weird.
I do not get the Access Violation message anymore, instead the "Messages" window shows a "Fatal: Can't find unit" message.
Right clicking the message and selecting "Search Unit" now allows me to "Add package bgracontrols as requirement to project".
After doing that, this particular project runs and complies just fine.
Naturally, for every following project I'll have to do the same thing.


So I'm wondering if (depending on FPC/Lazarus trunk version?) if the paths for packages works correctly or not?
Tested this with manual install of BGRAcontrols and install through OnlinePackageManager.
It works the same, as described above, for both.


Does anyone have any insight in this?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3734
  • I like bugs.
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #6 on: February 24, 2020, 02:05:11 pm »
I do not get the Access Violation message anymore, instead the "Messages" window shows a "Fatal: Can't find unit" message.
Right clicking the message and selecting "Search Unit" now allows me to "Add package bgracontrols as requirement to project".
After doing that, this particular project runs and complies just fine.
Naturally, for every following project I'll have to do the same thing.
Do you mean your projects didn't have BgraControls dependency although they used controls from it?

Quote
So I'm wondering if (depending on FPC/Lazarus trunk version?) if the paths for packages works correctly or not?
It has worked the same way for a long time. Nothing has changed there.
A dependent package "injects" its search path to the project. The IDE remembers the package's location after it has seen it once. No other path definitions are needed.
People coming from Delphi easily make a mistake and add the path of a package to a project's search path. It leads to a mess and often errors.

Hansaplast

  • Hero Member
  • *****
  • Posts: 585
  • Tweaking4All.com
    • Tweaking4All
Re: Linux SVN Install: Access Violation when placing BGRAControls on form
« Reply #7 on: February 24, 2020, 04:11:18 pm »
Do you mean your projects didn't have BgraControls dependency although they used controls from it?
Correct.
When I create a new application project, and drop a BGAControl on the new form:
- macOS/Windows: BGRAControl dependency will be added to the project (seeing it being added in Project Inspector)
- Linux: the dependency will not be added (I have to do this manually it seems).
I tried the same steps with tachart, and the tachart dependency is being added correctly.  :o

Quote
It has worked the same way for a long time. Nothing has changed there.
A dependent package "injects" its search path to the project. The IDE remembers the package's location after it has seen it once. No other path definitions are needed.
People coming from Delphi easily make a mistake and add the path of a package to a project's search path. It leads to a mess and often errors.
That's why I'm wondering if I goofed up somehow or not.
This is the first time with Lazarus that I run into this issue.


On that note;
When I have Lazarus try find the unit, it only seems to be looking in /usr/local/share/lazarus/ (the IDE SVN files are in ~/lazarus/).
I build FPC and Lazarus in ~/fpc and ~/lazarus, and install them with "sudo make install" after that.
Next I start Lazarus from the applications menu of any of these Linux Distros (so I'm not starting it in ~/lazarus).
When I look at the shortcut of Lazarus, then I see that it starts "/usr/local/bin/startlazarus" with a blank working directory.
The OnlinePackageManager seems to store everything in ~/.lazarus/onlinepackagemanager/, and the .o files seem to be stored there as well.
Note: doing a manual install by copying the BGRAControl files in ~/lazarus/components gives the same results, so I don't think it is a OnlinePackageManager issue.