Author Topic: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...  (Read 10925 times)

Offline Brane2

  • Multiple posting newcomer
  • *
  • Posts: 39
Hi to all,

I have been trying to get to compile CB for some time with new gcc-4.7.0 but so far without success.

New gcc used to find some problems with sources, many of which can be allayed by using -fpermissive flag.

There is still one in ( as of version 7934) help_plugin/def.h file, where I had to use "this->find" instead existing default name scope for "find(k)".

After that it compiles fine right until final link ( even libraries are reported as installled), where it fails with a bunch of missing symbols of some (as it appears) weak references.

It seems to fail with or without -flto and with or without -fuse-linker-plugin. Also, -O2/O3 doesn't seem to matter.

I have 64-bit Gentoo Linux with latest 3.2.x kernel on Phenom II X4 955BE with 8GiB of RAM and Radeon HD6850...

Here is how I configure & compile it:

content of my_all execteable script in root source dir:

Quote
#! /bin/bash
export CFLAGS="-march=native -O2 -fpermissive -flto -fuse-linker-plugin -pipe"
export CXXFLAGS="-march=native -O2 -fpermissive -flto -fuse-linker-plugin -pipe"
make uninstall
make distclean
make clean
./bootstrap
./configure  --prefix=/usr --with-contrib-plugins=all,-BrowseTracker --with-x
make
make install

And here is tail of error log:

