|
From: Daniel J S. <dan...@ie...> - 2017-07-05 01:08:08
|
On 07/04/2017 06:23 PM, sfeam via gnuplot-beta wrote: > On Wednesday, 05 July 2017 01:08:35 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 sebald@ ~ $ wx-config --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 in that list is "pthread" which I believe is to inform the gcc/c++ compiler that posix threads are to be used in compiling and linking. (I think pthread is standard across compilers, but I'm not sure.) In other words, it's supposed to be the responsibility of the compiler to deal with all the threads issues so long as wxWidgets follows posix. In the fix for this bug http://gnuplot.10905.n7.nabble.com/crash-when-using-wxt-in-Ubuntu-12-04-td17318.html the following line was added: /* Define a new application type, each gui should derive a class from wxApp */ class wxtApp : public wxApp { public: #if defined(WXT_MULTITHREADED) && defined(WX_NEEDS_XINITTHREADS) && defined(X11) /* Magic fix needed by wxgtk3.0 */ wxtApp() : wxApp() { XInitThreads(); } #endif There's no way for wx-config to anticipate that this forced thread initialization is going to appear in the code and that X11 library is needed to satisfy that. It could be that "-pthread" doesn't even use the X11 library but maybe has it's own similar code. Maybe XInitThreads() is a hunk of code that just happens to solve the internal linux issue. So, I would say the problem is that the fix for that bug report linked above, i.e., forcing XInitThreads(), isn't the proper way of going about things. Let's find a proper way to fix that original bug. For reference, wxWidgets multithreading is discussed here: http://docs.wxwidgets.org/trunk/overview_thread.html Dan |