News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

SOLVED:installing wxWidgets2.9.1 on CB

Started by ubuntix, March 14, 2011, 11:25:20 PM

Previous topic - Next topic

ubuntix

Hi,

Till now, i used wx2.8.x in CB ( ubuntu ). I'd like to work with wxWidgets2.9.1. When i start a new project,  the wizzard ask me which wx i want, but
when i compile, the headers are thoose of old WX. Even if i give the right path in my project options.

In my environement settings->headers setting I don't have wx2.9, only 2.8 with all widgets headers defined.

I compiled wxWidgets2.9.1-SVN with the classical ./configure, make, make install. wx-config returns the good path and libs and i can compile the samples of wx2.9 so i think the library is correctly installed and I missed something in CB
can you help me.

thanks

btw: my  provider ( FREE.FR ) has blacklisted your IP! it was impossible to register because your onfirmation mail was rejected.

Jenna

If you are on linux, you don't need environment variables or other settings (search-path etc), just use wx-config.
To specify a version you can define per project or per target "Custom variables" in "Build options -> Custom variables" to chose between wx2.9 and wx2.8 or chose he debug or release build.

ubuntix

hi,
thanks for your reply.
Yes i'm on linux/ubuntu.

My question was about my headers locations in general, and all the environment.
I can "force" the headers location in my project option, but i'm surprised i have to do it.
Previously, i had 2 wxWidgets libraries installed 2.8 and 2.6.
During project creation, the wizard asked me which wxidgets i needed and that was all.
Now, i select 2.9 and i still use the 2.8 headers if i don't force te default location in my project options.

Furthermore, when i look in Environment settings->Environment Variables I have 3 groups:
CodeBlocks, wxWidgets_2.8 and wxWidgets_2.6 with all components defined with the right headers files.
But nothing about WX2.9. 

I post not only to recover thoose lovely widgets  i can't live without. Its because i have compilations errors i can't explain. When i use "find declaration" of a class for instance, i must select 2 headers files for the 2.9 and 2.8. So i'm not sure the compiler use the good one. A mix could explain the errors i have.
 

ubuntix

After further investigations, it seems that CodeBlocks use the right location to display the declarations, but the compiler use an other one.
I inserted some syntax errors in the headers of wx2.9. The compiler was always happy, but codeblocks shown me the changes in the files.
As soon i changed the header of 2.8, the compiler detected the error.
In my Projetc->Build options for the whole project ( not for debug nor release ) i have in "search diretories":/usr/locale/include/wx-2.9     
in my Project->Compiler settings->other options i have `wx-config --cflags`
and wx-config -cflags gives


~$ wx-config --cflags
-I/usr/local/lib/wx/include/gtk2-unicode-static-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread


and my files are indeed in /usr/local/include/wx-2.9

I don't understand where the includes of wx2.8 used by the compiler are coming from.
What did i made wrong ?

Thanks.

Jenna

If you use wx-config, you should not set the include dirs directly !
Use it also for linking (with --libs parameter) in "Linker settings -> Other linker settings".

Turn on full commandline logging ( seeh http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F ) to see what's used as commandline for the compiler.

Make sure there are no global search paths set ("Settings -> Compiler and debugger -> Global compiler settings -> [your compiler] -> Search directories").
If you are there you should also check the linker settings.

ubuntix

#5
if i look in the log window i have:




g++ -Wall -DWX_PRECOMP  -g  -pg -g -Wunused-variable -Wno-deprecated -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread    -I/usr/include/mysql  -c /home/moi/aMule-SVN-r10490/MyAmulePrj/wx_pch.h -o wx_pch.h.gch/Debug_wx_pch_h_gch

g++ -Wall -DWX_PRECOMP  -g  -pg -g -Wunused-variable -Wno-deprecated -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread    -I/usr/include/mysql  -c /home/moi/aMule-SVN-r10490/MyAmulePrj/GUIFrame.cpp -o obj/Debug/GUIFrame.o




No wx2.9
in the build options of the project,  compiler->other options : nothing
linker settings : all empty
search directories : all empty
all options specific to the project are empty exept WX_PRECOMP  
in the global settings , my other optons of the compiler are:


Wunused-variable
-Wno-deprecated
`wx-config --cflags`



in search direct. i: /usr/include/mysql

if I change the global setting wx-config to wxKonfig the log change to this


g++ -Wall -DWX_PRECOMP  -O2  -pg -g -Wunused-variable -Wno-deprecated    -I/usr/include/mysql  -c /home/moi/aMule-SVN-r10490/MyAmulePrj/wx_pch.h -o wx_pch.h.gch/Release_wx_pch_h_gch


