Author Topic: wxSmith and Valgrind Pluggin Installation  (Read 1411 times)

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
wxSmith and Valgrind Pluggin Installation
« on: February 08, 2019, 06:46:08 am »
I installed Code::Blocks from svn 11562 and wxWidgets version 3.0.3 from source according to the instructions at http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux
In Code::Blocks Help => About I see verification that wxWidgets is installed.

After installing Code::Blocks I installed Valgrind and wxSmith with the commands:
Code: [Select]
sudo apt-get install codeblocks-contrib
sudo apt-get install valgrind

I do not see Valgrind in the Code::Blocks's menu bar. And when I attempt to create a wxWidgets frame based  project with wxSmith Preferred GUI Builder I get the error message
Quote
wxSmith is not loaded, can not continue

Why would Code::Blocks not recognize that codeblocks-contrib and valgrind are installed?
« Last Edit: February 10, 2019, 06:07:41 pm by spflanze »

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 303
Re: wxSmith and Valgrind Pluggin Installation
« Reply #1 on: February 08, 2019, 09:23:58 am »
If you install C::B from source you must use the plugins you compiled, not the repository ones. For the contrib plugins to be compiled you must specify --with-contrib-plugins=all when calling configure.

Valgrind is needed to execute the Valgrind plugin, but it is not the plugin itself.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #2 on: February 08, 2019, 03:41:07 pm »
When I executed the command:
Code: [Select]
./configure --with-contrib-plugins=allI got the error:
Quote
checking for HUNSPELL... no
configure: error: Package requirements (hunspell) were not met:

No package 'hunspell' found
I do have a repository installation of hunspell. Now I will have to compile hunspell. How is this done in a way that configure will find it? Would it be sufficient to compile it in a subdirectory of the same ~/devel directory I compiled wxWidgets and Code::Blocks in? (wxWidgets and Code::Blocks were each compiled their own subdirectories of ~/devel).

