wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.23k stars 510 forks source link

Installing wxPython 4.1.2 on OpenSuSE 15.5 ends with missing wx/setup.h file #2422

Open JacekRuzyczka opened 11 months ago

JacekRuzyczka commented 11 months ago

OpenSuSE 15.5 Linux (x86_64): 4.2.1 via PyPi: 3.11.2-150400.9.5.3 via official OpenSuSE repo:

File wx/setup.h missing when trying to install wxPython by using pip (despite being installed on my machine)

Command: `pip wheel -v wxPython-4.2.1.tar.gz 2>&1 | tee build.log` Error message: ``` Finished command: build_wx (1m21.690s) Running command: build_py Checking for /tmp/pip-req-build-2qaqrik2/bin/waf-2.0.24... "/usr/bin/python3.11" /tmp/pip-req-build-2qaqrik2/bin/waf-2.0.24 --wx_config=/tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/bin/python3.11" --out=build/waf/3.11/gtk3 configure build Setting top to : /tmp/pip-req-build-2qaqrik2 Setting out to : /tmp/pip-req-build-2qaqrik2/build/waf/3.11/gtk3 Checking for 'gcc' (C compiler) : /usr/bin/gcc Checking for 'g++' (C++ compiler) : /usr/bin/g++ Checking for program 'python' : /usr/bin/python3.11 Checking for python version >= 3.7.0 : 3.11.2 python-config : /usr/bin/python3.11-config Asking python-config for pyext '--cflags --libs --ldflags' flags : yes Testing pyext configuration : yes Finding libs for WX : yes Finding libs for WXADV : yes Finding libs for WXSTC : yes Finding libs for WXHTML : yes WARNING: Unable to find setup.h in /tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.2, assuming wxUSE_GLCANVAS is not available. Finding libs for WXGL : yes WARNING: Unable to find setup.h in /tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.2, assuming wxUSE_WEBVIEW is not available. Finding libs for WXWEBVIEW : yes Finding libs for WXXML : yes Finding libs for WXXRC : yes Finding libs for WXRICHTEXT : yes WARNING: Unable to find setup.h in /tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.2, assuming wxUSE_MEDIACTRL is not available. Finding libs for WXMEDIA : yes Finding libs for WXRIBBON : yes Finding libs for WXPROPGRID : yes Finding libs for WXAUI : yes 'configure' finished successfully (1.002s) Waf: Entering directory `/tmp/pip-req-build-2qaqrik2/build/waf/3.11/gtk3' **** Compiler: gcc --version gcc (SUSE Linux) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [ 1/939] Compiling sip/siplib/sip_array.c [ 2/939] Compiling sip/siplib/descriptors.c [ 3/939] Compiling sip/siplib/apiversions.c [ 4/939] Compiling sip/siplib/qtlib.c [ 5/939] Compiling sip/siplib/voidptr.c [ 6/939] Compiling sip/siplib/objmap.c [ 7/939] Compiling sip/siplib/bool.cpp [ 8/939] Compiling sip/siplib/threads.c [ 9/939] Compiling sip/siplib/int_convertors.c [ 10/939] Compiling sip/siplib/siplib.c [ 11/939] Compiling sip/cpp/sip_corewxZoomGestureEvent.cpp In file included from ../../../../ext/wxWidgets/include/wx/defs.h:45:0, from ../../../../ext/wxWidgets/include/wx/wx.h:14, from ../../../../wx/include/wxPython/wxpy_api.h:41, from ../../../../sip/cpp/sipAPI_core.h:22068, from ../../../../sip/cpp/sip_corewxZoomGestureEvent.cpp:10: ../../../../ext/wxWidgets/include/wx/platform.h:159:10: fatal error: wx/setup.h: Datei oder Verzeichnis nicht gefunden #include "wx/setup.h" ^~~~~~~~~~~~ compilation terminated. ``` The problem is: I do have a `platform.h` on my machine in the `/usr/include/wx-3.1/wx` folder and a `setup.h` at `/usr/lib64/wx/include/gtk2-unicode-3.1/wx`, but linking it into `/usr/include/wx-3.1/wx` did NOT help. On the other hand, I can't find `/tmp/pip-req-build-2qaqrik2` anywhere on my machine, which seems contradictory.
swt2c commented 11 months ago

By default, wxPython builds its own copy of wxWidgets, so it should not use your system copy.

Is this the entirety of the log? What happened before Finished command: build_wx (1m21.690s)? That's suspicious because it should take longer than 82 seconds..

JacekRuzyczka commented 11 months ago

Does this mean that the necessary wx/setup.h must be added to the wxPython-4.2.1.tar.gz package before starting the build? I've just tried that out, but no use: The "fatal error" disappears, but the three warnings about the missing setup.h at /tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.2 persist, and a new error message appears:

../../../../ext/wxWidgets/include/wx/chkconf.h:287:9: error: #error "wxUSE_SPELLCHECK must be defined, please read comment near the top of this file."

