C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
vcf
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 06, 2015 11:30 am

C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by vcf » Wed Nov 22, 2017 9:46 pm

Hi all,

tried to set up a new file derived from minimal in an
other dir than WXW\samples but didn't succeed bcs of
file path problems in mingw32-make and in vc12 (VS-2015).

So I ended up with C::B and tried to set up a new blank
wxWidgets project with wxSmith file ans wxFrame
(gcc 5.0.1, WXW 3.0.3, all Settings correct).

Tried to build it but got an error as shown below.

Could it be C::B doesn't work with WxW 3.0.3 or is it incapable to
work with gcc 5.0.1?!?

Any hint appreciated.

Thanks a lot - Regards - Volker

ERROR CODE SNIPPET:
.....
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x1c9f): undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_erase(unsigned int, unsigned int)'
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x2433): undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_erase(unsigned int, unsigned int)'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_04_CODE_BLOCKS/exe/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o): bad reloc address 0x0 in section `.data'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_04_CODE_BLOCKS/exe/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3508
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by ONEEYEMAN » Wed Nov 22, 2017 10:45 pm

Hi,
Which options did you pass when building the library?
Which options did you use in the C::B project?

Those 2 has to match exactly, with all other flags (C{XX}FLAGS and LDFLAGS).

Did you set the CXXFLAGS for that project to be "-std=c++11" or "-std=gnu++11" depending on how did you compile wxWidgets?

Thank you.

vcf
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 06, 2015 11:30 am

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by vcf » Thu Nov 23, 2017 12:12 am

Hi Oneeyeman,

thanks for your reply.

Compiled the gcc lib with the following options:

mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 CXXFLAGS="-std=gnu++11"

(seemed normal to me as I compiled with gcc)

Didn't set any additional options in C::B as I hoped this would do it himself.

Any further hint appreciated.

Thanks a lot - Regards - Volker

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3508
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by ONEEYEMAN » Thu Nov 23, 2017 2:27 am

Hi,
I don't think C::B does set CXXFLAGS.
You need to find where it is in this IDE and set it.

I can't help you here since I'm using MSVC...

Thank you.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by New Pagodi » Thu Nov 23, 2017 3:27 am

In codeblocks, you can add extra compiler options as follows:
1) From the menu, select Project->Build options...
2) On the "Compiler settings" tab, select the "Other compiler options" subtab.
3) Enter whatever extra options are needed
Untitled.png
Untitled.png (17.51 KiB) Viewed 1863 times

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3508
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by ONEEYEMAN » Thu Nov 23, 2017 3:43 am

Hi,
Shouldn't it be:
CXXFLAGS=-std=c++11
?
Thank you.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by New Pagodi » Thu Nov 23, 2017 3:54 am

They said they built wxWidgets with the line

Code: Select all

mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 CXXFLAGS="-std=gnu++11"
So I just added the same extra bit ("-std=gnu++11") to the other compiler options.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3508
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by ONEEYEMAN » Thu Nov 23, 2017 4:24 am

New Pagodi,
So you are saying that C::B is smart enough to prepend "CXXFLAGS" there?

Thank you.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by New Pagodi » Thu Nov 23, 2017 4:56 am

Sorry, I misunderstood the question.

Codeblocks doesn't use make files. It just calls g++ (or whatever the particular flavor mingw calls it) with options based on whatever is checked in the compiler options tab. By default (with tdmgcc5.1.0) the build commands look something like:

Code: Select all

x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -I...
Whatever is entered the "Other compiler options box" gets added to the command line verbatim. When you add "-std=gnu++11", the build command becomes:

Code: Select all

x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 -std=gnu++11 -I...
If you type "The quick brown fox" in the extra compile options box, codeblocks will dutifully try to run the command:

Code: Select all

x86_64-w64-mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -Wall -O2 The quick brown fox -I...
but will error out almost immediately.

I guess one way to think about is that that particular box is the equivalent of the "CXXFLAGS=" option when using makefiles.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3508
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by ONEEYEMAN » Thu Nov 23, 2017 5:17 am

New Pagodi,
In this case I believe the text there should be:
CXXFLAGS=-std=c++11
because that's what should be passed to the compiler.

If you have it installed, you can try it.

Thank you.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 283
Joined: Fri Nov 03, 2006 2:00 pm

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by stahta01 » Thu Nov 23, 2017 6:19 am

vcf wrote:Hi all,

tried to set up a new file derived from minimal in an
other dir than WXW\samples but didn't succeed bcs of
file path problems in mingw32-make and in vc12 (VS-2015).

So I ended up with C::B and tried to set up a new blank
wxWidgets project with wxSmith file ans wxFrame
(gcc 5.0.1, WXW 3.0.3, all Settings correct).

Tried to build it but got an error as shown below.

Could it be C::B doesn't work with WxW 3.0.3 or is it incapable to
work with gcc 5.0.1?!?

Any hint appreciated.

Thanks a lot - Regards - Volker

ERROR CODE SNIPPET:
.....
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x1c9f): undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_erase(unsigned int, unsigned int)'
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x2433): undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_erase(unsigned int, unsigned int)'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_04_CODE_BLOCKS/exe/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\3.0.3_exe\lib\gcc_lib/libwxmsw30u_core.a(corelib_gdicmn.o): bad reloc address 0x0 in section `.data'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_04_CODE_BLOCKS/exe/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
Please state what GCC version you think you are using?
I have read 5.0.1 and 5.1.0; but, your log shows 4.9.2.

You need to build wxWidgets with the same compiler you are using to develop your program.

Tim S.

