Author Topic: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."  (Read 11203 times)

Offline mloutris

  • Single posting newcomer
  • *
  • Posts: 7
All,
I am running Ubunut 16.04 and have versions of GTK 2 and 3 installed:
Code
ii  libgtk-3-0:amd64       3.18.9-1ubuntu3.3    amd64      GTK+ graphical user interface library
ii  libgtk2.0-0:amd64      2.24.30-1ubuntu1.16. amd64      GTK+ graphical user interface library

UPDATE:
I saw the debugging was quiet and changed it to verbose, and now I see that I am accessing both GTK 2 and 3!
How do I configure this so that I am using only one version for both GTK and wxWidgets?
I've also updated the logging below.

I installed wx as suggested here: http://codelite.org/LiteEditor/WxWidgets31Binaries#toc2 
First getting the public key and then creating the local repository:
Code
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc 
sudo apt-add-repository 'deb http://repos.codelite.org/wx3.1.0/ubuntu/ xenial universe'
I then edited /etc/apt/sources.list to remove the comment indicator, #, at the start of the line.
Code
sudo apt-get update
sudo apt-get install libwxbase3.1-0-unofficial

In CodeBlocks, I created a default wxWidgets application selecting wxSmith and compiled.

Compilation is successful with no errors or warnings, but the executable immediately fails.

Running with the debugger, I see that a GTK file is not able to be found.
The project was named 'Graphs' and the entire debug output is below:
Code
[debug]Starting program: /home/yamex5/mike/langs/cpp/SoloLearn/templates/Graphs/bin/Debug/Graphs 
[debug][Thread debugging using libthread_db enabled]
[debug]Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[debug](Graphs:28558): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
[debug]Program received signal SIGTRAP, Trace/breakpoint trap.
[debug]0x00007ffff45bba5b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]>>>>>>cb_gdb:

Program received signal SIGTRAP, Trace/breakpoint trap.
In g_logv () (/lib/x86_64-linux-gnu/libglib-2.0.so.0)

[debug]> bt 30
[debug]#0  0x00007ffff45bba5b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#1  0x00007ffff45bbbcf in g_log () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#2  0x00007ffff68d0b7a in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#3  0x00007ffff45bfbe7 in g_option_context_parse () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
[debug]#4  0x00007ffff68d0fe8 in gtk_parse_args () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#5  0x00007ffff68d1049 in gtk_init_check () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
[debug]#6  0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364
[debug]#7  0x00007ffff70ee8ba in wxEntryStart (argc=@0x7ffff748bd30: 1, argv=argv@entry=0x657510) at ../src/common/init.cpp:333
[debug]#8  0x00007ffff70eebba in wxInitialize (argc=@0x7ffff748bd30: 1, argv=0x657510) at ../src/common/init.cpp:540
[debug]#9  0x00007ffff70eec0b in wxInitializer::wxInitializer (argv=<optimized out>, argc=<optimized out>, this=<synthetic pointer>) at ../include/wx/init.h:92
[debug]#10 wxEntry (argc=<optimized out>, argv=<optimized out>) at ../src/common/init.cpp:473
[debug]#11 0x000000000040a168 in main (argc=1, argv=0x7fffffffe278) at /home/yamex5/mike/langs/cpp/SoloLearn/templates/Graphs/GraphsApp.cpp:17
[debug]>>>>>>cb_gdb:
[debug]> frame 6
[debug]364 ../src/gtk/app.cpp: No such file or directory.
[debug]#6  0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364
[debug]>>>>>>cb_gdb:

364 ../src/gtk/app.cpp: No such file or directory.
#6  0x00007ffff76f151b in wxApp::Initialize (this=0x671460, argc_=@0x7ffff748bd30: 1, argv_=0x657510) at ../src/gtk/app.cpp:364

How does one configure the version of GTK to be used for wxWidgets please?
« Last Edit: February 19, 2018, 12:13:50 am by mloutris »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #1 on: February 19, 2018, 12:05:00 am »
The source code is not needed for correct operation. But installing it might help with debugging what is going on.
My guess is that you have assertions enabled and you're hitting on. Start the program in terminal and you'll probably see which one it is.
(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!]

