pkulchenko / wxlua

wxlua: Lua bindings for wxWidgets cross-platform GUI toolkit; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and wxWidgets 3.x
304 stars 59 forks source link

Fails to build with wxwidgets 3.0.4, can not find wx/peninfobase.h #46

Closed hollunder closed 4 years ago

hollunder commented 4 years ago

I have tried to build using the script from AUR: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=wxlua-git Which tries to build it using wxgtk2 as far as I can tell: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/wxgtk

[ 24%] Building CXX object
modules/luamodule/CMakeFiles/wxLuaModule.dir/__/wxbind/src/wxgl_bind.cpp.o
In file included from
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/include/wxgl_bind.h:13,
from
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxgl_bind.cpp:19:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/include/wxcore_bind.h:534:14:
fatal error: wx/peninfobase.h: No such file or directory 534 |
#include "wx/peninfobase.h" |              ^~~~~~~~~~~~~~~~~~
compilation terminated.

You can see how it was built here: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/wxgtk

If there is something wrong with the packages I'll gladly report that and try to get is resolved.

pkulchenko commented 4 years ago

@hollunder, thank you for the report. Can you try the following patch for wxlua:

diff --git a/wxLua/bindings/wxwidgets/wxcore_graphics.i b/wxLua/bindings/wxwidgets/wxcore_graphics.i
index fbe9b6f..1068d03 100644
--- a/wxLua/bindings/wxwidgets/wxcore_graphics.i
+++ b/wxLua/bindings/wxwidgets/wxcore_graphics.i
@@ -16,7 +16,7 @@
 #include "wx/dynarray.h"
 #include "wx/font.h"
 #include "wx/image.h"
-#include "wx/peninfobase.h"
+#include "wx/pen.h"
 #include "wx/vector.h"

 enum wxAntialiasMode
diff --git a/wxLua/modules/wxbind/include/wxcore_bind.h b/wxLua/modules/wxbind/include/wxcore_bind.h
index 7406679..4e3f0a2 100644
--- a/wxLua/modules/wxbind/include/wxcore_bind.h
+++ b/wxLua/modules/wxbind/include/wxcore_bind.h
@@ -531,7 +531,7 @@ extern WXDLLIMPEXP_BINDWXCORE wxLuaBinding* wxLuaBinding_wxcore_init();
     #include "wx/font.h"
     #include "wx/geometry.h"
     #include "wx/image.h"
-    #include "wx/peninfobase.h"
+    #include "wx/pen.h"
     #include "wx/vector.h"
 #endif // wxUSE_GRAPHICS_CONTEXT

I expect it to fix the issue.

hollunder commented 4 years ago

Hi Paul, I did a quick check and it seems it wasn't quite enough. There is the possibility I made a mistake though, will have to try again when I have more time.