Quote
make[5]: Leaving directory `/usr/src/cb5/src/plugins/contrib/MouseSap'
make[4]: Leaving directory `/usr/src/cb5/src/plugins/contrib/MouseSap'
Making install in NassiShneiderman
make[4]: Entering directory `/usr/src/cb5/src/plugins/contrib/NassiShneiderman'
/bin/sh ../../../../libtool --tag=CXX --mode=link g++  -O2 -ffast-math -DCB_AUTOCONF -march=native -O2 -fpermissive -flto -fuse-linker-plugin -pipe -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions   -o libNassiShneiderman.la -rpath /usr/lib/codeblocks/plugins -module -version-info 0:1:0 -shared -no-undefined -avoid-version 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 -lpthread -ldl
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/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,/usr/src/cb5/src/sdk/.libs ../../../sdk/.libs/libcodeblocks.so -L/usr/lib64 -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_dbgrid-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_odbc-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 -lpthread -ldl -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/crtfastmath.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/crtendS.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../lib64/crtn.o  -O2 -march=native -O2 -flto -fuse-linker-plugin   -pthread -Wl,-soname -Wl,libNassiShneiderman.so -o .libs/libNassiShneiderman.so
`_ZThn8_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED1Ev' referenced in section `.data.rel.ro' of /tmp/ccULUhh1.ltrans2.ltrans.o: defined in discarded section `.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED5Ev' of .libs/CParser.o (symbol from plugin)
`_ZThn8_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED0Ev' referenced in section `.data.rel.ro' of /tmp/ccULUhh1.ltrans2.ltrans.o: defined in discarded section `.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED0Ev' of .libs/CParser.o (symbol from plugin)
`_ZThn48_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED1Ev' referenced in section `.data.rel.ro' of /tmp/ccULUhh1.ltrans2.ltrans.o: defined in discarded section `.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED5Ev' of .libs/CParser.o (symbol from plugin)
`_ZThn48_N5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED0Ev' referenced in section `.data.rel.ro' of /tmp/ccULUhh1.ltrans2.ltrans.o: defined in discarded section `.gnu.linkonce.t._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_6spirit7classic19multi_pass_policies20illegal_backtrackingEEEED0Ev' of .libs/CParser.o (symbol from plugin)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/libNassiShneiderman.so: hidden symbol `.LTHUNK17.60027' isn't defined
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[4]: *** [libNassiShneiderman.la] Error 1
make[4]: Leaving directory `/usr/src/cb5/src/plugins/contrib/NassiShneiderman'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/usr/src/cb5/src/plugins/contrib'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/src/cb5/src/plugins'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/usr/src/cb5/src'
make: *** [install-recursive] Error 1


Has anyone tried this ? It seems it would be benefitial speedwise, since CB is complex and -flto enables optimisations across compilation modules and it seems to work with gcc-4.7.0 better than with any prior version...





« Last Edit: April 16, 2012, 05:48:50 am by Brane2 »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #1 on: April 16, 2012, 06:55:33 am »
Before we discuss about rarley supported compiler let me ask the obvious: You did compile wxWidgets 2.8.x with this version of GCC to?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Brane2

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #2 on: April 16, 2012, 12:50:39 pm »
Errm, it doesn't seem to be...  ::)

Ooops. Sorry. I've recompiled verything ( 1000+ packages) with gcc-4.7.0 adn some small part failed to build with default CFLAGS/CXXFLAGS.

I've managed to either patch them or tweak flags per package so that they compile.

But rare few had to be compiled with "old" gcc-4.6.3.

I have two versions of wxGTK:

-wxGTK-2.8.12.1 ( latest one in slot:2.8 on Gentoo)
-wxGTK-2.9.3.1  ( latest one in slot:2.9 on Gentoo)

I had discovered that first one( v2.8.12.1) was compiled with gcc-4.6.3 and without "-flto" flag, while v2.9.3.1 was compiled on gcc-4.7.0 with system default C/CXX-FLAGS="-march=native -O3 -flto -fpermissive -pipe" flags

I tr4ied just now to recompile wxGTK-2.8.12.1 with sysdefault flags on gcc-4.7.0 and failed ( no linking problems, it complains about not being able to find thread.h, I'll look into that). I repeated the attempt without "-flto" and succeeded.

I didn't try to recompile CB with such wxGTK, since having the essential library compiled without "-flto" linked into complex program misses the point of using the new gcc, so I'll try to fix wxGTK-2.8.12.1 first and then report here...  ;D





Offline Brane2

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #3 on: April 18, 2012, 05:36:57 am »
O.K. I have now managed to recompile wxGTK-2.8.12.1 with gcc-4.7.0 ( CFLAGS=CXXFLAGS="-march=native -O3 -flto -fpermissive -pipe").

Results is still the same. If I try to compile CB with -flto on gcc-4.7.0, compile fails with aforementioned error.

But when I remove -flto OR use gcc-4.6.3, it compiles fine...
« Last Edit: April 18, 2012, 05:47:41 am by Brane2 »

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #4 on: April 18, 2012, 06:48:09 am »
It seems the lto linker bug.
You should report to gcc bugzilla or binutils bugzilla.

Or you can try to add the linker option :  -flto-partition=none

The bug is very similar with this I reported ago : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49844
Regards,
xunxun

Offline Brane2

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #5 on: April 18, 2012, 11:05:05 am »
It seems the lto linker bug.
You should report to gcc bugzilla or binutils bugzilla.

Or you can try to add the linker option :  -flto-partition=none

The bug is very similar with this I reported ago : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49844

Great! I'm recompiling it now. WRT to filing a bug to that crowd, well, you can see how your bug went through- it seems it was basically ignored.

GCC crowd wants from bug filer to do his part - to analyze bug behaviour and provide simple test case.
They can't be bothered to go for lengthy C::B compilation and dig through extensive C++ code for error.

If I could do that, I would take my time and provide simple testcase, but my eyeballs hurt from all that C++pr0n of  class fornication, inheritances etcetc...



« Last Edit: April 18, 2012, 11:23:46 am by Brane2 »

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: compilation of Code::Blocks with gcc-4.7.0 (on Linux) fails...
« Reply #6 on: April 18, 2012, 11:44:25 am »
Great! I'm recompiling it now. WRT to filing a bug to that crowd, well, you can see how your bug went through- it seems it was basically ignored.

GCC crowd wants from bug filer to do his part - to analyze bug behaviour and provide simple test case.
They can't be bothered to go for lengthy C::B compilation and dig through extensive C++ code for error.

If I could do that, I would take my time and provide simple testcase, but my eyeballs hurt from all that C++pr0n of  class fornication, inheritances etcetc...

Very good if you could find a simple testcase.
I tried to reduce the source code ago, but I failed to reproduce the issue.
Only when I build a larger project, I can come across the problem ...  :(
Regards,
xunxun