The package does contain three files with settings or setup in their respective names, though:

image

Please find attached the complete build log.

build.log

swt2c commented 11 months ago

I think the issue might be two mismatched libdirs. If you look at your build.log, the setup.h seems to be being created in lib:

config.status: creating lib/wx/include/gtk3-unicode-3.2/wx/setup.h

However, wxPython then tries to find it in lib64:

WARNING: Unable to find setup.h in /tmp/pip-req-build-2qaqrik2/build/wxbld/gtk3/lib64/wx/include/gtk3-unicode-3.2, assuming wxUSE_GLCANVAS is not available.

I am not sure what to do about it, though. I think the issue might be with wxWidgets' wx-config script.

swt2c commented 11 months ago

See #1067, it seems to be the same issue. You might be able to do a hacky workaround by symlinking lib64 to lib while wxWidgets is building.

JacekRuzyczka commented 11 months ago

So the issue has been existing for five years and hasn't been resolved yet…?

swt2c commented 11 months ago

So the issue has been existing for five years and hasn't been resolved yet…?

Unfortunately, yes. As with many projects, the number of bugs approaches infinity, while the number of active developers approaches zero. I did try again to reproduce the problem yesterday, but I was unable to. So, it seems we need to figure out the difference.

JacekRuzyczka commented 11 months ago

:-/

