Recent

Author Topic: migrating from GTK2 to GTK3  (Read 377 times)

mm7

  • Full Member
  • ***
  • Posts: 183
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
migrating from GTK2 to GTK3
« on: May 30, 2020, 06:50:02 pm »
Program was built on GTK2
I've set link target to GTK3
Compiled, linked successfully.

when run it fails with error:
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

nm also shows tons of GTK2 symbols

How to find and migrate them?


dsiders

  • Sr. Member
  • ****
  • Posts: 307
Re: migrating from GTK2 to GTK3
« Reply #1 on: May 30, 2020, 07:41:26 pm »
Program was built on GTK2
I've set link target to GTK3
Compiled, linked successfully.

when run it fails with error:
GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

nm also shows tons of GTK2 symbols

How to find and migrate them?

You said "Compile"... did you try "Build" or "Cleanup and Build" to force all units to be compiled?
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

lucamar

  • Hero Member
  • *****
  • Posts: 2921
Re: migrating from GTK2 to GTK3
« Reply #2 on: May 30, 2020, 09:14:21 pm »
Note also that the whole dependency tree must be built for GTK3 (LCL, etc.); otherwise you might end up with a GTK3 application using (trying to use) GTK2 controls.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 7218
Re: migrating from GTK2 to GTK3
« Reply #3 on: May 30, 2020, 11:57:07 pm »
For compiling an application to a different widgetset on Linux I go to "Project Options" > "Additions and Overrides". Then, depending on whether I want to store the widgeset used in the project or session file (lpi vs lps) I click in line "Stored in project (.lpi)" or "Stored in session of project (.lps)", click "Set LCL WidgetType" and check the widgettypes that I want to support. Of course, the dependent libraries must have been set up for each widgetset.

This can be combined with Build Modes to make switching from WS to WS very easy.

The first compilation run after changing WS will take longer because all used units must be rebuilt for the new WS.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

mm7

  • Full Member
  • ***
  • Posts: 183
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: migrating from GTK2 to GTK3
« Reply #4 on: May 31, 2020, 03:55:53 pm »
I've done all of this. Done "Cleanup and Build". Same story. Binary includes GTK2.
New Application in built for GTK3 works well.

I will postpone to migrate. Not all features implemented yet. I.e. TShellListView ViewStype is only vsReport.
And it does not show file icons.
« Last Edit: June 01, 2020, 06:27:05 am by mm7 »

 

TinyPortal © 2005-2018