Page 1 of 1

wxPdfDocument how to select wich version of GTK to use

Posted: Sun Jun 14, 2020 10:37 am
by cutecode
I have installed wxWidgets with GTK2 and GTk3 on the same OS.
wxPdfDocument automatticaly compiles with GTK3.

How to make it to comple with GTK2?

Thank you

Re: wxPdfDocument how to select wich version of GTK to use

Posted: Sun Jun 14, 2020 11:38 am
by DavidHart
Hi,

I don't know anything about wxPdfDocument (and you don't give any details about how you are building it) but I suspect that your issue is an example of the standard 'which wx version to use?' question.

When building any program against wx on Linux, its makefile (or similar) will probably use the first wx-config script it finds. If you don't do anything special, that will be the first found in your $PATH; and that will be the one selected in update-alternatives.

So, look at the output of doing, as root:
update-alternatives --config wx-config
If the default is not what you want, you can change it there.

Alternatively (and perhaps more relevant to your situation) if you wish to use a different wx build, especially one that isn't installed, just point to its wx-config in your makefile; or in your IDE compilation and linking settings; or prepend its filepath to your build-terminal's $PATH
e.g. PATH=/full/path/to/preferred/wx-config:$PATH

Regards,

David

Re: wxPdfDocument how to select wich version of GTK to use

Posted: Sun Jun 14, 2020 12:48 pm
by cutecode
Hello!

I build it with ./configure

Code: Select all

  mkdir build-gtk [or any other suitable name]
  cd build-gtk
  ../configure [here you should use the same flags you used to configure wxWidgets]
  make
if I run

Code: Select all

sudo update-alternatives --config wx-config
I got error

Code: Select all

no altenatives for wx-config
if I run

Code: Select all

wx-config --list
I got

Code: Select all

   Default config is gtk3-unicode-3.1

  Default config will be used for output

  Alternate matches:
    gtk2-unicode-3.1

Re: wxPdfDocument how to select wich version of GTK to use

Posted: Sun Jun 14, 2020 1:30 pm
by DavidHart
Default config is gtk3-unicode-3.1
So that's why the gtk3 build is being used.

How did you configure/install your 2 wx builds? Did you:
../configure --with-gtk=<whichever> && make && sudo make install
or (the way I much prefer):
../configure --with-gtk=<whichever> --prefix=$(pwd) && make

The first way would install to /usr/local/. The second way would not install it anywhere; instead it can be used where it is.

Either way, before you configure wxPdfDocument, you need to point the terminal's $PATH at the /full/path/to/gtk2-build:
PATH=/full/path/to/my/wxgtk2-build-dir/wx-config:$PATH

Re: wxPdfDocument how to select wich version of GTK to use

Posted: Sun Jun 14, 2020 2:24 pm
by cutecode
Tank you

I used wx builds without prefixes

Code: Select all

../configure --enable-shared --enable-unicode --with-gtk=2
I found wxPdfDocument configure switches

Code: Select all

  --with-wxdir=PATH       Use uninstalled version of wxWidgets in PATH
  --with-wx-config=CONFIG wx-config script to use (optional)
  --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)
I'll try to build wx the other way