|
From: Ethan A M. <sf...@us...> - 2014-06-19 19:32:14
|
On Thursday, 19 June, 2014 11:33:34 Mojca Miklavec wrote:
> On Thu, Jun 19, 2014 at 10:05 AM, Jun T. wrote:
> > On 2014/06/17, at 4:43, Ethan A Merritt wrote:
> >> So I have changed gnuplot's autoconfigure script to add -lX11
> >> itself if it sees that the newer wxWidgets is being used.
> >
> > This causes a problem on my Mac (and maybe on other systems);
> > the linker dies saying "-lX11 can't be found".
> > (OS X 10.8 / no X11 installed / wxWidgets=svn HEAD)
>
> Confirmed. You shouldn't unconditionally link to X11 (in particular
> not on Mac). The check for wx_gtk should be better, but then again gtk
> also works with quartz on OS X. Honestly I don't expect people to use
> wxGTK 3.0 with quartz on Macs when they can use Cocoa (unless maybe
> with wxGTK 2.8 to get support for old software that hasn't been ported
> to 3.0, but then again wxWidgets 2.8 won't work with GTK/quartz
> without quite a bit of patching).
>
> I wanted to test gnuplot with wxGTK 3.0 on Mac, but it didn't work at
> all because I have it linked against gtk 3.0 and gnuplot fails because
> it has a fixed idea that wxGTK is using GTK+ 2:
>
> if test "${enable_wxwidgets_ok}" = yes ; then
> WX_CXXFLAGS="`$WX_CONFIG --cxxflags | sed 's/-fno-exceptions//'`
> $CAIROPANGO_CFLAGS"
> WX_LIBS="`$WX_CONFIG --libs` $CAIROPANGO_LIBS"
>
> dnl Check for fork(), used for the 'persist' effect
> AC_FUNC_FORK
>
> dnl Check for gtk (raise/lower tweaks)
> PKG_CHECK_MODULES(GTK, [gtk+-2.0], have_gtk=yes, have_gtk=no)
> if test "${have_gtk}" = yes ; then
> AC_DEFINE(HAVE_GTK, 1, [Define to use gtk/gdk tweaks])
> WX_CXXFLAGS="$WX_CXXFLAGS $GTK_CFLAGS"
> WX_LIBS="$WX_LIBS $GTK_LIBS"
> fi
>
> dnl The user can force single-threaded mode
> AC_ARG_WITH(wx-single-threaded, dnl
> [--with-wx-single-threaded do not use multithreaded wxgtk even if
> available],
> WX_CXXFLAGS="$WX_CXXFLAGS -DWXT_MONOTHREADED",~
> )
>
> dnl Check for gtk>2.8 for direct rendering to screen
> PKG_CHECK_MODULES(GTK28, [gtk+-2.0 >= 2.8.0], have_gtk28=yes, have_gtk28=no)
> if test "${have_gtk28}" = yes ; then
> AC_DEFINE(HAVE_GTK28, 1, [Define to use gtk+ functions to handle cairo])
> fi
>
>
> and then the build fails with
>
> In file included from ../../src/wxterminal/wxt_gui.cpp:97:
> In file included from ../../src/wxterminal/wxt_gui.h:183:
> In file included from /opt/local/include/gtk-2.0/gdk/gdk.h:32:
> In file included from /opt/local/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31:
> In file included from /opt/local/include/gtk-2.0/gdk/gdkscreen.h:32:
> /opt/local/include/gtk-2.0/gdk/gdktypes.h:114:39: error: typedef
> redefinition with different types ('struct _GdkDrawable' vs 'struct
> _GdkWindow')
> typedef struct _GdkDrawable GdkWindow;
> ^
> /path/to/wxGTK/3.0/include/wx-3.0/wx/defs.h:3412:31: note: previous
> definition is here
> typedef struct _GdkWindow GdkWindow;
> ^
> 1 error generated.
>
> So please also check whether wxWidgets are using gtk2 or gtk3 before
> calling pkg-config to supply build flags.
That's a chicken-or-egg dilemma.
wx-config is supposed to tell us the version, but we need the version in
order to call the correct wx-config.
I suppose we can add configuration options --with-gtk={ gtk2 | gtk3 }
but that won't make the gtk3 build actually work, because we already
know it doesn't report the correct set of libraries that are needed.
> > The following may be a possible fix, but not tested at all on Linux.
> >
> >
> > Index: configure.in
> > ===================================================================
> > RCS file: /cvsroot/gnuplot/gnuplot/configure.in,v
> > retrieving revision 1.368
> > diff -r1.368 configure.in
> > 1037c1037,1038
> > < if expr ${WXWIDGETS_VERSION} \> 2.8 >/dev/null; then
> > ---
> >> if expr ${WXWIDGETS_VERSION} \> 2.8 >/dev/null && \
> >> ${WX_CONFIG} --basename | grep 'wx_gtk' >/dev/null 2>&1; then
>
> Yes, checking for wx_gtk should help, even though I believe that some
> package (either gtk or wxwidgets) should suggest the proper flag.
But that is exactly the problem!
Yes, gtk and/or wxWidgets should declare what support libraries are
required. That is what `wx-config --libs` is supposed to do.
But it doesn't.
I really am at a loss. I don't see how gnuplot can determine whether
or not wxWidgets requires X11 if it doesn't tell us.
Ethan
|