|
From: sfeam <sf...@us...> - 2017-07-06 18:24:12
|
On Thursday, 06 July 2017 12:38:13 Daniel J Sebald wrote: > On 07/05/2017 05:08 PM, Petr Mikulik wrote: > >>>>>> I have troubles compiling rc2 on Linux (OpenSUSE 42.2, and some > >>>>>> Ubuntu) linking fails. > >>>>>> > >>>>>> It is this problem: > >>>>>> https://sourceforge.net/p/gnuplot/support-requests/196/ > >>>>>> > >>>>>> The workaround > >>>>>> configure --with-X11 > >>>>>> described above does not help, while > >>>>>> TERMLIBS="-lX11" ./configure > >>>>>> let me gnuplot compile. > >>>>>> > >>>>>> Can this be fixed? > >>>>> > >>>>> No. It is a bug in the configuration files distributed for > >>>>> libwxgtk. > >>>> > >>>> Unfortunately it seems to be a wide-spread bug. It is quite > >>>> embarassing that a > >>>> compile needs googling to fix it locally. > >>>> > >>>> Cannot "./configure" take care of this? I.e. add the "-lX11" flag if > >>>> "something"? > >>> > >>> That "something" is exactly the problem. Only some versions of > >>> wxWidgets need this, and only for some configurations. The > >>> wx-config tool is supposed to tell us what libraries are needed so > >>> we can link them. But it doesn't mention X11. So how are we to know? > >> > >> Actually, I think this is gnuplot's responsibility. If I do > > > >> Anyway, I think gnuplot configure is obligated to add -lX11, given the > >> situation. > > > > I think that ./configure is the place for tests of compile conditions. > > There can be some simple case testing whether "-lX11" is needed or not. > > Is such a workaround possible? > > The necessary tests are already present. The hunks of code that matter > have pre-processor conditionals: > > #if defined(WX_NEEDS_XINITTHREADS) && defined(X11) > #include <X11/Xlib.h> /* Magic fix for linking against wxgtk3.0 */ > #endif > > and WX_NEEDS_XINITTHREADS and X11 are defined from tests within the > configure process. > > We only want to include library -lX11 for the building of wx_gui.cpp, > and there is a convenient definition for that: > > Makefile:LIBRARIES_FOR_X = -lX11 > > The included libraries for wx_gui.cpp are gotten from the wx-config > command as discussed earlier, and it shows up as > > Makefile:WX_LIBS = -L/usr/lib/x86_64-linux-gnu -pthread > -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 -lpangocairo-1.0 -lpango-1.0 -lcairo > -lgobject-2.0 -lglib-2.0 > > So, all we really need do is append LIBRARIES_FOR_X to WX_LIBS if > XInitThreads() is used in the wx_gui code. If X11 is not present, > LIBRARIES_FOR_X should be empty. > > I've attached a six-line patch to the original bug report associated > with the inclusion of XInitThreads() here: > > https://sourceforge.net/p/gnuplot/bugs/_discuss/thread/94192961/d1c5/attachment/gnuplot-wxlibs_xinitthreads_configure-djs2017jul06.patch Unfortunately that doesn't work. As it shows in the original bug report, wxgtk stupidly insists on the XInitThreads business *even if the program doesn't use X11*. So making gnuplot's configuration rely on LIBRARIES_FOR_X doesn't resolve the original problem. It just moves the failure from compile-time to run-time. You can test this by configuring like this: ./configure --without-x --without-gd --with-wx Your patch allows it to compile without complaint, but then you get a run-time failure instead because wxgtk aborts when it finds that XInitThreads was not called. This is actually worse than the compile-time failure because at that point it's too late to fix the problem. Hence the warning in the Release Notes. Ethan NB: --without-gd is there because the gd configure tool actually gets this right and pulls in -lX11 if libgd wants it. If the wxgtk configure tool did the same we wouldn't have this problem. > > Dan > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |