Author Topic: [SOLVED] wxWidgets 3.0.4 & 3.1.2  (Read 3325 times)

Offline dcbdbis

  • Multiple posting newcomer
  • *
  • Posts: 23
[SOLVED] wxWidgets 3.0.4 & 3.1.2
« on: July 30, 2019, 03:23:40 am »
A couple of questions if I may. I have run into some issues with wxWidgets where one of their developers is talking about 3.1.2. And in the chaneglog - I see my issue(s) have been addressed with 3.1.2

I am on Manjaro, current, CB 17:12. I know that the new wxWidgets will go into /usr/local/* instead of usr/lib....

BUT...

Will CodeBlocks support this?

Anyone done it?

Any gotcha's?

Any pointers to a "how to" other than the generic how to's already on both forums, which I have already read?

And most importantly - DO I have to start my existing projects all over from scratch?


Thanks!


Dave
« Last Edit: July 30, 2019, 04:27:20 pm by dcbdbis »

Offline blauzahn

  • Almost regular
  • **
  • Posts: 179
Re: wxWidgets 3.0.4 & 3.1.2
« Reply #1 on: July 30, 2019, 06:15:20 am »

Quote
[...] I know that the new wxWidgets will go into /usr/local/* instead of usr/lib....
not necessarily; you can use ./configure --prefix=/usr

Quote
Will CodeBlocks support this?
yes

Quote
Anyone done it?
yes for a long time, but I changed over to /usr a week ago due to the annoying LD_LIBRARY_PATH (see below). Not a problem for codeblocks but for some other progams in my case. I always use wxwidgets trunk; dare to "live at head" citing Titus Winter, head of google C++ library code base on his cppcon2017 talk.

Quote
Any gotcha's?
  • you should deinstall the current wxWidgets before installing your own
  • already installed packages may still depend on the wxwidgets provided by the distributor of your os. That's why I installed gnuplot and wxmaxima from source as well. Otherwise updating your os will remain annoying an error prone if you accidentially reinstall the original wxwidgets
  • having installed wxwidgets into /usr/local and depending on the configuration of your dynamic linker you may have to use LD_LIBRARY_PATH=/usr/local/lib which is a bit hacky and less easy to use when you want to start programs like codeblocks via desktop icons etc.
  • very rarely, an update breaks;

Quote
Any pointers to a "how to" other than the generic how to's already on both forums, which I have already read?

something like this Makefile?

Code
.PHONY: clone update prerequisites bootstrap config all install clean

uname := $(shell uname -a)
uname_arch := $(findstring arch, $(uname))
uname_ubuntu := $(findstring buntu, $(uname))
uname_FreeBSD := $(findstring FreeBSD, $(uname))
uname_pi := $(findstring armv, $(uname))

ifeq (buntu,$(uname_ubuntu))
distro := ubuntu
#package_manager := apt-get
#package_install := $(package_manager) install --assume-yes
os_release := $(shell lsb_release --release | sed -e 's/Release:[ \t]*//')
endif

ifeq (arch,$(uname_arch))
distro := arch
package_manager := pacman
package_install := $(package_manager) --sync --noconfirm
endif

ifeq (FreeBSD,$(uname_FreeBSD))
package_manager := pkg
package_install := $(package_manager) install --yes
CFLAGS :=-I/usr/local/include
endif

ifeq (armv,$(uname_pi))
distro := raspbian
package_manager := apt-get
package_install := $(package_manager) install --assume-yes
endif

ifneq (,$(filter $(distro), ubuntu raspbian))
package_manager := apt-get
package_install := $(package_manager) install --assume-yes
endif

ifeq (buntu,$(uname_ubuntu))
ifeq (16.04,$(os_release))
CC=gcc-6
CXX=g++-6
endif
endif

ifeq (raspbian,$(distro))
CC=gcc
CXX=g++
endif
# https://solarianprogrammer.com/2017/12/08/raspberry-pi-raspbian-install-gcc-compile-cpp-17-programs/


BUILD=build
TRUNK=trunk

all:
(cd $(BUILD) && $(MAKE))

clone:
git clone --recurse-submodule --jobs=5 \
  https://github.com/wxWidgets/wxWidgets.git $(TRUNK)

# wxwidgets transitioned all the third party libraries
# used by wxWidgets, such as libpng, libjpeg and so on, to use
# Git submodules instead of just subdirectories in the main repository.
# see: http://wxwidgets.blogspot.com/
# Sunday, November 12, 2017 "Surreptitious Submodule Switch"
## (cd $(TRUNK) && git submodule update --init)

update:
(cd $(TRUNK) && git pull --rebase)

prerequisites:
$(package_install) \
  bison \
  flex \

ifeq (buntu,$(uname_ubuntu))
$(package_install) \
  libgtk-3-dev \

ifeq (raspbian,$(distro))
$(package_install) \
  libgtk-3-dev \

endif

endif
ifeq (arch,$(uname_arch))
endif

bootstrap:

config:
-mkdir -p $(BUILD)
(cd $(BUILD) && ../$(TRUNK)/configure --prefix=/usr --with-cxx=14 )
# (cd $(BUILD) && ../$(TRUNK)/configure -with-gtk=3 --enable-cxx11 --with-cxx=11 --enable-stl )

# --enable-stl  triggers compile-problem in codeblocks
# see: http://forums.codeblocks.org/index.php/topic,21763.msg148002.html#msg148002

install:
(cd $(BUILD) && $(MAKE) install)
ldconfig

checkinstall:
checkinstall $(MAKE) install

clean:
-rm -rf $(BUILD)



I regularly use this primitive Makefile. Its blunt, I know but works on arch, ubuntu, raspbian and occasionally on FreeBSD as you can see in the file. As for install, please be aware that its recommended to make a package for your distribution and install that instead of a plain old make install.  That way you can safely deinstall it again. I do not know how to make a package for your os.

Quote
And most importantly - DO I have to start my existing projects all over from scratch?
It depends on the wxWidgets api stuff the projects use that has changed in syntax or semantics. Do your projects use the recommended wx-config instead of hard coded paths? Other than that I do not know. Do you have a spare computer or hard disk on which you can try this at arms length before you change it on your production system? Once you have scripted your installallation steps this becomes a lot easier to do and less scary.



Offline blauzahn

  • Almost regular
  • **
  • Posts: 179
Re: wxWidgets 3.0.4 & 3.1.2
« Reply #2 on: July 30, 2019, 06:18:46 am »
forgot to mention: with codeblocks I also use the current trunk -- the latest and greatest of course :)

Offline dcbdbis

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: wxWidgets 3.0.4 & 3.1.2
« Reply #3 on: July 30, 2019, 06:55:17 am »
Thank you so much for the reply....I do have 3 packages with dependencies on the current version of wxWidgets. There are enough issues with wxWidgets that I may have to give my two clients the option to go with QT as the toolkit - if they are willing to pay the licensing fee.

The apps are commercial apps - and the clients will have to buy the Qt license. Neither Manjaro nor Arch ships with wxWidgets 3.1.2. And there have been some fairly high-level projects in Linuxland that have switched to QT from wxWidgets because of toolkit issues.

One of these apps I have to port is for a defense contractor that I've been tasked with porting from C# and .NET technologies to a more cross-platform approach that doesn't get broken with W10 updates (static linking in other words). They have provided me with full source code for said port. The other of my clients, is in the process of going pure linux on their desktops and servers. Not because I have been bending their arm - but out of sheer frustration with MS... I simply can't afford for my work to have some glitch from wxWidgets break stuff. I need a toolkit to operate as documented.

The wxWidgets folks I've been discussing issues with have been absolutely great. Really. Super helpful people. Giving me work-arounds for some issues - and in one case - I need to write my own event handler - so I can filter keyboard activity. A class that one of the long-term wxWidgets folks provided for me.

So the people have been very good....but I've got a concern after reading their bug tracker....that at some point when I get deep into the porting process - I fear finding a show-stopping issue with the toolkit - thus the QT idea.

Being a long time wxWidgets user - do you find issues for apps for your employer that are wxWidget issues - or am I just being needlessly nervous?

I know I'm hijacking the thread's subject matter a tad....but would appreciate your response before I mark it as "solved".


Again, THANK YOU for your reply, I appreciate it.


Dave


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxWidgets 3.0.4 & 3.1.2
« Reply #4 on: July 30, 2019, 11:53:27 am »

Quote
[...] I know that the new wxWidgets will go into /usr/local/* instead of usr/lib....
not necessarily; you can use ./configure --prefix=/usr

Both of these are really bad options and the latter is bloody dangerous and would break your system. Don't do it you don't intend to rebuild every wx app you're ever going to need. Also there is really big chance that the package manager would break your install of wx. And you won't ever be able to uninstall wx cleanly, because it will be mixed with all the other stuff in /usr or /usr/local and make uninstall is really broken.

So don't do it, use non-default prefixes like ~/software/wx, /opt/wxXXX or something else unique.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]