Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: killerbot on October 31, 2017, 02:59:02 pm

Title: Build problem for : NassiShneiderman
Post by: killerbot on October 31, 2017, 02:59:02 pm
I have a linux distro where the plug-in fails to build, it can not find the boost system library, I think, because it claims the needed symbols out of that library are not found.

Initially I was suspecting the cause that (when looking into the makeflie) :
Code: [Select]
libNassiShneiderman_la_LIBADD = ../../../sdk/libcodeblocks.la $(WX_LIBS) $(BOOST_SYSTEM_LIB)

that $(BOOST_SYSTEM_LIB) was empty/not defined and assuming it was not on succeeding builds.

Next I checked another linux distro where it does build, too my surprise there also $(BOOST_SYSTEM_LIB) was empty/not defined.

Anyone else having similar problems ?
Title: Re: Build problem for : NassiShneiderman
Post by: stahta01 on October 31, 2017, 03:04:08 pm
I have a linux distro where the plug-in fails to build, it can not find the boost system library, I think, because it claims the needed symbols out of that library are not found.

Initially I was suspecting the cause that (when looking into the makeflie) :
Code: [Select]
libNassiShneiderman_la_LIBADD = ../../../sdk/libcodeblocks.la $(WX_LIBS) $(BOOST_SYSTEM_LIB)

that $(BOOST_SYSTEM_LIB) was empty/not defined and assuming it was not on succeeding builds.

Next I checked another linux distro where it does build, too my surprise there also $(BOOST_SYSTEM_LIB) was empty/not defined.

Anyone else having similar problems ?

On, windows someone implied the newest boost version required the boost library to built.
In the past, the parts of Boost used by CB did not require building of the boost libs.

Tim S.
Title: Re: Build problem for : NassiShneiderman
Post by: LETARTARE on October 31, 2017, 05:24:36 pm
Bonjour,
I faced the same problem with 'Kubuntu 16.04-LTS-amd64'  to compile plugins 'C::B-11210'.
I have added packages : 'libboost-dev' and  'libboost-system'  to compile ' NassiShneiderman'.
Good continuation
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 01, 2017, 12:55:21 am
Why aren't you posting any error messages?
Now we have to guess what the real error is.
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 01, 2017, 09:00:33 am
will do, when I am at the other machine.

I think it will be like Tim said, now suddenly some boost header only starts to have a dependency on the boost system library which needs to be build. Andthe installed boost versions is indeed a difference on my linux systems.

The fun thing though is that the makefile more or less was already participating that (or someone just did some cpy/paste without knowing why), 1 thing is sure, the Makefile does not search for, or find the value for the $(BOOST_SYSTEM_LIB), because that one is for sure installed on all my linux boxes.

So in the end the plug-in will start to fail to build on more and more linux systems.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 01, 2017, 09:06:03 am
I did some boost_system fixes recently, because it has already started to fail. But according to my limited knowledge of autotools I did the correct thing.
The BOOST_SYSTEM_LIB variable should be set by the configure script to the correct value.
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 01, 2017, 09:14:19 am
this is the build error:

