codelite makefile wxwidgets 3.1.5

CodeLite installation/troubleshooting forum
pushback
CodeLite Curious
Posts: 7
Joined: Sun Feb 06, 2022 6:46 pm
Genuine User: Yes
IDE Question: C++
Contact:

codelite makefile wxwidgets 3.1.5

Post by pushback »

Hi.
I switched from wxwidgets 3.0.5 to 3.1.5, and now i have trouble with the build: i can't make codelite use wxwidgets 3.1.5.
There is something strange.
I use codelite makefile generator and it is configured like this:
compiler flags (g++):

Code: Select all

 -g;-O0;-Wall;$(shell wx-config --cxxflags) 

linker flags:

Code: Select all

-g;-O0;-Wall;$(shell wx-config --libs)

when i build something (the griddemo sample from wxwidgets for example) i have this log:

Code: Select all

/bin/sh -c '/usr/bin/make -j4 -e -f  Makefile'
----------Building project:[ griddemo - Debug ]----------
make[1]: Entering directory '/home/guillaume/Documents/Programmation/codelite/wxWidgets3.1.5_Samples/griddemo'
/usr/bin/g++  -c  "/home/guillaume/Documents/Programmation/codelite/wxWidgets3.1.5_Samples/griddemo/griddemo.cpp" -g -O0 -Wall -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread  -o 

///////////////////////////////then lots of errors related to wxOVERRIDE not defined.....////////////////////////////////////

but if i type in bash:

Code: Select all

wx-config --cxxflags

it responds:

Code: Select all

-I/usr/local/lib/wx/include/gtk3-unicode-3.1 -I/usr/local/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

why wx-config does not give the same path when it is called from codelite makefile and from bash?

moreover if i type

Code: Select all

g++ griddemo.cpp `wx-config --cxxflags --libs` -o prg

it compiles (and ./prg run) as expected.
And if i type:

Code: Select all

wx-config --version

i receive

Code: Select all

3.1.5

As expected.

DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by DavidGH »

Hi,

but if i type in bash:
wx-config --cxxflags

BTW, you will get more useful information by typing:
wx-config --list
Also
wx-config --version

I use codelite makefile generator and it is configured like this:

Code: Select all

 -g;-O0;-Wall;$(shell wx-config --cxxflags) 

You are calling wx-config direct, but you don't necessarily have the same Environmental variables as bash has set. One easy workaround (the one I normally use) is to use the full path to your preferred wx-config script. e.g.

Code: Select all

 -g;-O0;-Wall;$(shell /home/foo/bar/path/to/wx-config --cxxflags) 

(and similarly in your Linker settings).

Another thing to do is to set your preferred wx-config script in 'alternatives'. In a terminal, do:

Code: Select all

sudo update-alternatives --config wx-config

and choose whichever wx version you want to use.

Regards,

David

pushback
CodeLite Curious
Posts: 7
Joined: Sun Feb 06, 2022 6:46 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by pushback »

Thanks DavidGH .
I did what you said, but now i have a permission denied error and i think that's why codelite makefile did not run wxwidgets 3.1.5

Code: Select all

make[1]: execvp: /usr/local/lib/wx/include/gtk3-unicode-3.1: Permission denied

So how can i give permission to codelite?

pushback
CodeLite Curious
Posts: 7
Joined: Sun Feb 06, 2022 6:46 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by pushback »

Sh*t i did something wrong i was looking at some menu to solve my problem in codelite and i rerun the wizard ... Then i loose my g++ compiler i tried to re-add it from building setting menu, but in the file selector, g++ and the other binaries are in grey so i can't select it (i don't have permission i suppose :evil: ). I think i've broke everything :(

Code: Select all

$ which g++
/usr/bin/g++
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by DavidGH »

I did what you said

Did which? Altered your compiler/linker settings? Or used update-alternatives?

now i have a permission denied error:
make[1]: execvp: /usr/local/lib/wx/include/gtk3-unicode-3.1: Permission denied

Does /usr/local/lib/wx/include/gtk3-unicode-3.1 exist? Do you have permissions for it?

i did something wrong i was looking at some menu to solve my problem in codelite and i rerun the wizard...

What happens if, in a terminal, you call g++ -v? If it's working there (and I expect it will) you must have a problem with your CodeLite settings.
You could try looking inside ~/.codelite/config/ (or wherever your settings are) e.g. grep for 'g++'. One place it should find is in ~/.codelite/config/codelite.conf.

The ultimate answer, though, is to (close CodeLite and) rename ~/.codelite/config/ to ~/.codelite/configBAK/. Then rerun the wizard to create a new profile. Check it works, then either compare the old/new settings and try to spot the error, or just copy anything important to you into the new profile.

pushback
CodeLite Curious
Posts: 7
Joined: Sun Feb 06, 2022 6:46 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by pushback »

My problem is solved, thank you!

To recap:
i did not remember that codelite does not expect a binary for the compiler (in settings/build settings) but only the folder.

And when i changed $(shell wx-config) for $(shell /the/full/path/to/wx-config) for compiler/linker settings, i give this path:

Code: Select all

/usr/local/lib/wx/include/gtk3-unicode-3.1

but the path to give is the path returned by the command line with which:

Code: Select all

which wx-config

And now everything run fine.

thanks again!

For information why the environment variables are not the same: ie why codelite's makefile $(shell wx-config --cxxflags) is not the same as bash wx-config --cxxflags ?

DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by DavidGH »

why codelite's makefile $(shell wx-config --cxxflags) is not the same as bash wx-config --cxxflags ?

Why should it be the same?

CodeLite's environment variables can be altered in Settings > Environment variables, or (at project level) in Project Settings > Environment. CodeLite has no control over your terminal's environment, which will be set in e.g. ~/.bash_rc and/or ~/.bash_profile (and that's for bash: there are other shells e.g. dash, ksh, zsh...) and can also be altered by the user in a particular terminal instance.
For wx-config in a particular terminal instance, I often do e.g.:
PATH=/home/me/path/to/git/wx/udb3:$PATH

pushback
CodeLite Curious
Posts: 7
Joined: Sun Feb 06, 2022 6:46 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: codelite makefile wxwidgets 3.1.5

Post by pushback »

OK, I think i understand.
i though that typing $(shell (following)) in the makefile would mean "ask the default shell to run (following)..." but if i understand, this is maybe the default shell that manage the command (bash in most cases) but with an other configuration (with other environment variables).

Post Reply