wx-Konfig is unknown so wx-config in the global settings is the command actually executed.

But, under CodeBlocks wc-config gives : -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8

and in a console it gives : -I/usr/local/lib/wx/include/gtk2-unicode-static-2.9 -I/usr/local/include/wx-2.9

In settings, neither for  global nor project i have nothing relating to wx2.8, except in Header fixup configuration where i have all headers files for wx2.8 and 2.6 but they are only filemanes, without path.


if insteed of wx-config --cflagfs i type wx-config --version=2.9 -cflags , command is not executed, i have no include in the compiler command line.

I have no environment variables defined.
Should I ?

thank


Jenna

Quote from: ubuntix on March 15, 2011, 03:24:03 PM
I have no environment variables defined.
Should I ?

Do you have environment variables that are related to wxWidgets in your console ?

What's the output of wx-config --list ?

If you use --version or whatever parameters to specify the wxWidgets libs to use, the configuration-script needs to have either release or debug in the name to be found by wx-config (in fact wx-config is a symlink to one of the scripts).
Yours is most likely called /usr/local/lib/wx/config/gtk2-unicode-static-2.9.
You can either use it directly (instead of wx-config) or create a symlink to /usr/lo cal/lib/wx/config/gtk2-unicode-release-static-2.9 (instead of release use debug, if it is a debug-build).
If that does not work, try to put the symlink into /usr/lib/wx/config/ .

ubuntix

I already tried to add --version=2.9 like this wx-config -cflags --version=2.9. Codeblocks don't accept it but it works in a console. With version=2.8, same result.


:~$ wx-config --list

    Default config is gtk2-unicode-static-2.9

  Default config will be used for output

  Alternate matches:
    gtk2-unicode-2.9

  Also available in /usr/local:
    gtk2-ansi-debug-2.8
    gtk2-ansi-debug-2.9
    gtk2-ansi-release-2.8
    gtk2-ansi-release-2.9
    gtk2-unicode-debug-2.9
    gtk2-unicode-release-2.8
    gtk2-unicode-release-2.9


in console, env gives a lot of things with noting to do with widgets.

I don't understand this

Quote
create a symlink to /usr/local/lib/wx/config/gtk2-unicode-release-static-2.9

I have no problem to link, i just can't compile with the good headers. and anyway, i usually add the libs in the buils options.
I noticed somethng else:
wx-config in console returns /usr/locale/include/.....
but in codeblocks log i have /usr/include.....
see my previous post

and in fact, if i rename /usr/include/wx-2.8 to wx2.8a codeblocks don't find any header.

And something strange too in my log.


