Page 1 of 1

Can someone clairify the subsystem option for Linux [Solved]

Posted: Sat Jul 04, 2020 6:25 am
by Jimbob81
Hello, I've got some questions at the bottom of the post but first here is the back story...

I'm running PB 5.62 (x86) on Debian 9 and have all sorts of issues running example code from this forum Eg. Example code that is a work around to fix the EditorGadget() NOT scrolling to the bottom line. viewtopic.php?f=15&t=27913&hilit=subsystem+gtk3

The first code example compiles but doesn't go to the last line as expected when the subsystem compiler option is empty. While it gives me an error "Gtk (ERROR): GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported" when forcing gtk2 as the subsystem

The second code example works perfect with nothing in the subsystem compiler option but gives me an error "Gtk (ERROR): GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported" when I force gtk2 as the subsystem - And I understand this as I can see there are GTK3 statements used in that example.

So the above logic suggests that without anything in the subsystem compiler option, then I'm using GTK3...
If that's true then I'm confused by the built in help file which suggests OpenGL is the default...

Quoting the PB help file...
For example, on Windows there is the 'OpenGL' subsystem available, which will use OpenGL functions to render sprites, instead of DirectX (which is the default subsystem). It can be useful to use OpenGL instead of DirectX when writing a crossplatform game, as OS X and Linux use OpenGL as default. It also allows to use raw OpenGL commands directly on screen.
And then there's this post that gives the indication that gtk3 could/should be specified...
viewtopic.php?f=13&t=55054&hilit=subsystem+gtk3
Fred wrote:you need to specify "gtk3" in the subsystem field of the compiler options.
But I get an error message of "The following subsystem cannot be found: GTK3" or "The following subsystem cannot be found: gtk3"

This post indicates either gtk2 or gtk3 "may" exist depending on which PB version I'm running..
viewtopic.php?f=3&t=63845&hilit=subsystem+gtk3
But really it is only comparing what I write in the subsystem compiler option with a string of "gtk2", "gtk3" or "any other statement"

Examination of my PB subsystems folder shows that I have qt and gtk2

What I'm asking is:
1) What is the default subsystem for Linux and PB =>5.62 if I don't put anything in the compiler options box?
2) How can I use/force GTK3 examples to work?
3) Can GTK2 and GTK3 statement be used together?

Thanks for taking the time to view my post and yes I have tried to search for the correct answer on the forum already.
"Subsystem" 924 matches. "Linux subsystem" 247 matches. "Default Linux subsystem" 78 matches.
Cheers.

Re: Can someone clairify the subsystem option for Linux

Posted: Sat Jul 04, 2020 11:21 am
by Shardik
Jimbob81 wrote:1) What is the default subsystem for Linux and PB =>5.62 if I don't put anything in the compiler options box?
The default subsystem for PB 5.62 is Gtk3 when leaving "Library Subsystem:" empty (Menu: Compiler > Compiler Options... > Tab Compiler Options > Library Subsystem).
The default subsystem was changed from GTK2 to GTK3 in PB 5.40:
[color=#0040FF][u]PureBasic news for PureBasic 5.40 LTS[/u][/color] wrote:- Changed: The default GTK version is now GTK3 on Linux. A gtk2 subsystem has been added for backward compatibility.
Jimbob81 wrote:2) How can I use/force GTK3 examples to work?
You have to check if GTK2 functions are still usable in GTK3 or whether they meanwhile have been replaced in GTK3 by other functions. You should therefore take a look into the stable Gtk2 and GTK3 reference manuals if a posted example doesn't run with GTK3.
Jimbob81 wrote:3) Can GTK2 and GTK3 statement be used together?
GTK3 is a new version following GTK2. If a needed function is present in both GTK2 and GTK3 you will have no difficulties in using them with both subsystem GTK2 and GTK3. But if a function is specific to GTK2 or GTK3, you will have to code both variants inside CompilerIf constructs in order to be able to compile your sourcecode for both subsystems.

Re: Can someone clairify the subsystem option for Linux

Posted: Sat Jul 04, 2020 7:37 pm
by Jimbob81
Thank you @Shardik. Your reply was exactly the information I needed. Precise and to the point.

Re: Can someone clairify the subsystem option for Linux

Posted: Sat Jul 04, 2020 8:03 pm
by Jimbob81
Is OpenGL still a subsystem option with Linux and PB >= 5.62?

re. https://www.purebasic.com/news.php
PB 5.30
- Added: OpenGLGadget() with native opengl commands and constants support for Windows, OSX and Linux
PB 4.61
- Changed: OpenGL subsystem is now default on Linux (a new 'sdl' subsystem has appear)
I've tried OpenGL ,opengl and sdl as a subsystem compiler option to no avail.... Has support been dropped altogether or is now done with the OpenGLGadget command?

Re: Can someone clairify the subsystem option for Linux

Posted: Sat Jul 04, 2020 9:03 pm
by Shardik
Jimbob81 wrote:Is OpenGL still a subsystem option with Linux and PB >= 5.62?
I have taken a look into the subsystem folder of the PureBasic versions for Linux down to PB 3.94. The subsystem folder contains the supported subsystems in each version:

5.72: gtk2 + qt
5.62: gtk2
5.51: gtk2
5.46: gtk2
5.31: gtk3
5.24: gtk3
5.11: gtk1 + sdl
5.00: gtk1 + sdl
4.61: gtk1 + sdl
4.51: gtk1 + opengl
4.41: gtk1 + opengl
4.31: gtk1 + opengl
4.20: gtk1 + opengl
4.10: gtk1 + opengl
4.00: gtk1 + opengl
3.94: gtk2

Re: Can someone clairify the subsystem option for Linux

Posted: Sun Jul 05, 2020 8:44 am
by Jimbob81
@Shardik you have done well again.

I can confirm these subsystems for Linux - well at least for the downloads that I have.

5.72: gtk2 + qt
5.71: gtk2 + qt
5.70: gtk2 + qt
5.62: gtk2 + qt


** Topic marked as solved! **

Thank you