undefined reference issue when linked with other software

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
lambert8809
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Oct 06, 2016 2:50 am

undefined reference issue when linked with other software

Post by lambert8809 » Sat Oct 08, 2016 2:50 am

Dear all,

I am trying to link wxWidgets2.8.10 with other software under linux system. However, there are a lot of undefined reference errors when they are trying to link executable files. See below

Linking CXX executable ../TexGenGUI
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_gtk_window.o): In function `wxWindow::GtkSendPaintEvents()':
window.cpp:(.text+0x6224): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_gtk_control.o): In function `wxGtkFixSensitivity(wxWindow*)':
control.cpp:(.text+0x7f2): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_bmpbase.o): In function `operator<<(wxVariant&, wxIcon const&)':
bmpbase.cpp:(.text+0x4a4): undefined reference to `wxVariant::SetData(wxVariantData*)'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_bmpbase.o): In function `operator<<(wxVariant&, wxBitmap const&)':
bmpbase.cpp:(.text+0x58c): undefined reference to `wxVariant::SetData(wxVariantData*)'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_bmpbase.o): In function `global constructors keyed to _ZN19wxBitmapVariantData12ms_classInfoE':
bmpbase.cpp:(.text+0x6f5): undefined reference to `wxVariantData::ms_classInfo'
bmpbase.cpp:(.text+0x762): undefined reference to `wxVariantData::ms_classInfo'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_bmpbase.o):(.rodata._ZTI17wxIconVariantData[typeinfo for wxIconVariantData]+0x10): undefined reference to `typeinfo for wxVariantData'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_bmpbase.o):(.rodata._ZTI19wxBitmapVariantData[typeinfo for wxBitmapVariantData]+0x10): undefined reference to `typeinfo for wxVariantData'
/home/roger/a/liu1512/Texgen/thirparty/wxWidgets-2.8.10/build3/lib/libwx_gtk2_core-2.8.a(corelib_colourcmn.o): In function `global constructors keyed to _ZN19wxColourVariantData12ms_classInfoE':
colourcmn.cpp:(.text+0xc5): undefined reference to `wxVariantData::ms_classInfo'
......

I searched the previous topics and the errors look like related with compile order, but I have no idea how to fix it. Did anyone have similar experiences? I would really appreciate it if someone can help me about this issue.


Thanks
Xin

DavidHart
Site Admin
Site Admin
Posts: 3824
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: undefined reference issue when linked with other software

Post by DavidHart » Sat Oct 08, 2016 9:14 am

Hi,

In your previous thread I wondered if you were doing something unusual and dangerous. The current issue is likely to be because of that.

Please would you explain in more detail exactly what you are doing, and why. In particular:
1) Why wxWidgets2.8.10? It's very out of date now. Is TexGen known not to build against at least wx2.8.12, or preferably the current stable, wx3.0.2?
2) Did you build wx2.8.10 yourself on the same linux system?
3) Are you building the other software (TexGen) yourself on the same system, using your just-built wx2.8.10 to make it compile and link?
4) If not, please describe exactly what you are doing.

Regards,

David

lambert8809
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Oct 06, 2016 2:50 am

Re: undefined reference issue when linked with other software

Post by lambert8809 » Sat Oct 08, 2016 2:35 pm

Hi David,

Thank you very much for your reply and kind help. I think I did something wrong when I compiled wxWidgets as you mentioned. Let me explain this in more detail:

1. I found a thread in texgen forum http://texgen.sourceforge.net/phpBB3/vi ... ?f=1&t=705, which suggests to use version 2.8.10. In fact, I also tried wx2.8.12 but I got the same error message. The texgen official website suggests to use version 2.8.12, so I don't know if the texgen is compatible with wx3.0.2, but I can try the current version to see if the error can be removed.

2.Yes, I built wx2.8.10 myself on the same linux system.

3. Yes, I build all the other required software of texgen on the same system, except swig which is already installed in the system, and I use wx2.8.10 I compiled to compile texgen.

Thanks
Xin

DavidHart
Site Admin
Site Admin
Posts: 3824
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: undefined reference issue when linked with other software

Post by DavidHart » Sat Oct 08, 2016 3:53 pm

Thanks for the information. I read those build instructions, which sound as if they were written by a Windows user ;) . Most or all distros supply python themselves, for example, and most supply wxWidgets; the most likely problem with that is the version, which will now often be 3.0.x.

Which version of which distro are you using? If I have it here I'll try building texgen on it.

lambert8809
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Oct 06, 2016 2:50 am

Re: undefined reference issue when linked with other software

Post by lambert8809 » Sat Oct 08, 2016 9:19 pm

Thank you for your reply and kind help. I tried wx3.0.2 early today, but it seems more errors come up. Also, I agree with you that the issue maybe related with OS. I found in the first error "ib/libwx_gtk2_core-2.8.a(corelib_gtk_window.o): In function `wxWindow::GtkSendPaintEvents()':
window.cpp:(.text+0x6224): undefined reference to `wxSystemOptions::GetOptionInt(wxString const&)'", there is no wxWindow::GtkSendPaintEvents() but wxWindowGtk::GtkSendPaintEvents(). I don't know if this is helpful information. Currently, I am trying to build texgen3.8.2 on my University server, the information about the system:

LSB Version::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseWorkstation
Description: Red Hat Enterprise Linux Workstation release 6.8 (Santiago)
Release: 6.8

Thank you for your help.


Xin

DavidHart
Site Admin
Site Admin
Posts: 3824
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: undefined reference issue when linked with other software

Post by DavidHart » Sun Oct 09, 2016 11:19 am

Ah, I don't have a redhat guest. Fedora would be the nearest equivalent, but I tried first on my 'real' debian.

Linux is clearly an afterthought forTexGen and the build instructions seem obscure and incomplete. I made it through the first stage, building the base package. Then building for python seemed to work but didn't generate TexGen.Core. I'm afraid I've now run out of time for this.

You have presumably managed to get ccmake to configure for your wx2.8. Have a look at its CMakeLists.txt (presumably inside the GUI dir) and see what it says about wx2.8. In particular see how it is trying to link to those libs. You can compare this with the output of doing, in a terminal open in your wx2.8 install dir:
./wx-config --libs
If there is a difference, perhaps in the order of those libs, you could correct the CMakeLists.txt file by hand.

lambert8809
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Oct 06, 2016 2:50 am

Re: undefined reference issue when linked with other software

Post by lambert8809 » Tue Oct 11, 2016 12:16 am

Sorry for my late reply. Thank you for your advice.

Post Reply