g++ -Wall -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread  -Winvalid-pch -include wx_pch.h -DWX_PRECOMP  -g  -pg -g -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread  -Wunused-variable -Wno-deprecated   -I/usr/local/include/wx-2.9 -I/usr/include/mysql  -c /home/moi/aMule-SVN-r10490/MyAmulePrj/GUIFrame.cpp -o obj/Debug/GUIFrame.o
cc1plus: warning: ./wx_pch.h.gch/Release_wx_pch_h_gch: not used because `__OPTIMIZE__' not defined
In file included from /usr/local/include/wx-2.9/wx/platform.h:711,
                 from /usr/local/include/wx-2.9/wx/defs.h:26,
                 from /usr/local/include/wx-2.9/wx/wx.h:15,
                 from /home/moi/aMule-SVN-r10490/MyAmulePrj/GUIFrame.h:19,
                 from /home/moi/aMule-SVN-r10490/MyAmulePrj/GUIFrame.cpp:19:
/usr/local/include/wx-2.9/wx/chkconf.h:94:9: error: #error "wxUSE_ANY must be defined, please read comment near the top of this file."
/usr/local/include/wx-2.9/wx/chkconf.h:102:9: error: #error "wxUSE_CONSOLE_EVENTLOOP must be defined, please read comment near the top of this file."

../.. and so on



As you can see, it seem that wx-config is called AFTER something else as i have include path of wx2.9 ( result of wx-config) after wx2.8.

what i made now: i made a small bath called sdcc installed in the right directory. Of course i don't have this compiler ( sdcc ).
This batch is just :

echo param for icc==>

because at first i wanted to do it for icc ...

and now my log is


sdcc -Wall -I/usr/local/lib/wx/include/gtk2-unicode-static-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread  -Winvalid-pch -include wx_pch.h -DWX_PRECOMP  -g    -I/usr/local/include/wx-2.9  -c GUIFrame.cpp -o obj/Debug/GUIFrame.o
param for icc==>
sdcc -Wall -I/usr/local/lib/wx/include/gtk2-unicode-static-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread  -Winvalid-pch -include wx_pch.h -DWX_PRECOMP  -g    -I/usr/local/include/wx-2.9  -c MyAmulePrjApp.cpp -o obj/Debug/MyAmulePrjApp.o
param for icc==>


I don't have any wx-2.8 in the path. It seem's i have a something defined for g++, called previously to wx-config and "hidden".
Now back to g++. If i erase every wx-config or additionnal search path for global or project setting ( what a mess) , the log still show a call to wx-2.8.
i removed all the headers of my project and the precomp headers=> same thing wx-2.8 still there

As i told you, i still have in Settings->Environement>Header-fixup configuration ( see attachment ) a lot of stuff about the old versions of widgets ( 2.8, 2.6 ) and codeblocks.
I wonder if it can't have something to see with. 


reg.


Jenna

Do you have anything set in  "Settings -> Compiler and debugger -> Global compler settings -> [the compiler you use]" ?
Especially in "Search directories"  an other compiler/linker options ?
Try wx-config with additional parameter --prefix=/usr/local:
wx-config --prefix=/usr/local --version=2.9 --unicode --cxxflags

ubuntix

Now i just have:

for global settings
in compiler -> search directories : /usr/include/mysql
in compiler->compiler settings : nothing
""                linker                : nothing
""             -> toolchain          : g++, gcc, gdb, ...,  without parameters

everything is void.

btw, codeblocks version is: 7015 SVN

if I "grep -i -r wx-2.8" all the ini files in the .codeblocks dir * I have nothing,
if I "grep -i -r wx-2.8" in my project dir i have all dependencies of headers files in .depend
same thing with grep wx-2.9
and nowhere something looking like a single path.


Jenna

Did you try this:
Quote from: jens on March 16, 2011, 06:56:50 AM
Try wx-config with additional parameter --prefix=/usr/local:
wx-config --prefix=/usr/local --version=2.9 --unicode --cxxflags

If C::B is started from menu or with double-clicking on a project-file it might have different environment variables, especially different order in system searchpath (not a C::B issue, it's OS/windomanager-specific).
So you can try what happens if you start it from a console.

If you put env in the projects pre-build steps, you can see the environment variables, that are visible by the compiler.

ubuntix

sorry for delay, i'm recompiling wxWidgets.
I made the changes you suggested, and now i don't have wx2.8 anymore in my log .
But now i have some weird errors i need to fix to be sure. They seem to come purely from wx, as it's a SVN build, an compilation needs a couples of hours...
I'll keep you in touch ,and anyway, thanks VERY MUCH for the time you spent.

ubuntix

hi,
Back again.

After some investigations it seems to work.

Maybe could it be useful for others.

on my system I have several wx-config installed.
one in /usr/local/bin & another one in /usr/bin
if I run


:/$ /usr/bin/wx-config --cxxflags
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread

and 2nd location

/$ /usr/local/bin/wx-config --cxxflags
-I/usr/local/lib/wx/include/gtk2-unicode-static-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread


and my path is:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

And it seems to be the problem:

When I enter run wx-config with no path, in a terminal, i use my system path, and the first found is /usr/local/bin , and wx-config returns the right lib 2.9.
But CodeBlocks seems to "spawn" wx-config with another path, /usr/bin i guess, and it return the wrong lib 2.8.
MAybe is there a parameter somewhere in CB to define a path for the shell, but i don't know where.
I changed the path of the compiler/linker but no change.
For me it's solved.

Jenna

Quote from: ubuntix on March 17, 2011, 08:16:12 PM
When I enter run wx-config with no path, in a terminal, i use my system path, and the first found is /usr/local/bin , and wx-config returns the right lib 2.9.
But CodeBlocks seems to "spawn" wx-config with another path, /usr/bin i guess, and it return the wrong lib 2.8.
MAybe is there a parameter somewhere in CB to define a path for the shell, but i don't know where.
I changed the path of the compiler/linker but no change.
For me it's solved.
That's what I meant:
Quote from: jens on March 16, 2011, 09:02:47 AM
If C::B is started from menu or with double-clicking on a project-file it might have different environment variables, especially different order in system searchpath (not a C::B issue, it's OS/windomanager-specific).
[...]
If you put env in the projects pre-build steps, you can see the environment variables, that are visible by the compiler.

You can use the environment variables plugin (part of the contrib-plugins) to create sets of environment variables and chose which one to use in the "Project -> Properties -> EnvVars options".