Offline mloutris

  • Single posting newcomer
  • *
  • Posts: 7
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #2 on: February 19, 2018, 12:20:12 am »
The source code is not needed for correct operation. But installing it might help with debugging what is going on.
My guess is that you have assertions enabled and you're hitting on. Start the program in terminal and you'll probably see which one it is.
Thanks for the quick reply!
After enabling more debugging, I see that GTK is trying to use both versions 2 and 3!
Code
[debug](Graphs:28558): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Is there a way to specify which version to use?
I'm leery of uninstalling GTK+2.0 since that was on my system initially and I don't want to chance breaking something else.

UPDATE:
I just looked through my CodeBlocks linker settings and see that I've added:
Code
`pkg-config --libs gtk+-3.0`
Should that be there, should I remove it and let CodeBlocks resolve which version of GTK+ to use, or just remove GTK+2.0?
-Mike
« Last Edit: February 19, 2018, 12:27:56 am by mloutris »

Offline mloutris

  • Single posting newcomer
  • *
  • Posts: 7
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #3 on: February 19, 2018, 12:55:21 am »
Let me ask some different questions.
For whatever reason, even though I specified linking with GTK+3, CodeBlocks is detecting and using GTK+2.

1. Is there any other place in CodeBlocks besides the linker to specify the version of GTK+ to use?

2. If not, will wxWidgets 3.1.0 work with GTK+2?

Thanks!
« Last Edit: February 19, 2018, 01:00:03 am by mloutris »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #4 on: February 19, 2018, 12:58:40 am »
Let me ask some different questions.
For whatever reason, even though I specified linking with GTK+3, CodeBlocks is detecting and using GTK+2.

1. Is there any other place to specify the version of GTK+ to use?

2. If not, will wxWidgets work with GTK+2?

Thanks!

wxGTK (wxWidgets) links to either GTK 2 or GTK 3.

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

Offline mloutris

  • Single posting newcomer
  • *
  • Posts: 7
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #5 on: February 19, 2018, 01:02:47 am »
Let me ask some different questions.
For whatever reason, even though I specified linking with GTK+3, CodeBlocks is detecting and using GTK+2.

1. Is there any other place to specify the version of GTK+ to use?

2. If not, will wxWidgets work with GTK+2?

Thanks!

wxGTK (wxWidgets) links to either GTK 2 or GTK 3.

Tim S.

Thank you, Tim!

I changed the version in the linker command from 3.0 to 2.0 and it builds just fine!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #6 on: February 19, 2018, 01:24:13 am »
If you want to use wxGTK you want to use only wx-config to setup your cflags and linker flags.
You must not use pkg-config for gtk+ if you're not explicitly calling gtk+ functions.
The version of wxGTK knows which version of gtk+ needs to be linked and loaded and it will do this automatically...
If you need to call gtk+ api functions you need to set your gtk+ compiler/linker options to match the settings of your wxgtk build.
(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!]

Offline mloutris

  • Single posting newcomer
  • *
  • Posts: 7
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #7 on: February 19, 2018, 03:42:26 am »
If you want to use wxGTK you want to use only wx-config to setup your cflags and linker flags.
You must not use pkg-config for gtk+ if you're not explicitly calling gtk+ functions.
The version of wxGTK knows which version of gtk+ needs to be linked and loaded and it will do this automatically...
If you need to call gtk+ api functions you need to set your gtk+ compiler/linker options to match the settings of your wxgtk build.

Thank you, oBFusCATed!
At this point, I don't see any need to make calls directly to GTK+, so I will use wx-config as you suggest.

However, I have one more question. Are you suggesting that there is a wx configuration file that I should update, if I want to use gtk+3.0, or is it an internal file specific for the version of wxSmith and that I should just use it however it is configured?

-Mike

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: wxSmith run time error "../src/gtk/app.cpp: No such file or directory."
« Reply #8 on: February 19, 2018, 09:28:15 am »
If you want to use gtk+3 you need to build a version of wxgtk which uses it. It is a configuration option during library built time. It cannot be changed on a built library.
(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!]