I am trying to compoile the current trunk under Linux using CB.
In the updated SVN sources I found two workspaces for UNIX, both having 3.0 in the name and rigged for 3.0. I did not see any 3.2 versions.
CodeBlocks_wx30-unix.workspace
ContribPlugins_wx30-unix.workspace
I opened the first one CodeBlocks_wx30-unix.workspace and tried to compile the "All" target. The wxWidgets version was a repository installed "3.0-dev", so it should fit with the project settings with "3.0".
I got only into the first prokect "Code::Blocks wx3.0.x - Unix" and got strange compile errors I had not seen anywhere before (see below).
It compiled the TinyXML files and before linking them I get this "/bin/sh syntax error". I did not find out where a batch file comes into this compile process.
g++ -Wall -std=c++11 -fPIC (invalid) -fmessage-length=0 -fexceptions -Winvalid-pch -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DcbDEBUG -DCB_PRECOMP -iquote.objs30/include -I.objs30/include -I. -Isdk/wxscintilla/include -Iinclude/tinyxml -Iinclude/tinyxml -c /home/%USER/data/codeblocks_svn/trunk/src/base/tinyxml/tinyxmlparser.cpp -o .objs30/base/tinyxml/tinyxmlparser.o
/bin/sh: 1: Syntax error: "(" unexpected
Process terminated with status 2 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Does someone have successfully compiled CB from another CB in Linux recently?
To rule out that this might be connected to the wx3.0 version, I downloaded and installed wx3.2.4, installed it as root in /usr/bin and installed CB from the downloaded sources using the standard autotools approach.
The gave me a running and working CB with this spec
Name : Code::Blocks
Version : svn-r13403
SDK Version : 2.25.0
Scintilla Version : 3.7.5
Author : The Code::Blocks Team
E-mail : info@codeblocks.org
Website : https://www.codeblocks.org
OS : Linux 4.15.0-213-generic x86_64
Scaling factor : 1,000000
Detected scaling factor: 1,000000
Display PPI : 96x96
Display count : 1
Display 0 : XY=[0,0]; Size=[1920,1080]; Primary
wxWidgets Library (wxGTK port)
Version 3.2.4 (Unicode: wchar_t, debug level: 1),
compiled at Dec 9 2023 18:26:36
Runtime version of toolkit used is 3.22.
Compile-time GTK+ version is 3.22.30.
Then I repeated the procedure with the newly and with the new "wx3.2" installed.
Result: the same errors.
Next I tried to set the project file to wx3.2 by changing the "build options/custom variables" to fit 3.2 as wxWidget version.
Same result.
So I am getting out of ideas. Any suggestions?
Thanks!
PS: The autotools would compile the trunk fine with wx3.0, but I got "undefined references" at runtime. The first I got was "UserVariableManager::ParseCommandLine" which in the sources I found in a libcodeblocks class. I did not see any unusual wxWidget code in there. I'd be interested to know the oldest compatible wxVersion to run CB (I do not care about optimizsations), because usually 3.2 is not part of the default repositories yet (e.g. the current UbuntuLTS 22.04 still ships with 3.0). I'd be much nicer w/o downloading and comiling wx manually.
PPS: I checked the forum and wiki for info on Building CB with CB, The only section I found in the wiki was https://wiki.codeblocks.org/index.php/Installing_Code::Blocks#Working_on_Code::Blocks_sources_from_within_Code::Blocks.21 (https://wiki.codeblocks.org/index.php/Installing_Code::Blocks#Working_on_Code::Blocks_sources_from_within_Code::Blocks.21). According to this it should work right out of the box.
/bin/sh: 1: Syntax error: "(" unexpected
is due to the (invalid) parameter in the invocation of gcc:
g++ -Wall -std=c++11 -fPIC (invalid) -fmessage-length=0...
Review the compiler settings to see where this come from.
EDIT: Parts of UserVariableManager were moved around by r13245 (https://sourceforge.net/p/codeblocks/code/13245/), may be related.
Thanks,I would not have seen that. Good to know next time I see a "/bin/sh" error.
The additional compiler flags showed that I did not set the GlobalVar
$(#CB_RELEASE_TYPE) # cause of error. Was set by default to "(invalid)"
I found that I could not set it to "" but " " worked.
I changed the the custom variables to this
WX_VERSION = 32
WX_CONFIG =/usr/local/bin/wx-config --version=3.2
The default settings did not compile, I got compiler/linker errors like "double declaration" and "undefined symbols".
Now I still have an undefined ref from AUI in the wxSmith plugin, but the basic code run. Hopefully the last obstacle is the dialog "Cannot find resources..."
Code::Blocks was configured to be installed in '/home/user/data/codeblocks_svn/trunk/src/devel30/share/codeblocks'.
Please use the command-line switch '--prefix' or set the CODEBLOCKS_DATA_DIR environment variable to point where Code::Blocks is installed,
I tried both and keep getting the same dialog. Maybe again something stupid, but I am not getting it.
"/home/user/data/codeblocks_svn/trunk/src/devel30" has the codeblocks executable,
"/home/user/data/codeblocks_svn/trunk/src/devel30/share/codeblocks" only has the plugins SO's.
Isn't then "/home/user/data/codeblocks_svn/trunk/src/devel30" the correct "point where Code::Blocks is installed"?
I tried to set "--prefix" and data dir but I keep getting the same Dialog and it would not start.
These are my start parameters
/start parameters
-ns -ni -v -p --prefix="/home/user/data/codeblocks_svn/trunk/src/devel30"
CODEBLOCKS_DATA_DIR in Settings/GlobalVariables
/home/user/data/codeblocks_svn/trunk/src/devel30
undefined refs (e.g. wxControl::SetFont()) trying to figure out the problem.
I think this is the problem. The GTK2 lib only has a symbol for .
// in src/gtk/control.cpp
#ifdef __WXGTK3__
bool wxControl::SetFont(const wxFont& font)
{
As the repostory wx-confilg resolves to -lwx_gtk2u_core-3.0 it seems that CB is incompatible to wxGKT2 versions. Currently I am compiling on an 18.04LTS system. The current 22.04 LTS repository has the GTK3 version, so hopefully that resolves it.
WX_VERSION = 32
WX_CONFIG =/usr/local/bin/wx-config --version=3.2
You told it to do what it is doing!!!
well, not quite.
I had been reverting the values to default and use a gtk3 compiled version of wx3.0. I think that should fix the compile errors. But its still using the gtk2 version and not the gtk3 version.
Currently the build options are this:
// custom vars
WX_VERSION = 30
WX_CONFIG =wx-config --version=3.0
//compiler
`$(WX_CONFIG) --cflags` # thats the default that resolves the compile options for wx
With the setting above its not clear to me how to use multiple wx-config on the system? I thought its using the same wx-config that I is default with my user by setting $PATH. This version that any terminal would use. Currently I have those two wx-configs on the system and the path is such that it should find the local one first which works fine in a terminal window.
/usr/bin/wx-config # CB is using that
/usr/local/bin/wx-config # all terminal windows use this
echo $PATH
.../usr/local/bin;/usr/bin...
From the terminal I can see what the two versions do. In the C::B build log I can see C::B is using the gkt2 version.
/usr/bin/wx-config --cflags resolves to -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 ....
/usr/local/bin/wx-config --cflags resolves to -I/usr/local/lib/wx/include/gtk3-unicode-3.0 ....
I'd like to understand why C:B is using the first one.
Update:
I finally got it compiled with wx3.0 GTK3.
I discoverd the tool Project options manipulator (https://wiki.codeblocks.org/index.php/Manipulating_multiple_projects_at_the_same_time) which allows to replace a variable in all projects of a workspace
So I replaced
WX_CONFIG wx-config --version=$(WX_VERSION)
WX_CONFIG /usr/local/bin/wx-config --version=$(WX_VERSION)
After that the whole workspace compiled fine and codeblocks starts from within codeblocks, now using the custom compiled wx3.0 GKT3 version.
I still do not understand why C::B ignores my $PATH setting. OF if there are other ways to solve that issue