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
306 stars 59 forks source link

Build fails on macOS Monterey (12.4) #110

Closed acisternino closed 2 years ago

acisternino commented 2 years ago

Hi,

I am trying to build wxLua on macOS Monterey (v12.4 Intel) but the build fails with this ouput:

$ cd /Users/foo/dev/wxlua

< configure and generate >

$ make VERBOSE=1 -C build
...
[ 34%] Building CXX object modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o
cd /Users/foo/dev/wxlua/build/modules/wxbind && /Library/Developer/CommandLineTools/usr/bin/c++ -DLUA_COMPAT_ALL -DWXMAKINGDLL_WXBIND -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX_COCOA__ -D__WXOSX__ -DwxLUA_USEBINDING_WXADV=1 -DwxLUA_USEBINDING_WXAUI=1 -DwxLUA_USEBINDING_WXBASE=1 -DwxLUA_USEBINDING_WXCORE=1 -DwxLUA_USEBINDING_WXGL=1 -DwxLUA_USEBINDING_WXHTML=1 -DwxLUA_USEBINDING_WXMEDIA=1 -DwxLUA_USEBINDING_WXNET=1 -DwxLUA_USEBINDING_WXPROPGRID=0 -DwxLUA_USEBINDING_WXRICHTEXT=1 -DwxLUA_USEBINDING_WXSTC=1 -DwxLUA_USEBINDING_WXWEBVIEW=0 -DwxLUA_USEBINDING_WXXML=1 -DwxLUA_USEBINDING_WXXRC=1 -I/Users/foo/dev/wxlua/wxLua/modules/wxbind/setup -I/Users/foo/dev/wxlua/wxLua -I/Users/foo/dev/wxlua/wxLua/modules -I/Users/foo/dev/wxlua/wxLua/modules/lua-5.2/src -isystem /usr/local/lib/wx/include/osx_cocoa-unicode-3.1 -isystem /usr/local/include/wx-3.1 -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -fPIC -MD -MT modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o -MF CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o.d -o CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o -c /Users/foo/dev/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp
/Users/foo/dev/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:381:48: error: taking the address of a temporary object of type 'wxBitmap' [-Waddress-of-temporary]
    const wxBitmap* returns = (const wxBitmap*)&self->GetBitmap();
                                               ^~~~~~~~~~~~~~~~~~
/Users/foo/dev/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:397:48: error: taking the address of a temporary object of type 'wxBitmap' [-Waddress-of-temporary]
    const wxBitmap* returns = (const wxBitmap*)&self->GetDisabledBitmap();
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/foo/dev/wxlua/wxLua/modules/wxbind/src/wxaui_bind.cpp:413:48: error: taking the address of a temporary object of type 'wxBitmap' [-Waddress-of-temporary]
    const wxBitmap* returns = (const wxBitmap*)&self->GetHoverBitmap();
                                               ^~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
make[2]: *** [modules/wxbind/CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o] Error 1
make[1]: *** [modules/wxbind/CMakeFiles/wxLuaBindLib.dir/all] Error 2
make: *** [all] Error 2

This is the compiler I am using (the default):

12:01 $ /Library/Developer/CommandLineTools/usr/bin/c++ --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

wxWidgets is installed with Homebrew and is v3.1.7.

I am using Lua v5.2 embedded in wxLua.

pkulchenko commented 2 years ago

@acisternino, can you test on the current master? I just merged some of the changes that were in the works and should address this issue.

acisternino commented 2 years ago

Thanks @pkulchenko ! I'll be able to do that tomorrow morning. I'll report on the result as soon as I am done.

acisternino commented 2 years ago

Hi @pkulchenko,

The error above seems to be gone (:thumbsup:) but now the build fails a bit farther ahead:

[ 53%] Linking CXX shared library ../../lib/Debug/libwxlua_bind-wx31osx_cocoaud-3.1.0.0.dylib
cd /Users/foo/dev/wxlua/build/modules/wxbind && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/wxLuaBindLib.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -dynamiclib -Wl,-headerpad_max_install_names -o ../../lib/Debug/libwxlua_bind-wx31osx_cocoaud-3.1.0.0.dylib -install_name /Users/foo/dev/wxlua/build/lib/Debug/libwxlua_bind-wx31osx_cocoaud-3.1.0.0.dylib CMakeFiles/wxLuaBindLib.dir/src/wxgl_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxstc_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxxrc_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxrichtext_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxhtml_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxhtml_wxlhtml.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxmedia_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxaui_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxadv_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxadv_wxladv.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_appframe.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_clipdrag.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_controls.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_core.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_defsutils.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_dialogs.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_event.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_gdi.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_geometry.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_graphics.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_help.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_image.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_mdi.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_menutool.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_picker.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_print.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_sizer.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_windows.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxcore_wxlcore.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxxml_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxnet_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_base.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_bind.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_config.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_data.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_datetime.cpp.o CMakeFiles/wxLuaBindLib.dir/src/wxbase_file.cpp.o   -L/usr/local/lib  -Wl,-rpath,/usr/local/lib ../../lib/Debug/libwxlua-wx31osx_cocoaud-3.1.0.0.dylib ../../lib/Debug/libwxlua_lua52-wx31osx_cocoaud-3.1.0.0.dylib -lm -lreadline -L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_gl-3.1 -lwx_osx_cocoau_xrc-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_osx_cocoau_media-3.1 -lwx_osx_cocoau_richtext-3.1 -lwx_osx_cocoau_aui-3.1 -lwx_osx_cocoau_stc-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu-3.1
Undefined symbols for architecture x86_64:
  "wxPluralFormsCalculatorPtr::~wxPluralFormsCalculatorPtr()", referenced from:
      wxMsgCatalog::~wxMsgCatalog() in wxbase_base.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/Debug/libwxlua_bind-wx31osx_cocoaud-3.1.0.0.dylib] Error 1
make[1]: *** [modules/wxbind/CMakeFiles/wxLuaBindLib.dir/all] Error 2
make: *** [all] Error 2
acisternino commented 2 years ago

I have just realized that Homebrew has already updated wxWidgets to v3.2.0.

I think we can close this issue and eventually open a new one if something fails with the new stable version.

pkulchenko commented 2 years ago

Sounds good. You can still build with wxwidgets 3.1.x if you want, but you'll have to specify -DwxLUA_USE_wxTranslations=0 per discussion and fix applied in https://github.com/pkulchenko/wxlua/issues/80#issuecomment-744115395.

Mailaender commented 2 years ago

As #80 references a series of patches, can you tag a new release that builds? I tried wxLua 3.1.0.0 with various version of wxWidgets 3.x and nothing compiles. Is https://github.com/pkulchenko/wxlua/blob/master/wxLua/docs/install.md still up-to-date?

pkulchenko commented 2 years ago

@Mailaender, does everything build for you correctly with the master branch? There is a small issue with macOS that may require using -DwxLUA_USE_wxTranslations=0, so I'm considering to set it by default. Everything else have been incorporated.

pkulchenko commented 2 years ago

@Mailaender, I've released v3.2.0.0, which should work with wxwidgets 3.1.4, 3.2, and the current master branch. Let me know if you get a chance to try it and run into any issues.