[ 41%] Building CXX object modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxcore_graphics.cpp.o
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_GetWidth(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:161:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  161 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:161:25: error: ‘self’ was not declared in this scope
  161 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |                         ^~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:161:52: error: expected primary-expression before ‘)’ token
  161 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |                                                    ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_Width(lua_State* ’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:179:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  179 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:179:25: error: ‘self’ was not declared in this scope
  179 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |                         ^~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:179:52: error: expected primary-expression before ‘)’ token
  179 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |                                                    ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:181:24: error: ‘returns’ was not declared in this scope; did you mean ‘setns’?
  181 |     wxGraphicsPenInfo* returns = (wxGraphicsPenInfo*)&self->Width(width);
      |                        ^~~~~~~
      |                        setns
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:181:53: error: expected primary-expression before ‘)’ token
  181 |     wxGraphicsPenInfo* returns = (wxGraphicsPenInfo*)&self->Width(width);
      |                                                     ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_constructor1(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:208:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  208 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo(*colour, width, style);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:208:24: error: ‘returns’ was not declared in this scope; did you mean ‘setns’?
  208 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo(*colour, width, style);
      |                        ^~~~~~~
      |                        setns
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:208:38: error: expected type-specifier before ‘wxGraphicsPenInfo’
  208 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo(*colour, width, style);
      |                                      ^~~~~~~~~~~~~~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_constructor(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:225:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  225 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo();
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:225:24: error: ‘returns’ was not declared in this scope; did you mean ‘setns’?
  225 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo();
      |                        ^~~~~~~
      |                        setns
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:225:38: error: expected type-specifier before ‘wxGraphicsPenInfo’
  225 |     wxGraphicsPenInfo* returns = new wxGraphicsPenInfo();
      |                                      ^~~~~~~~~~~~~~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘void wxLua_wxGraphicsPenInfo_delete_function(void**)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:253:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  253 |     wxGraphicsPenInfo* o = (wxGraphicsPenInfo*)(*p);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:253:24: error: ‘o’ was not declared in this scope
  253 |     wxGraphicsPenInfo* o = (wxGraphicsPenInfo*)(*p);
      |                        ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:253:47: error: expected primary-expression before ‘)’ token
  253 |     wxGraphicsPenInfo* o = (wxGraphicsPenInfo*)(*p);
      |                                               ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:254:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
  254 |     delete o;
      |            ^
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsContext_ClearRectangle(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:1965:11: error: ‘class wxGraphicsContext’ has no member named ‘ClearRectangle’; did you mean ‘DrawRectangle’?
 1965 |     self->ClearRectangle(x, y, w, h);
      |           ^~~~~~~~~~~~~~
      |           DrawRectangle
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsContext_CreateFromUnknownDC(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:2333:73: error: ‘CreateFromUnknownDC’ is not a member of ‘wxGraphicsContext’
 2333 |     wxGraphicsContext* returns = (wxGraphicsContext*)wxGraphicsContext::CreateFromUnknownDC(*dc);
      |                                                                         ^~~~~~~~~~~~~~~~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsContext_CreatePen1(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:2466:11: error: ‘wxGraphicsPenInfo’ does not name a type; did you mean ‘wxGraphicsPen’?
 2466 |     const wxGraphicsPenInfo * info = (const wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 2, wxluatype_wxGraphicsPenInfo);
      |           ^~~~~~~~~~~~~~~~~
      |           wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:2471:65: error: ‘info’ was not declared in this scope; did you mean ‘dlinfo’?
 2471 |     wxGraphicsPen* returns = new wxGraphicsPen(self->CreatePen(*info));
      |                                                                 ^~~~
      |                                                                 dlinfo
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsContext_GetClipBox(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:3057:11: error: ‘class wxGraphicsContext’ has no member named ‘GetClipBox’
 3057 |     self->GetClipBox(x, y, w, h);
      |           ^~~~~~~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsRenderer_CreatePen(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:4306:11: error: ‘wxGraphicsPenInfo’ does not name a type; did you mean ‘wxGraphicsPen’?
 4306 |     const wxGraphicsPenInfo * info = (const wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 2, wxluatype_wxGraphicsPenInfo);
      |           ^~~~~~~~~~~~~~~~~
      |           wxGraphicsPen
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:4311:65: error: ‘info’ was not declared in this scope; did you mean ‘dlinfo’?
 4311 |     wxGraphicsPen* returns = new wxGraphicsPen(self->CreatePen(*info));
      |                                                                 ^~~~
      |                                                                 dlinfo
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsRenderer_GetName(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:4415:31: error: ‘class wxGraphicsRenderer’ has no member named ‘GetName’
 4415 |     wxString returns = (self->GetName());
      |                               ^~~~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsRenderer_GetVersion(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:4439:11: error: ‘class wxGraphicsRenderer’ has no member named ‘GetVersion’
 4439 |     self->GetVersion(major, minor, micro);
      |           ^~~~~~~~~~
make[2]: *** [modules/wxbind/CMakeFiles/wxLuaBindLib.dir/build.make:284: modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxcore_graphics.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:276: modules/wxbind/CMakeFiles/wxLuaBindLib.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
hollunder commented 4 years ago

OK, I managed to patch it properly now (had trouble in the morning and edited manually). However, the same build failures occur.

[ 44%] Building CXX object modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_GetWidth(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:161:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  161 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
...

and

[ 53%] Building CXX object modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxcore_help.cpp.o
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp: In function ‘int wxLua_wxGraphicsPenInfo_GetWidth(lua_State*)’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/wxbind/src/wxcore_graphics.cpp:161:5: error: ‘wxGraphicsPenInfo’ was not declared in this scope; did you mean ‘wxGraphicsPen’?
  161 |     wxGraphicsPenInfo * self = (wxGraphicsPenInfo *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsPenInfo);
      |     ^~~~~~~~~~~~~~~~~
      |     wxGraphicsPen
...
pkulchenko commented 4 years ago

@hollunder, I found several more instances that need to be updated, as the methods used didn't exist in v3.0.4. I pushed an update to the master branch and tested by compiling with 3.0.4. Let me know if you still get errors with it. Thanks!

hollunder commented 4 years ago

Thanks Paul, master builds now. Arch defaults to 3.0.4 because it is the latest stable release. They only ship dev releases when there is a very good reason to do so. For completeness sake the two compiler warnings I got:

/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/lauxlib.c: In function ‘luaL_loadfile’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/lauxlib.c:577:4: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
  577 |    while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
      |    ^~~~~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/lauxlib.c:578:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
  578 |     lf.extraline = 0;
      |     ^~

and

/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/ltablib.c: In function ‘addfield’:
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/ltablib.c:137:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  137 |   if (!lua_isstring(L, -1))
      |   ^~
/home/murks/.cache/aurman/wxlua-git/src/wxlua/wxLua/modules/lua-5.1/src/ltablib.c:140:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  140 |     luaL_addvalue(b);
      |     ^~~~~~~~~~~~~

Thanks for your efforts to keep zbstudio and all the various dependencies in their various versions working.

pkulchenko commented 4 years ago

Thanks Paul, master builds now.

Good; thank you for the confirmation.

Arch defaults to 3.0.4 because it is the latest stable release. They only ship dev releases when there is a very good reason to do so.

Yes, 3.0.4 is the latest release in the non dev (3.even) branch, so it's a reasonable approach.

For completeness sake the two compiler warnings I got:

These are the Lua warnings, so not much I can do about. I'll be keeping bundled Lua 5.1 and 5.2 in wxlua, but don't plan to include Lua 5.3 or 5.4, as you can configure wxlua to use external libraries.

Thanks for your efforts to keep zbstudio and all the various dependencies in their various versions working.

Yes, I do run periodic tests on older versions of wxwidgets (than those shipped with ZeroBraneStudio), but let me know if you run into any issues with those.