gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
277 stars 62 forks source link

build error : multiple definition of `wxGridTableBase::GetColLabelValue(int) #1539

Closed Sandipan-Borthakur closed 1 year ago

Sandipan-Borthakur commented 1 year ago

Hii guys

I am trying to install GDL into my laptop, and I encountered the following error while building the build_gdl.sh file -

/usr/bin/ld: /usr/local/lib/libwx_gtk3u_core-3.2.a(corelib_grid.o): in function wxGridTableBase::GetColLabelValue(int)': grid.cpp:(.text+0x29a0): multiple definition ofwxGridTableBase::GetColLabelValue(int)'; CMakeFiles/gdl.dir/gdlwidget.cpp.o:gdlwidget.cpp:(.text+0xf140): first defined here /usr/bin/ld: /usr/local/lib/libwx_gtk3u_core-3.2.a(corelib_grid.o): in function wxGridTableBase::GetRowLabelValue(int)': grid.cpp:(.text+0x17340): multiple definition ofwxGridTableBase::GetRowLabelValue(int)'; CMakeFiles/gdl.dir/gdlwidget.cpp.o:gdlwidget.cpp:(.text+0xf140): first defined here collect2: error: ld returned 1 exit status make[2]: ** [src/CMakeFiles/gdl.dir/build.make:2490: src/gdl] Error 1 make[1]: [CMakeFiles/Makefile2:195: src/CMakeFiles/gdl.dir/all] Error 2**

When I looked in the gdlwidget.cpp file in the src directory of gdl, I discovered that the gdlwidgets.cpp program is trying to override the GetColLabelValue and GetRowLabelValue function in the wxGridTableBase class of wxwidgets and it is (probably) unable to do so. Can you let me know what I can do here? I have never used IDL before, and I have minimal experience in C++.

GillesDuvert commented 1 year ago

@Sandipan-Borthakur indeed, GDL overrides methods GetColLabelValue and GetRowLabelValue between lines 2566 and 2585 of file src/gdlwidget.cpp

I suspect this to be a leftover of an old version of the GDL widgets, not used anymore. You should comment the above lines, recompile GDL, and leave us a message if anything is amiss.

Sandipan-Borthakur commented 1 year ago

Hii @GillesDuvert , thanks for your quick response. I commented those lines and GDL was installed!! I am now facing another issue, which I am not sure if it directly relates to GDL or specifically to WxWidgets. I was trying to run a software called BinMag, which is written in IDL and I get the following error -

../src/common/object.cpp(233): assert "classTable->Get(m_className) == __null" failed in Register(): Class "wxFilterOutputStream" already in RTTI table - have you used wxIMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?

There are multiple errors like this for different classes. Do you know what is the issue here? Just so you know, I installed GDL earlier using sudo apt-get install gnudatalanguage(which I uninstalled) and I installed Wxwidgets too manually before installing GDL again. I also tried running the BinMag software before using the older version of GDL, but had issues with Plplot and wxwidgets.

GillesDuvert commented 1 year ago

Hi, I thought such problems were behind us... I vaguely remember such errors arising when there is a mismatch between the wxWidgets library installed by the system (apt-get) and the one used when compiling gdl. Perhaps a clean build of the most recent gdl (git clone from this site) using the procedure described in method 1 of the wiki would suffice.

Sandipan-Borthakur commented 1 year ago

I installed gdl using the method you cited. Should I uninstall wxwidgets, plplot and gdl and try again?

alaingdl commented 1 year ago

@Sandipan-Borthakur

1/ could you please give more information on your system ? Because I frequently compile GDL on various platforms ans nowhere I have such problem

2/ you can try a light compilation doing :

git clone https://github.com/gnudatalanguage/gdl/
cd gdl/
git submodule update --init 
mkdir mybuild
cd mybuild/
cmake .. -DX11=on -DWXWIDGETS=off -DCMAKE_INSTALL_PREFIX=$PWD/install -DQHULL=off
make -j 12
make install
cd ..
./mybuild/install/bin/gdl
Sandipan-Borthakur commented 1 year ago

Hii Alain I have Ubuntu 20.04.5 LTS. I have anaconda installed on my laptop, but I deactivated it before compiling GDL. I currently have the following packages installed in relation to wxwidgets - Screenshot from 2023-03-08 17-38-30

Before installing GDL in the way mentioned here, I tried installing it using - sudo apt-get install gnudatalanguage and I manually installed plplot and wxwidgets too. I uninstalled this version of the gdl first and re-installed it as mentioned above. Maybe I messed it up by doing these things. Let me know if you need further information.

I will give you an update after I try the light compilation.

alaingdl commented 1 year ago
Sandipan-Borthakur commented 1 year ago

Yeah, I noticed. I have used the corrected one. That would be great if you could test it too.

Sandipan-Borthakur commented 1 year ago

I tried the light compilation, and GDL is installed without any issues. But when I try to run the BinMag software mentioned in my comment here, I get the following message - WIDGET_CONTROL: GDL was compiled without support for wxWidgets % Execution halted at: $MAIN$

GillesDuvert commented 1 year ago

Of course, no wxWidgets, no widgets :smile:

GillesDuvert commented 1 year ago

Hi, incidentally I've run BinMag (without installing SME, just to see the widget). looks OK, except that you'll have to remove unsupported option ",FILL_PATTERN=0" at line 3991 in binmag6.pro note to me: add this option to gdl.

Sandipan-Borthakur commented 1 year ago

Oh really!! That's great. I am not sure why there is an issue with my laptop. I already have GDL installed by the method you suggested with the wxwidgets. What do you suggest I do? Should I uninstall wxwidgets, gdl and plplot entirely and begin from scratch?

GillesDuvert commented 1 year ago

Oh, just remove the -DWXWIDGETS=off in the cmake command of 'light compilation' and redo cmake, make -j 12, make install . But do it in a new (empty) build directory.

Sandipan-Borthakur commented 1 year ago

Hii @GillesDuvert

I reinstalled GDL with the first method you suggested after removing wxwidgets and plplot from my system. There were no issues with installation now. I can also run BinMag(at least the widgets are in the right place) with no significant issues. But there are still some warnings popping up -

  1. % Warning: Keyword parameter COLOR_MODEL not supported in call to: WIDGET_DRAW. Ignored.
  2. (gdl:30150): Gtk-CRITICAL **: 12:01:29.577: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkNotebook.
GillesDuvert commented 1 year ago

Well, there are some IDL options that cannot be mimicked with wxWidgets, but indeed, they should pass unnoticed and not produce this annoying message. The GTK errors are a pain, especially as they should be debug warnings and yet they appear everywhere in production (not debug) installations. patch #1472 gets rid of them, but this works only with the most recent wxWidgets version.

Sandipan-Borthakur commented 1 year ago

I understand. Thank you so much for your help @GillesDuvert and @alaingdl. I am closing the issue for now.