User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 429
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by xaviou » Thu Nov 23, 2017 6:57 am

Hi
ONEEYEMAN wrote:New Pagodi,
In this case I believe the text there should be:
CXXFLAGS=-std=c++11
because that's what should be passed to the compiler.

If you have it installed, you can try it.

Thank you.
I do not agree with you : the libs were build with "CXXFLAGS=-std=gnu++11" not "CXXFLAGS=-std=c++11"

And even if the libs were built with this option, it is not mandatory to use it when building the application if yo udon't use c++11 specific code (tested).


Regards
Xav'
My wxWidgets stuff web page : [email protected]'s wxStuff

vcfbauplusfe
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Nov 21, 2017 3:48 pm

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by vcfbauplusfe » Thu Nov 23, 2017 8:47 am

Hi all,

first of all thanks for all the answers to this topic.

Would also say that when I used -std=gnu++11 for the libs
I MUST use it for the code compilation.

Will clean my system (see below) and will try to place the
CXXFLAGS into C::B looking forward what will happen.

@stahta01:

You are right - during the whole hurdles I messed up the gcc versions
when I tried to "downgrade" to WxW 2.8.X and with this not really
intentionally I brought the gcc 4.9.2 into the paths.

CMD window gcc - v gives 5.0.1 that shipped with my first "downgrade"
(I used gcc 7.0.1).

For sure you are right that libs and code MUST be made by the same compiler
version.

Will try to fix this during the day.

Once more thanks a lot - Regards - Volker

vcfbauplusfe
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Nov 21, 2017 3:48 pm

Re: C::B WxW 3.0.3 gcc 5.0.1 problems (undef ref / bad reloc)

Post by vcfbauplusfe » Thu Nov 23, 2017 10:39 am

Hi all,

meanwhile I fixed the comp version problem but to be honest didn't get really one step
further as I still run in bad rloc problems.

Meanwhile I use definiteley gcc 5.1.0 and WXW 2.8.6
(compiled with
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 CXXFLAGS="-std=gnu++11" )

I set the compiler toolchain tab path to

D:\_02_A_PROGS\_06_CODING\_00_IDEs\_02_MinGW64\_02_TDM_GCC_5.1.0\exe

and took all of the needed progc (mingw32-gcc-5.1.0.exe, ar, mingw32-make etc. from this dir).

Placed the CXXFLAGS="-std=gnu++11" in the "Other Compiler Options" as I cannot
mark it in the Compiler Flags.

Tried also CXXFLAGS=-std=c++11 in comp options and also in comp flags.

Ended up with the problem below. Seems the build doesn't recognize the CXXFLAGS .

Thougt maybe its a problem of mixed c/c++ code bcz of the undefined ... messages?!?
... If so how to resolve
(IMHO mingw32-gcc-5.1.0.exe should be able to deal with c-parts of the code?!)

What about the double section and different size complains of the comp?

Any hint appreciated. Thanks a lot - Regards - Volker

Below snippets of the build echo and the build error:

-------------- Build: Release in WXW-2.8.6_CB_TEST-01 (compiler: GNU GCC 5.1.0 (TDM) Compiler)---------------
mingw32-gcc-5.1.0.exe -LD:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\2.8.6_exe\lib\gcc_lib -o bin\Release\WXW-2.8.exe obj\Release\WXW_2_8_6_CB_TEST_01App.o obj\Release\WXW_2_8_6_CB_TEST_01Main.o obj\Release\resource.res -s -lwxmsw28u_core -lwxbase28u -lwxpng -lwxzlib -mwindows
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\2.8.6_exe\lib\gcc_lib/libwxmsw28u_core.a(corelib_app.o): duplicate section `.rdata$_ZTV20wxThreadHelperThread[__ZTV20wxThreadHelperThread]' has different size
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\2.8.6_exe\lib\gcc_lib/libwxmsw28u_core.a(corelib_main.o): duplicate section `.rdata$_ZTV20wxThreadHelperThread[__ZTV20wxThreadHelperThread]' has different size

........... and here the final "showdown":

:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\2.8.6_exe\lib\gcc_lib/libwxbase28u.a(baselib_regconf.o): duplicate section `.rdata$_ZTV20wxThreadHelperThread[__ZTV20wxThreadHelperThread]' has different size
D:\_02_A_PROGS\_06_CODING\_00_IDEs\_03_wx_WIDGETS\2.8.6_exe\lib\gcc_lib/libwxbase28u.a(baselib_dde.o): duplicate section `.rdata$_ZTV20wxThreadHelperThread[__ZTV20wxThreadHelperThread]' has different size
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0xc): undefined reference to `__gxx_personality_sj0'
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0x58): undefined reference to `operator new(unsigned int)'
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0x9e): undefined reference to `operator delete(void*)'
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0xcf): undefined reference to `__gxx_personality_sj0'
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0x106): undefined reference to `operator new(unsigned int)'
obj\Release\WXW_2_8_6_CB_TEST_01App.o:WXW_2_8_6_CB_TEST_01App.cpp:(.text+0x17b): undefined reference to `operator delete(void*)'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_02_MinGW64/_02_TDM_GCC_5.1.0/exe/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: obj\Release\WXW_2_8_6_CB_TEST_01App.o: bad reloc address 0x2 in section `.text$_ZN23WXW_2_8_6_CB_TEST_01AppD1Ev[__ZN23WXW_2_8_6_CB_TEST_01AppD1Ev]'
D:/_02_A_PROGS/_06_CODING/_00_IDEs/_02_MinGW64/_02_TDM_GCC_5.1.0/exe/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation

Post Reply