I've managed to implant the missing #define wxUSE_SPELLCHECK 0 into the setup.h file, but now I'm stumbling upon a bunch of even stranger error messages, which imply an inconsistency in the C sources:

  In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:30:0,
                   from /usr/include/gtk-3.0/gdk/gdk.h:32,
                   from /usr/include/gtk-3.0/gdk/gdkx.h:28,
                   from ../../../../sip/cpp/sip_corewxWindow.cpp:48:
  /usr/include/gtk-3.0/gdk/gdktypes.h:143:39: error: conflicting declaration ‘typedef struct _GdkWindow GdkWindow’
   typedef struct _GdkWindow             GdkWindow;
                                         ^~~~~~~~~
  In file included from ../../../../ext/wxWidgets/include/wx/wx.h:14:0,
                   from ../../../../wx/include/wxPython/wxpy_api.h:41,
                   from ../../../../sip/cpp/sipAPI_core.h:22068,
                   from ../../../../sip/cpp/sip_corewxWindow.cpp:10:
  ../../../../ext/wxWidgets/include/wx/defs.h:3146:33: note: previous declaration as ‘typedef struct _GdkDrawable GdkWindow’
       typedef struct _GdkDrawable GdkWindow;
                                   ^~~~~~~~~
  ../../../../sip/cpp/sip_corewxWindow.cpp: In function ‘wxUIntPtr wxPyGetWinHandle(const wxWindow*)’:
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:75: error: ‘GtkWidget {aka struct _GtkWidget}’ has no member named ‘window’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                                                             ^
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:75: note: in definition of macro ‘GetXWindow’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                                                             ^~~~~~
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:35: error: ‘GDK_WINDOW_XWINDOW’ was not declared in this scope
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                     ^
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:35: note: in definition of macro ‘GetXWindow’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                     ^~~~~~~~~~~~~~~~~~
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:35: note: suggested alternative: ‘GDK_WINDOW_XID’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                     ^
  ../../../../sip/cpp/sip_corewxWindow.cpp:66:35: note: in definition of macro ‘GetXWindow’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_wxwindow->window) : \
                                     ^~~~~~~~~~~~~~~~~~
  ../../../../sip/cpp/sip_corewxWindow.cpp:67:73: error: ‘GtkWidget {aka struct _GtkWidget}’ has no member named ‘window’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
                                                                           ^
  ../../../../sip/cpp/sip_corewxWindow.cpp:67:73: note: in definition of macro ‘GetXWindow’
                                     GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
                                                                           ^~~~~~

  Waf: Leaving directory `/tmp/pip-req-build-l5xef92v/build/waf/3.11/gtk3'
  Build failed

This is the part of defs.h in question:

#if defined(__WXGTK3__)
    typedef struct _GdkWindow GdkWindow;
    typedef struct _GdkEventSequence GdkEventSequence;
#elif defined(__WXGTK20__)
    typedef struct _GdkDrawable GdkWindow;
    typedef struct _GdkDrawable GdkPixmap;
#else
    typedef struct _GdkWindow GdkWindow;
    typedef struct _GdkWindow GdkBitmap;
    typedef struct _GdkWindow GdkPixmap;
#endif

Does _GdkWindow inherit from _GdkDrawable? If yes, there will be only a small sourcecode correction necessary, but nobody knows how many mistakes are hidden beyond this blunder.

JacekRuzyczka commented 11 months ago

OK, I've made some advancements with patching wxPython:

  1. The trouble with _GdkWindow seems to disappear after upgrading to version 4.2.1.
  2. I've copied setup_inc.h to setup.h and made numerous patches. See below.
// Recommended setting: 1, setting it to 0 may be useful to avoid dependencies
// on libcurl on Unix systems.
#define wxUSE_WEBREQUEST 0

// Patch for wxPython 4.2.1.
// Added 2023/07/02 by JR.
#define wxUSE_LIBMSPACK         1
#define wxUSE_XTEST             1
#define wxUSE_SELECT_DISPATCHER 1
#define wxHAS_INOTIFY           1

BUT: I've stumbled over a very strange error with the bitmap types of wxWidgets I can't find anywhere on the web:

In file included from ../../../../sip/cpp/sip_corewxZoomGestureEvent.cpp:10:0:
  ../../../../sip/cpp/sipAPI_core.h:22143:9: error: ‘wxNativePixelData’ does not name a type; did you mean ‘sipType_wxNativePixelData’?
   typedef wxNativePixelData::Iterator wxNativePixelData_Accessor;
           ^~~~~~~~~~~~~~~~~
           sipType_wxNativePixelData
  ../../../../sip/cpp/sipAPI_core.h:22144:9: error: ‘wxAlphaPixelData’ does not name a type; did you mean ‘wxFileData’?
   typedef wxAlphaPixelData::Iterator wxAlphaPixelData_Accessor;
           ^~~~~~~~~~~~~~~~
           wxFileData

Adding a line like #include "../../ext/wxWidgets/include/wx/rawbmp.h" at the beginning of sipAPI_core.h did NOT help. Neither did editing lines 22144 & 22145 as suggested by the compiler:

typedef sipType_wxNativePixelData::Iterator sipType_wxNativePixelData_Accessor;
typedef sipType_wxAlphaPixelData::Iterator sipType_wxAlphaPixelData_Accessor;

The types in question are documented here: https://docs.wxwidgets.org/3.0/classwx_pixel_data.html According to the doc, both types, which seem to miss in your code, are implemented on Windows, MacOS X, and Gtk+. So. Why does whis error appear then?

swt2c commented 11 months ago

I hate to say it but I think you're wasting time going down that path. I'd suggest just starting a wxPython install, then while wxWidgets is building, figure out the /tmp directory and symlink lib to lib64 as was done in the other ticket.

JacekRuzyczka commented 11 months ago

@swt2c Just tried it out with a fresh tarball. It was in fact three lib folders I had to link to lib64.

image

The other lib folders lies somewhere under ext and wx, respectively. And:

Building wheel for wxPython (setup.py): finished with status 'done'
  Created wheel for wxPython: filename=wxPython-4.2.1-cp311-cp311-linux_x86_64.whl size=140090452 sha256=2c32e6acb6fded5553ca57d5ece8822b7f2253ff1d35835cada2bbdb4dab6cf9
  Stored in directory: /home/jacek/.cache/pip/wheels/8a/91/cd/81fc9c0ae845eda7af8cde172c55c8503f36d759b88f7b7afe
Successfully built wxPython

╭─jacek@epica ~  
╰─➤  pip install wxPython-4.2.1-cp311-cp311-linux_x86_64.whl
Defaulting to user installation because normal site-packages is not writeable
Processing ./wxPython-4.2.1-cp311-cp311-linux_x86_64.whl
Requirement already satisfied: pillow in ./.local/lib/python3.11/site-packages (from wxPython==4.2.1) (10.0.0)
Requirement already satisfied: six in ./.local/lib/python3.11/site-packages (from wxPython==4.2.1) (1.16.0)
Requirement already satisfied: numpy in ./.local/lib/python3.11/site-packages (from wxPython==4.2.1) (1.25.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.2.1

BUT: Even if the workaround with the lib64 symlinks to lib64 may lead to success, please note that it's unsuitable for productive use, so may someone please (!!!) adjust the build script so that it will create these symlinks automatically. Thank you.

swt2c commented 11 months ago

Yes, I'm not suggesting that's a permanent solution, just a workaround.

As far as fixing the root of the issue, can you please provide the output of cat /etc/os-release and also rpm -qa so that I can try to figure out why I couldn't reproduce this on OpenSuSE 15.5 when I tried.

JacekRuzyczka commented 11 months ago
╭─jacek@epica ~  
╰─➤  cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.5"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.5"
PRETTY_NAME="openSUSE Leap 15.5"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.5"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"

Installed packages see the file attached.

installed_packages.txt

swt2c commented 10 months ago

Thank you for the package list. The good news is that I was able to reproduce it with that information. The problem is reproducible if the python3-wxPython package is installed. Still investigating...it's unclear yet whether the wxPython package itself is causing the problem, or whether it's the wxWidgets packages that get pulled in with it.

swt2c commented 10 months ago

OK, so I lied. This has nothing to do with the python3-wxPython package. In fact, it has to do with the site-config package which gets installed when you install make. The reason I didn't see this right away is that site-config sets environment variables that don't get set until you log out and log back in. This is in fact a wxWidgets bug with the wx-config that gets generated.

swt2c commented 10 months ago

Reported upstream: https://github.com/wxWidgets/wxWidgets/issues/23737