I attempted to ignore this error regarding hunspell and continued to compile with the make command. I got this warning and error:
Quote
configmanager-revision.cpp:15:25: warning: ../../src/include/sdk_precomp.h.gch: not used because `WXUSINGDLL' not defined [-Winvalid-pch]
 #include "sdk_precomp.h"
                         ^
In file included from ../../src/include/sdk_precomp.h:13:0,
                 from configmanager-revision.cpp:15:
../../src/include/sdk_common.h:37:10: fatal error: wx/wxprec.h: No such file or directory
 #include <wx/wxprec.h>
          ^~~~~~~~~~~~~
compilation terminated.

The file wxprec.h does exist in the path:
/opt/wx/3.0/include/wx-3.0/wx/wxprec.h
How can I get make to find it there?

Offline sodev

  • Regular
  • ***
  • Posts: 295
Re: wxSmith and Valgrind Pluggin Installation
« Reply #3 on: February 08, 2019, 04:05:16 pm »
configure failed, your source tree is in an undefined state, everything can happen from finding the Holy Grail to starting World War 3, but very unlikely make will do anything useful.

To compile against your system packages you always need to install their dev packages, nothing installs these automatically, you always have to do it yourself.

I never had to compile anything extra for CodeBlocks except wxWidgets. The configure script also has a help switch, its output especially lists the available plugins, if you dont want them all, you can specify only the ones you need.

I usually compile CodeBlocks like this (the excluded plugin requires boost that i dont want to install system wide to prevent problems with my various private ones):

Code: [Select]
./configure --with-contrib-plugins=all,-NassiShneiderman

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #4 on: February 08, 2019, 05:14:44 pm »
I executed these commands:
Code: [Select]
sudo apt-get install libgamin-dev
sudo apt-get install libhunspell-dev
after which the command:
Code: [Select]
./configure --with-contrib-plugins=allcompleted without error. Thanks :)
However when I attempted to compile with the make command I still got the "wx/wxprec.h: No such file or directory" error. I tried again after executing:
Code: [Select]
./configure --with-contrib-plugins=all,-NassiShneidermanand got the same result.



Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 303
Re: wxSmith and Valgrind Pluggin Installation
« Reply #5 on: February 08, 2019, 06:06:43 pm »
Do you have libwxgtk3.0-dev installed? Try

Code: [Select]
sudo apt-get install libwxgtk3.0-dev

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #6 on: February 08, 2019, 07:56:07 pm »
libwxgtk3.0-dev was not installed. So I installed it, but it made no difference  The compiler still cannot find  wx/wxprec.h.

The libwxgtk3.0-dev installed version is (3.0.4+dfsg-3). But it is wxWdigets 3.0.3 I have installed. Could that by why I still get this error?
« Last Edit: February 08, 2019, 09:11:13 pm by spflanze »

Online stahta01

  • Lives here!
  • ****
  • Posts: 6554
    • My Best Post
Re: wxSmith and Valgrind Pluggin Installation
« Reply #7 on: February 08, 2019, 10:16:29 pm »
What Linux distro are you using?
What does the next two commands return?

Code: [Select]
wx-config --libs

Code: [Select]
wx-config --cflags

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #8 on: February 08, 2019, 10:40:29 pm »
Ubuntu 18.04

Code: [Select]
~/devel/trunk$ wx-config --libs

-L/usr/local/lib -pthread   /usr/local/lib/libwx_gtk2u_xrc-3.0.a /usr/local/lib/libwx_gtk2u_qa-3.0.a /usr/local/lib/libwx_baseu_net-3.0.a /usr/local/lib/libwx_gtk2u_html-3.0.a /usr/local/lib/libwx_gtk2u_adv-3.0.a /usr/local/lib/libwx_gtk2u_core-3.0.a /usr/local/lib/libwx_baseu_xml-3.0.a /usr/local/lib/libwx_baseu-3.0.a -lgthread-2.0 -pthread -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lpng -lexpat -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lz -ldl -lm

~/devel/trunk$ wx-config --cflags

-I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread

Online stahta01

  • Lives here!
  • ****
  • Posts: 6554
    • My Best Post
Re: wxSmith and Valgrind Pluggin Installation
« Reply #9 on: February 08, 2019, 10:44:54 pm »
Code::Blocks does not work very well with static wxWidgets.

Edit: I thought you were using the system wxWidgets instead of a local built version?

Edit2: Post output of this command
Code: [Select]
wx-config --list
Tim S.
« Last Edit: February 08, 2019, 10:46:56 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #10 on: February 08, 2019, 11:09:29 pm »
It is a local built version.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #11 on: February 08, 2019, 11:11:49 pm »
It is a local built version.

Code: [Select]
~/devel/trunk$ wx-config --list

    Default config is gtk2-unicode-static-3.0

  Default config will be used for output

  Alternate matches:
    gtk3-unicode-static-3.0

Online stahta01

  • Lives here!
  • ****
  • Posts: 6554
    • My Best Post
Re: wxSmith and Valgrind Pluggin Installation
« Reply #12 on: February 08, 2019, 11:14:40 pm »
If you wish to use a local built version of wxWidgets you need to build the shared version instead of the static version.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #13 on: February 08, 2019, 11:51:04 pm »
I thought it was the shared version until now. I followed the instructions at:
 http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux
to install wxWidgets. The source file was expanded from wxWidgets-3.0.3.tar.bz2

This is the essential command sequence I used on source files expanded from that:

Code: [Select]
../configure --prefix=/opt/wx/3.0 \
       --enable-xrc \
       --enable-monolithic \
       --enable-unicode
make
sudo make install

What need I do different to make it shared?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6554
    • My Best Post
Re: wxSmith and Valgrind Pluggin Installation
« Reply #14 on: February 08, 2019, 11:54:52 pm »
I forget.

It is likely either "--enable-shared" or "--disable-static".

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Regular
  • ***
  • Posts: 295
Re: wxSmith and Valgrind Pluggin Installation
« Reply #15 on: February 09, 2019, 12:44:33 am »
If you did this
Code: [Select]
./configure --prefix=/opt/wx/3.0
but get this

Code: [Select]
~/devel/trunk$ wx-config --libs

-L/usr/local/lib -pthread   /usr/local/lib/libwx_gtk2u_xrc-3.0.a /usr/local/lib/libwx_gtk2u_qa-3.0.a /usr/local/lib/libwx_baseu_net-3.0.a /usr/local/lib/libwx_gtk2u_html-3.0.a /usr/local/lib/libwx_gtk2u_adv-3.0.a /usr/local/lib/libwx_gtk2u_core-3.0.a /usr/local/lib/libwx_baseu_xml-3.0.a /usr/local/lib/libwx_baseu-3.0.a -lgthread-2.0 -pthread -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lpng -lexpat -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lz -ldl -lm

~/devel/trunk$ wx-config --cflags

-I/usr/local/lib/wx/include/gtk2-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread

then something is severely wrong, because all your stuff should be in /opt/wx/3.0 and not in /usr/local.

Now that you also have also libwxgtk3.0-dev installed, you have at least two wx-config config scripts!

For starters, what does
Code: [Select]
which wx-configsay? And then you need to check what your /usr/local and /opt/wx/3.0 do really contain.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #16 on: February 09, 2019, 05:49:41 am »
I removed libwxgtk3.0-dev.

Something is indeed wrong. I did set the prefix to "/opt/wx/3.0". But after making wxWidgets I get:
Code: [Select]
wx-config --prefix
/usr
The prefix ends up being /usr instead. What might have gone wrong here? The configure command I used is:
Code: [Select]
../configure --prefix=/opt/wx/3.0  --enable-xrc --enable-monolithic --enable-unicode --with-opengl
wx-config --prefix
According to:
https://wiki.wxwidgets.org/Compiling_and_getting_started
The shared library is default.
« Last Edit: February 09, 2019, 07:26:53 am by spflanze »

Offline sodev

  • Regular
  • ***
  • Posts: 295
Re: wxSmith and Valgrind Pluggin Installation
« Reply #17 on: February 09, 2019, 05:47:31 pm »
As i said, you still might have multiple wx-config scripts and depending on which one gets executed it uses a specific installation by default or can only see a specific set of installations.

So for a start you need to figure out which one is used by calling
Code: [Select]
which wx-config
Then you have to check what these different locations really contain, preferrably remove all duplicates and fix wx-config, which usually is just a symlink to the real script, to point to the correct one.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #18 on: February 11, 2019, 07:40:15 am »
I did a search for all files named 'wx-config" and found several of them. These were:

Code: [Select]
/etc/alternatives/wx-config
/home/stephen/.local/share/Trash/files/wx-config
/home/stephen/devel/wxWidgets-3.0.3/build_gtk3_shared_monolithic_unicode/wx-config
/var/lib/dpkg/alternatives/wx-config
/usr/bin/wx-config
/usr/local/bin/wx-config
/opt/wx/3.0/bin/wx-config

"/etc/alternatives/wx-config" was a broken link. I removed it.

"which wx-config" returned "/usr/bin/wx-config", which is the wrong prefix, and which is the reason for the difficulty. I removed it.

The script:
Code: [Select]
/home/stephen/devel/wxWidgets-3.0.3/build_gtk3_shared_monolithic_unicode/wx-configreturned the prefix equivalent "~/devel/wxWidgets-3.0.3" which is the directory I built wxWidgets in. I am not sure if this should be deleted so I left it there.

All others returned the wrong prefixes so I deleted them. These ones I removed were likely left over from binary installs of wxWidgets.

In the Instructions at: http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux
there is instruction to execute this command (altered for my circumstance):
Code: [Select]
export PATH=/opt/wx/3.0/bin/:$PATHThis changes the path only temporarily. To make the path survive relog I had prepended the prefix to the path I in the file: /etc/environment so I would not have to do this everytime I run Code::Blocks after a rerun.

The wxWidgets is successful now. And so is the Code::Blocks compile. But when I run Code::Blocks I get the error:

Quote
codeblocks: error while loading shared libraries: libcodeblocks.so.0: cannot open shared object file: No such file or directory

The file libcodeblocks.so.0 does exist in the path:
Code: [Select]
/usr/local/lib/libcodeblocks.so.0Code::Blocks cannot find it. I would appreciate any suggestions regarding what to do about it.

Rignt now this is the system path:
Code: [Select]
$ echo $PATH
/opt/wx/3.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5221
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxSmith and Valgrind Pluggin Installation
« Reply #19 on: February 11, 2019, 07:50:53 am »
4.3 Resolving runtime issues
Do you see this section of the wiki page? It describe the same issue as your reported.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 119
Re: wxSmith and Valgrind Pluggin Installation
« Reply #20 on: February 12, 2019, 05:07:23 am »
I did fail to read that all the way to the bottom. Editing the file /etc/ld.so.conf did get Code::Blocks to run. I thank you for your help :)