wxPdfDocument how to select wich version of GTK to use

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Dec 09, 2016 7:28 am
Contact:

wxPdfDocument how to select wich version of GTK to use

Post by cutecode » Sun Jun 14, 2020 10:37 am

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
wx 3.1.4 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

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

Post by DavidHart » Sun Jun 14, 2020 11:38 am

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

User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Dec 09, 2016 7:28 am
Contact:

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

Post by cutecode » Sun Jun 14, 2020 12:48 pm

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
wx 3.1.4 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

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

Post by DavidHart » Sun Jun 14, 2020 1:30 pm

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

User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Dec 09, 2016 7:28 am
Contact:

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

Post by cutecode » Sun Jun 14, 2020 2:24 pm

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
wx 3.1.4 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru

Post Reply