Code: [Select]
make[4]: Entering directory '/home/ldco/Codeblocks/trunk/src/plugins/contrib/NassiShneiderman'
/bin/sh ../../../../libtool  --tag=CXX   --mode=link g++  -O2 -ffast-math  -Winvalid-pch -fPIC -fexceptions -module -shared -version-info 0:1:0 -no-undefined -avoid-version -L/usr/lib64 -Wl,--no-undefined  -o libNassiShneiderman.la -rpath /usr/local/lib64/codeblocks/plugins bricks.lo cbEditorPanel.lo commands.lo CParser.lo DataObject.lo FileContent.lo GraphBricks.lo GraphFabric.lo HooverDrawlet.lo InsertBrickTask.lo logger.lo NassiDiagramWindow.lo NassiDropTarget.lo NassiEditorPanel.lo NassiFileContent.lo NassiPlugin.lo NassiView.lo parseactions.lo PasteTask.lo RedHatchDrawlet.lo RedLineDrawlet.lo Task.lo TextCtrl.lo TextCtrlTask.lo TextGraph.lo ../../../sdk/libcodeblocks.la -L/usr/lib64 -pthread   -lwx_gtk2u_aui-3.0 -lwx_gtk2u_propgrid-3.0 -lwx_gtk2u_richtext-3.0 -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0  /usr/lib64/libboost_system.so.1.65.1  -lpthread -ldl
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/7/crtbeginS.o  .libs/bricks.o .libs/cbEditorPanel.o .libs/commands.o .libs/CParser.o .libs/DataObject.o .libs/FileContent.o .libs/GraphBricks.o .libs/GraphFabric.o .libs/HooverDrawlet.o .libs/InsertBrickTask.o .libs/logger.o .libs/NassiDiagramWindow.o .libs/NassiDropTarget.o .libs/NassiEditorPanel.o .libs/NassiFileContent.o .libs/NassiPlugin.o .libs/NassiView.o .libs/parseactions.o .libs/PasteTask.o .libs/RedHatchDrawlet.o .libs/RedLineDrawlet.o .libs/Task.o .libs/TextCtrl.o .libs/TextCtrlTask.o .libs/TextGraph.o   -Wl,-rpath -Wl,/home/ldco/Codeblocks/trunk/src/sdk/.libs -L/usr/lib64 ../../../sdk/.libs/libcodeblocks.so -lglib-2.0 -lwx_gtk2u_aui-3.0 -lwx_gtk2u_propgrid-3.0 -lwx_gtk2u_richtext-3.0 -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 -lpthread -ldl -L/usr/lib64/gcc/x86_64-suse-linux/7 -L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/7/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib64/gcc/x86_64-suse-linux/7/crtfastmath.o /usr/lib64/gcc/x86_64-suse-linux/7/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/7/../../../../lib64/crtn.o  -O2 -Wl,--no-undefined -pthread   -pthread -Wl,-soname -Wl,libNassiShneiderman.so -o .libs/libNassiShneiderman.so
.libs/CParser.o: In function `boost::system::error_category::std_category::equivalent(std::error_code const&, int) const':
CParser.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x34): undefined reference to `boost::system::generic_category()'
CParser.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xb1): undefined reference to `boost::system::generic_category()'
CParser.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xf1): undefined reference to `boost::system::generic_category()'
.libs/CParser.o: In function `boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const':
CParser.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0x2f): undefined reference to `boost::system::generic_category()'
CParser.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0xc1): undefined reference to `boost::system::generic_category()'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:616: libNassiShneiderman.la] Error 1

As far as I could see no sign of boost system library in the link command (and neither on my working linux boxes)
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 01, 2017, 09:20:05 am
Is this a clean build?
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 01, 2017, 10:16:04 am
4th attempt after a clean build

will remove all and do svn up again ..
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 01, 2017, 07:06:53 pm
fresh svn up ==> same problem.

The makefile/configure scripts are as such not correct. To be inspected.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 01, 2017, 11:33:03 pm
What version of boost do you have installed?
What is the output of configure?
Have you run the bootstrap script?
Do you have the m4/ax_boost_base.m4 file?
How does it look?
What happens if you print the value of  $(BOOST_SYSTEM_LIB) at the end of configure?
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 02, 2017, 01:14:32 pm
boost: .165
ax_boost_vase.m4 : yes

Though that one is not mentioned when running bootstrap
Code: [Select]
Using 'svn --xml info' to get the revision
Found revision: '11222' '2017-10-31 07:56:18'
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, '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:24: installing './compile'
configure.ac:20: installing './missing'
src/base/tinyxml/Makefile.am: installing './depcomp'

Note that this file is doing stuff and will set BOOST_CPPFLAGS and BOOST_LDFLAGS, it does however do nothing with/for BOOST_SYSTEM_LIB.

During configure we can see passing by : checking for boostlib >= 1.20.0... yes


Modified configure.ac, bootstrap and configure:

   CFLAGS:     -O2 -ffast-math  -fPIC -std=c90
   CXXFLAGS:   -O2 -ffast-math  -Winvalid-pch -fPIC -fexceptions
   CPPFLAGS:   -DCB_AUTOCONF  -DCB_PRECOMP -DPIC -I$(top_srcdir)/src/include/tinyxml -DTIXML_USE_STL=YES
   LDFLAGS:    -Wl,--no-undefined
   CXX:        g++
   CC:         gcc
   BOOST_CPPFLAGS:         -I/usr/include
   BOOST_LDFLAGS:         -L/usr/lib64
   BOOST_SYSTEM_LIB:         


Why confirms my finding this BOOST_SYSTEM_LIB is nowhere set, i think no build script whatsoever even tries to tinf out what it should be.
So I tend the conclude the build scripts have always been incorrect, and we were just lukcy that untill boost 1.65 it seems we did not need to linnk with that library.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 02, 2017, 01:32:22 pm
If you look at this commit https://github.com/obfuscated/codeblocks_sf/commit/ff3903f86038e4beb7926497061368e1f7e4c35f
you'll see that I just recently added linking to boost_system.
This commit fixes the same problem on my system.
My guess is that on my system another m4 file for boost is found and the one in the repo is not used.
But I'll verify this later today.
Title: Re: Build problem for : NassiShneiderman
Post by: sodev on November 02, 2017, 09:16:04 pm
FYI, the same problem occurs on windows as well, and the reason is indeed Boost 1.65+, my last successful CodeBlocks build was done with Boost 1.64. The plugin uses only the Spirit library which is header only, but because of enabled thread safety this now pulls in a dependency of the System library which needs to be compiled. So either disable thread safety (is it required? can it be disabled?) or link with System.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 02, 2017, 09:38:35 pm
Patches for windows, welcome, because I cannot test it.
Preferably linking to boost-system.

I'll post a patch in a minute for the linux build system.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 02, 2017, 09:52:47 pm
@killerbot: Could you try the attached patch?
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 02, 2017, 10:49:52 pm
For Windows I would try to avoid that a boost library is needed. Since this will make things to build on windows much more complex.
On linux, it's much easier, people can just install it from the repository.
If indeed that thread security can be disabled, I will also have a look around for that matter.
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 03, 2017, 08:00:51 am
   BOOST_CPPFLAGS:         -I/usr/include
   BOOST_LDFLAGS:         -L/usr/lib64
   BOOST_SYSTEM_LIB:         -lboost_system

Build succeeded.

Feel free to commit, I would suggest that this gets merged to our RC branch.
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 03, 2017, 08:11:49 am
Can you try to make a source package and use it to build from it?
The steps are run make dist in your current build folder.
Then unpack the generated package somewhere else and then do ./configure && make && make install (you could probably skip the install).
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 03, 2017, 03:20:19 pm
I do this on my patched environment ?
Title: Re: Build problem for : NassiShneiderman
Post by: oBFusCATed on November 03, 2017, 08:42:45 pm
Yes, use a patched version of the source to generate the tar.gz file and then do not apply the patch.
Title: Re: Build problem for : NassiShneiderman
Post by: killerbot on November 04, 2017, 12:20:04 pm
Did the experiment : all build well.

And your commit was also nicely accepted by svn up :-)