Hi,
i try to build codeblocks on linux, without wxWidgets installed, but compiled and installed by myself.
If i run ./bootstrap it can not find the wx-config macro:
configure.ac:141: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
Now this seems ok, because i can provide the wx-config path by myself (it is /usr/local/bin/wx-config) but the ./configure command has no option --witch-wx-config and fails because it can not find the AM_CONFIG thing
./configure: line 21384: AM_OPTIONS_WXCONFIG: command not found
./configure: line 21385: syntax error near unexpected token `2.8.12,'
./configure: line 21385: `AM_PATH_WXCONFIG(2.8.12, wxWin=1)'
Is there a easy solution beside installing wxWidgets from repo?
thank you!
i also found this article in the mean time and i have tried this:
export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"
with this i was able to go trought bootstrap and it is now compiling. But i would like to know what this does....
$ update-alternatives --install /usr/bin/wx-config wx-config /opt/wx/2.8/bin/wx-config 50
can you explain what this does? Am i asked every time i run wx-config what version i would like to run? How does this go with autotools, or other tools that do not allow user interaction?
OK, I think I hit the same issue here.
I'm on a ubuntu 14.04, I build wx3.1.1 library myself, with such command:
sudo apt-get install libgtk-3-dev
cd wxWidgets-3.1.1/
mkdir gtk-build
cd gtk-build
../configure --enable-unicode --prefix=/home/zyh/code/wx3install/ --enable-monolithic
Then,
I can build a simple wx program like:
zyh@zyh:~/code/wxWidgets-3.1.1/gtk-build/samples/minimal$ make
zyh@zyh:~/code/wxWidgets-3.1.1/gtk-build/samples/minimal$ ./minimal
Now, I have cloned the C::B source:
git clone https://github.com/obfuscated/codeblocks_sf.git
Then I run bootstrap, I get failed
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ ./bootstrap Using 'git log --graph' to get the revision
Found revision: '11442' '2018-08-07 07:14:29'
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:141: warning: macro 'AM_OPTIONS_WXCONFIG' not found in library
configure.ac:142: warning: macro 'AM_PATH_WXCONFIG' not found in library
configure.ac:141: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:142: error: possibly undefined macro: AM_PATH_WXCONFIG
Since I have no previous wx library installed on my system, I run such command: (I follow this wiki page: Page (http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux))
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ update-alternatives --install /usr/bin/wx-config wx-config /home/zyh/code/wx3install/bin/wx-config 50
But I still get the same bootstrap.
So, any ideas how to step further?
Thanks.
OK, bootstrap runs OK now.
Some reference link: Re: Error while building codeblocks in unix-style (http://forums.codeblocks.org/index.php/topic,21874.msg148798.html#msg148798) and 4 Code::Blocks installation (http://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux#Code::Blocks_installation)
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ export ACLOCAL_FLAGS="-I `wx-config --prefix` -I /home/zyh/code/wx3install/share/aclocal"
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ ./bootstrap Using 'git log --graph' to get the revision
Found revision: '11442' '2018-08-07 07:14:29'
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ echo $ACLOCAL_FLAGS -I /home/zyh/code/wx3install -I /home/zyh/code/wx3install/share/aclocal
EDIT:
As suggested by blauzahn (http://forums.codeblocks.org/index.php?action=profile;u=14677), the correct command is:
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"
also, those library need to be installed:
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ mkdir build
zyh@zyh:~/code/codeblocks-git/codeblocks_sf$ cd build
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build$ sudo apt-get install libhunspell-dev
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build$ sudo apt-get install libgamin-dev
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build$ ../configure --prefix=/home/zyh/code/cbinstall/ --with-contrib-plugins=all,-NassiShneiderman
If you need to build NassiShneiderman, some extra library need to be installed.
Yes that works. This is the way, I always use it in conjunction with wxWidgets trunk
on Ubuntu 16.04 (x86_64), antergos 18.07 (x86_64) and raspbian. During the last week I tried all of
them with current trunks of cb and wxWidgets.
I have a Makefile in a directory above cb trunk. In order to bootstrap and
configure for an out of tree build I use these 2 PHONY Makefile targets:
SRCDIR=trunk
BUILDDIR=build
bootstrap:
(cd $(SRCDIR) && ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal" ./bootstrap )
config:
@mkdir -p $(BUILDDIR)
(cd $(BUILDDIR) && ../$(SRCDIR)/configure --prefix=$(PREFIX) --with-contrib-plugins=all,-NassiShneiderman)
For the record: Your clone command is missing the last letter, ending with .gi instead of .git.
Have a nice day.
For the record: Your clone command is missing the last letter, ending with .gi instead of .git.
Oh, a copy paste error, I have fixed it in the post.
Thanks for your makefile, I also do not want to build the NassiShneiderman plugin, because it needs some extra boost related header files. ;)
ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"
I just see this is a string concatenation, in my previous post, I added two "-I", which I think is wrong, thanks.
OK, I use GDB to attach to the hanging C::B, and here is the bt:
(gdb) bt 30
#0 0x00007fe35da69ed7 in wxMBConv::ToWChar(wchar_t*, unsigned long, char const*, unsigned long) const ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#1 0x00007fe35daa2214 in wxTextInputStream::GetChar() ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#2 0x00007fe35daa23c0 in wxTextInputStream::ReadLine() ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#3 0x00007fe35db36912 in ReadAll(wxInputStream*, wxArrayString&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#4 0x00007fe35db36a82 in wxDoExecuteWithCapture(wxString const&, wxArrayString&, wxArrayString*, int, wxExecuteEnv const*) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#5 0x00007fe35ebd433f in cbDebuggerPlugin::RunNixConsole(wxString&) ()
from /home/zyh/code/cbinstall/lib/libcodeblocks.so.0
#6 0x00007fe31ce0ce0a in DebuggerGDB::DoDebug(bool) ()
from /home/zyh/code/cbinstall/lib/codeblocks/plugins/libdebugger.so
#7 0x00007fe31ce0da5e in DebuggerGDB::Debug(bool) ()
from /home/zyh/code/cbinstall/lib/codeblocks/plugins/libdebugger.so
#8 0x0000000000473b85 in DebuggerMenuHandler::OnStart(wxCommandEvent&) ()
#9 0x00007fe35d9a45fe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#10 0x00007fe35db2ab32 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#11 0x00007fe35db2abe3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#12 0x00007fe35db2b32a in wxEvtHandler::TryHereOnly(wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#13 0x00007fe35db2ad73 in wxEvtHandler::DoTryChain(wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#14 0x00007fe35db2b405 in wxEvtHandler::ProcessEvent(wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#15 0x00007fe35dd7d268 in wxWindowBase::TryAfter(wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#16 0x00007fe35db2cb97 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#17 0x00007fe35dd59e64 in wxToolBarBase::OnLeftClick(int, bool) ()
from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#18 0x00007fe35a46e5e7 in ?? ()
---Type <return> to continue, or q <return> to quit---
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007fe35a487088 in g_signal_emit_valist ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007fe35a488212 in g_signal_emit_by_name ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007fe35a46e5e7 in ?? ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fe35a487088 in g_signal_emit_valist ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007fe35a487ce2 in g_signal_emit ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007fe35b7267e8 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00007fe35a46e3b8 in g_closure_invoke ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007fe35a47f557 in ?? ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007fe35a487a29 in g_signal_emit_valist ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007fe35a487ce2 in g_signal_emit ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007fe35b7256a1 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
(More stack frames follow...)
(gdb)
So, it looks like the debugger plugin goes to an endless loop?
Here is the log when I run C::B under GDB, and start the GDB under C::B, it works OK:
Active debugger config: GDB/CDB debugger:Default
Selecting target:
Debug
Adding source dir: /home/zyh/code/test/console1/
Adding source dir: /home/zyh/code/test/console1/
Adding file: /home/zyh/code/test/console1/bin/Debug/console1
Changing directory to: /home/zyh/code/test/console1/.
Set variable: LD_LIBRARY_PATH=.::/home/zyh/code/wx3install/lib/
[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet -args /home/zyh/code/test/console1/bin/Debug/console1
[debug]Working dir : /home/zyh/code/test/console1
Starting debugger: /usr/bin/gdb -nx -fullname -quiet -args /home/zyh/code/test/console1/bin/Debug/console1
Setting SHELL to '/bin/sh'
done
[debug]Reading symbols from /home/zyh/code/test/console1/bin/Debug/console1...
[debug]done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:
Setting breakpoints
[debug]Using sleep command's PID as console PID 8483, TTY /dev/pts/22
[debug]Queued:[tty /dev/pts/22]
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
[debug]Copyright (C) 2014 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory /home/zyh/code/test/console1/
[debug]Source directories searched: /home/zyh/code/test/console1:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "/home/zyh/code/test/console1/main.cpp:7"
[debug]Breakpoint 2 at 0x400861: file /home/zyh/code/test/console1/main.cpp, line 7.
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/22
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /home/zyh/code/test/console1/bin/Debug/console1
[debug]Breakpoint 2, main () at /home/zyh/code/test/console1/main.cpp:7
[debug]/home/zyh/code/test/console1/main.cpp:7:56:beg:0x400861
[debug]>>>>>>cb_gdb:
At /home/zyh/code/test/console1/main.cpp:7
While, I see when I start C::B from command line, and start GDB from C::B just hangs, the debug log shows nothing after the line "Setting breakpoints", it sounds like GDB is already started?
Can you build wx with symbols so we can see where exactly in their code stops?
I just build a wx library with symbols:
mkdir gtk-build-debug
cd gtk-build-debug
../configure --enable-unicode --prefix=/home/zyh/code/wx3install-debug/ --enable-monolithic --enable-debug
make -j4
make install
Then open a terminal, and run such command to let C::B use the new wx library
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/zyh/code/wx3install-debug/lib/
./codeblocks --multiply-instance --no-ipc &
Now, I can use C::B to debug. So, this looks like a GCC optimization bug? ;)
Since I don't rebuild C::B against debug version of wx library.
Can you try to build wx from the wx_3_0_branch and see if the problem reproduces?
OK, I will do this soon.
Do I only need to build the wx_3_0_branch library, and use the previous built C::B? I mean I can use the
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/somewhere/wx/library/installed
./codeblocks --multiply-instance --no-ipc &
to let C::B pick the wx library.
I have a question, if I have several wx library, such as:
/home/zyh/code/wx3install release version of wx 3.1.1 library
/home/zyh/code/wx3install-debug debug version of wx 3.1.1 library
/home/zyh/code/wx30install release version of wx 3.0 branch library
How do I adjust the wx-config?
In my previous post, I have to run the command:
update-alternatives --install /usr/bin/wx-config wx-config /home/zyh/code/wx3install/bin/wx-config 50
which point the wx-config to the wx library before I run the bootstrap command.
I mean, I have to run the update-alternatives command before I build a new C::B?
Question: what is the way to "build" the C::B if the source code get updated?
Today, I have run the "git pull --rebase" to update the C::B's source code to the latest revision under Ubuntu 14.
But when I switch to the build dir, and run the "make" command, I see some error message:
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$ make -f Makefile
/bin/bash ./config.status --recheck
running CONFIG_SHELL=/bin/bash /bin/bash ../configure --prefix=/home/zyh/code/cb-wx30-install/ --with-wx-config=/home/zyh/code/wx30branchinstall/bin/wx-config --no-create --no-recursion
configure: WARNING: unrecognized options: --with-wx-config
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking whether configure should try to set CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS... yes
checking whether to enable debugging... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
...
...
...
checking whether to build the foreign projects importer plugin... yes
checking whether to build the scripted wizard plugin... yes
checking whether to build the to-do plugin... yes
checking whether to build the abbreviations plugin... yes
checking whether to keep prebuild windows dll's in dist-tarball... yes
checking whether to integrate fortran-plugin in dist-tarball... yes
checking whether to use gtk-notebook as default notebook... yes
checking which (if any) contrib plugins to build... none
checking if the compiler supports precompiled headers... yes
../configure: line 20785: AM_OPTIONS_WXCONFIG: command not found
../configure: line 20786: syntax error near unexpected token `2.8.12,'
../configure: line 20786: `AM_PATH_WXCONFIG(2.8.12, wxWin=1)'
make: *** [config.status] Error 2
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$
I have such environment variable:
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$ wx-config --list
Default config is gtk3-unicode-3.0
Default config will be used for output
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$ update-alternatives --config wx-config
There is only one alternative in link group wx-config (providing /usr/bin/wx-config): /home/zyh/code/wx30branchinstall/bin/wx-config
Nothing to configure.
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$ echo $ACLOCAL_FLAGS
-I /home/zyh/code/wx30branchinstall/share/aclocal
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$
So, do I have do a clean rebuild? (for a clean rebuild, I mean I have to run bootstap, then configure, then make)
I think you specify the env variable ACLOCAL_PATH to where you located the wxwin.m4, your configuration would be ok.
Hi, thanks for the reply.
I just add my local wxwin.m4 path, which is /home/zyh/code/wx30branchinstall/share/aclocal in the ACLOCAL_PATH variable, with this command:
zyh@zyh:~/code/codeblocks-git/codeblocks_sf/build-wx30$ export ACLOCAL_PATH=/home/zyh/code/wx30branchinstall/share/aclocal:$ACLOCAL_PATH
After that, I type the make command, but the error message is the same as my previous post. :(