Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build errors #380

Merged
merged 1 commit into from Feb 2, 2022
Merged

Fix build errors #380

merged 1 commit into from Feb 2, 2022

Conversation

diath
Copy link
Contributor

@diath diath commented Jan 26, 2022

  • Updated the minimum required CMake version.
  • Updated the minimum required C++ standard version to match the
    functions used in the code base.
  • Added missing public visibility specifier for classes deriving from
    wxEvtHandler (DatDebugView and MainMenuBar) that is required to
    access the event table from the derived classes.
  • Fixed a typo in the MainMenuBar code (REPLACE_ITEM =>
    REPLACE_ITEMS).
  • Added missing ZLIB search to the CMake project (previously it was
    implicitly linked by older wxWidgets versions?).
  • Fixed GLUT compatibility with newer CMake version.
  • Added a new FROM_DIP macro that fixes wxSize scaling compatibility
    with wxWidgets <3.1.0.
  • Fixed catching std::bad_cast exceptions by value instead of const
    ref.

Closes #329.
Closes #345.
Closes #371.
Closes #373.
Closes #375.

@o7-machinehum
Copy link

o7-machinehum commented Jan 27, 2022

Thanks for this PR, I assume you're after the bounty I've posted. I am still having some issues building.

[machinehum@whitebox rme]$ cd build/
[machinehum@whitebox build]$ cmake ../ -D wxWidgets_CONFIG_EXECUTABLE:FILEPATH=/bin/wx-config-gtk3 ;
CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:315 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found ZLIB: /usr/lib/libz.so (found version "1.2.11") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/machinehum/projects/rme_fix/rme/build
[machinehum@whitebox build]$ make -j $(nproc)
Consolidate compiler generated dependencies of target rme
[  1%] Building CXX object CMakeFiles/rme.dir/source/application.cpp.o
[  2%] Building CXX object CMakeFiles/rme.dir/source/about_window.cpp.o
[  3%] Building CXX object CMakeFiles/rme.dir/source/action.cpp.o
[  4%] Building CXX object CMakeFiles/rme.dir/source/artprovider.cpp.o
[  5%] Building CXX object CMakeFiles/rme.dir/source/brush.cpp.o
[  6%] Building CXX object CMakeFiles/rme.dir/source/basemap.cpp.o
In file included from /usr/include/wx-3.0/wx/wx.h:24,
                 from /home/machinehum/projects/rme_fix/rme/source/main.h:59,
                 from /home/machinehum/projects/rme_fix/rme/source/application.cpp:18:
/home/machinehum/projects/rme_fix/rme/source/gui.h:66:32: warning: cast between incompatible pointer to member types from ‘void (wxEvtHandler::*)(wxCommandEvent&)’ to ‘wxEventFunction’ {aka ‘void (wxEvtHandler::*)(wxEvent&)’} [-Wcast-function-type]
   66 |         (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \
/home/machinehum/projects/rme_fix/rme/source/application.cpp:53:9: note: in expansion of macro ‘EVT_ON_UPDATE_MENUS’
   53 |         EVT_ON_UPDATE_MENUS(wxID_ANY, MainFrame::OnUpdateMenus)
      |         ^~~~~~~~~~~~~~~~~~~
[  7%] Building CXX object CMakeFiles/rme.dir/source/brush_tables.cpp.o
[  8%] Building CXX object CMakeFiles/rme.dir/source/browse_tile_window.cpp.o
[  9%] Building CXX object CMakeFiles/rme.dir/source/positionctrl.cpp.o
[ 10%] Building CXX object CMakeFiles/rme.dir/source/carpet_brush.cpp.o
[ 11%] Building CXX object CMakeFiles/rme.dir/source/client_version.cpp.o
[ 12%] Building CXX object CMakeFiles/rme.dir/source/common.cpp.o
[ 13%] Building CXX object CMakeFiles/rme.dir/source/common_windows.cpp.o
[ 14%] Building CXX object CMakeFiles/rme.dir/source/complexitem.cpp.o
[ 15%] Building CXX object CMakeFiles/rme.dir/source/container_properties_window.cpp.o
[ 16%] Building CXX object CMakeFiles/rme.dir/source/copybuffer.cpp.o
[ 17%] Building CXX object CMakeFiles/rme.dir/source/creature_brush.cpp.o
[ 18%] Building CXX object CMakeFiles/rme.dir/source/creature.cpp.o
[ 19%] Building CXX object CMakeFiles/rme.dir/source/creatures.cpp.o
[ 20%] Building CXX object CMakeFiles/rme.dir/source/dat_debug_view.cpp.o
[ 21%] Building CXX object CMakeFiles/rme.dir/source/dcbutton.cpp.o
[ 22%] Building CXX object CMakeFiles/rme.dir/source/doodad_brush.cpp.o
[ 23%] Building CXX object CMakeFiles/rme.dir/source/editor.cpp.o
[ 25%] Building CXX object CMakeFiles/rme.dir/source/editor_tabs.cpp.o
[ 26%] Building CXX object CMakeFiles/rme.dir/source/eraser_brush.cpp.o
[ 27%] Building CXX object CMakeFiles/rme.dir/source/extension.cpp.o
[ 28%] Building CXX object CMakeFiles/rme.dir/source/extension_window.cpp.o
[ 29%] Building CXX object CMakeFiles/rme.dir/source/find_item_window.cpp.o
[ 30%] Building CXX object CMakeFiles/rme.dir/source/filehandle.cpp.o
[ 31%] Building CXX object CMakeFiles/rme.dir/source/graphics.cpp.o
[ 32%] Building CXX object CMakeFiles/rme.dir/source/ground_brush.cpp.o
[ 33%] Building CXX object CMakeFiles/rme.dir/source/gui.cpp.o
[ 34%] Building CXX object CMakeFiles/rme.dir/source/house_brush.cpp.o
[ 35%] Building CXX object CMakeFiles/rme.dir/source/house.cpp.o
[ 36%] Building CXX object CMakeFiles/rme.dir/source/house_exit_brush.cpp.o
/home/machinehum/projects/rme_fix/rme/source/house.cpp: In member function ‘void Houses::addHouse(House*)’:
/home/machinehum/projects/rme_fix/rme/source/house.cpp:46:28: warning: variable ‘it’ set but not used [-Wunused-but-set-variable]
   46 |         HouseMap::iterator it = houses.find(new_house->id);
      |                            ^~
[ 37%] Building CXX object CMakeFiles/rme.dir/source/iomap.cpp.o
[ 38%] Building CXX object CMakeFiles/rme.dir/source/iomap_otbm.cpp.o
[ 39%] Building CXX object CMakeFiles/rme.dir/source/item_attributes.cpp.o
[ 40%] Building CXX object CMakeFiles/rme.dir/source/item.cpp.o
[ 41%] Building CXX object CMakeFiles/rme.dir/source/items.cpp.o
[ 42%] Building CXX object CMakeFiles/rme.dir/source/live_action.cpp.o
[ 43%] Building CXX object CMakeFiles/rme.dir/source/live_client.cpp.o
/home/machinehum/projects/rme_fix/rme/source/item_attributes.cpp: In member function ‘bool ItemAttribute::unserialize(const IOMap&, BinaryNode*)’:
/home/machinehum/projects/rme_fix/rme/source/item_attributes.cpp:340:9: warning: ‘rtype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  340 |         switch(rtype) {
      |         ^~~~~~
[ 44%] Building CXX object CMakeFiles/rme.dir/source/live_peer.cpp.o
[ 45%] Building CXX object CMakeFiles/rme.dir/source/live_server.cpp.o
[ 46%] Building CXX object CMakeFiles/rme.dir/source/live_socket.cpp.o
[ 47%] Building CXX object CMakeFiles/rme.dir/source/live_tab.cpp.o
[ 48%] Building CXX object CMakeFiles/rme.dir/source/main_menubar.cpp.o
/home/machinehum/projects/rme_fix/rme/source/live_socket.cpp: In member function ‘Tile* LiveSocket::readTile(BinaryNode*, Editor&, const Position*)’:
/home/machinehum/projects/rme_fix/rme/source/live_socket.cpp:310:52: warning: ‘z’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  310 |                 uint8_t z; node->getU8(z); pos.z = z;
      |                                                    ^
/home/machinehum/projects/rme_fix/rme/source/live_socket.cpp:309:54: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  309 |                 uint16_t y; node->getU16(y); pos.y = y;
      |                                                      ^
/home/machinehum/projects/rme_fix/rme/source/live_socket.cpp:308:54: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  308 |                 uint16_t x; node->getU16(x); pos.x = x;
      |                                                      ^
/home/machinehum/projects/rme_fix/rme/source/live_socket.cpp:300:34: warning: ‘tileType’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  300 |         if(tileType != OTBM_TILE && tileType != OTBM_HOUSETILE) {
      |            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/machinehum/projects/rme_fix/rme/source/main_menubar.cpp: In constructor ‘MainMenuBar::MainMenuBar(MainFrame*)’:
/home/machinehum/projects/rme_fix/rme/source/main_menubar.cpp:210:48: warning: cast between incompatible pointer to member types from ‘wxCommandEventFunction’ {aka ‘void (wxEvtHandler::*)(wxCommandEvent&)’} to ‘wxEventFunction’ {aka ‘void (wxEvtHandler::*)(wxEvent&)’} [-Wcast-function-type]
  210 |                         (wxObjectEventFunction)(wxEventFunction)(ai->second->handler), nullptr, this);
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 50%] Building CXX object CMakeFiles/rme.dir/source/main_toolbar.cpp.o
[ 51%] Building CXX object CMakeFiles/rme.dir/source/map.cpp.o
[ 52%] Building CXX object CMakeFiles/rme.dir/source/map_display.cpp.o
[ 53%] Building CXX object CMakeFiles/rme.dir/source/map_drawer.cpp.o
[ 54%] Building CXX object CMakeFiles/rme.dir/source/map_region.cpp.o
[ 55%] Building CXX object CMakeFiles/rme.dir/source/map_tab.cpp.o
[ 56%] Building CXX object CMakeFiles/rme.dir/source/map_window.cpp.o
[ 57%] Building CXX object CMakeFiles/rme.dir/source/materials.cpp.o
[ 58%] Building CXX object CMakeFiles/rme.dir/source/minimap_window.cpp.o
[ 59%] Building CXX object CMakeFiles/rme.dir/source/mkpch.cpp.o
[ 60%] Building CXX object CMakeFiles/rme.dir/source/mt_rand.cpp.o
[ 61%] Building CXX object CMakeFiles/rme.dir/source/net_connection.cpp.o
[ 62%] Building CXX object CMakeFiles/rme.dir/source/numbertextctrl.cpp.o
[ 63%] Building CXX object CMakeFiles/rme.dir/source/old_properties_window.cpp.o
[ 64%] Building CXX object CMakeFiles/rme.dir/source/palette_brushlist.cpp.o
[ 65%] Building CXX object CMakeFiles/rme.dir/source/palette_common.cpp.o
[ 66%] Building CXX object CMakeFiles/rme.dir/source/palette_creature.cpp.o
[ 67%] Building CXX object CMakeFiles/rme.dir/source/palette_house.cpp.o
[ 68%] Building CXX object CMakeFiles/rme.dir/source/palette_waypoints.cpp.o
[ 69%] Building CXX object CMakeFiles/rme.dir/source/palette_window.cpp.o
[ 70%] Building CXX object CMakeFiles/rme.dir/source/pngfiles.cpp.o
[ 71%] Building CXX object CMakeFiles/rme.dir/source/preferences.cpp.o
[ 72%] Building CXX object CMakeFiles/rme.dir/source/process_com.cpp.o
[ 73%] Building CXX object CMakeFiles/rme.dir/source/properties_window.cpp.o
[ 75%] Building CXX object CMakeFiles/rme.dir/source/raw_brush.cpp.o
/home/machinehum/projects/rme_fix/rme/source/preferences.cpp: In member function ‘wxNotebookPage* PreferencesWindow::CreateClientPage()’:
/home/machinehum/projects/rme_fix/rme/source/preferences.cpp:518:40: error: ‘FromDIP’ was not declared in this scope
  518 |         client_list_window->SetMinSize(FromDIP(wxSize(450, 450)));
      |                                        ^~~~~~~
make[2]: *** [CMakeFiles/rme.dir/build.make:1028: CMakeFiles/rme.dir/source/preferences.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rme.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
[machinehum@whitebox build]$ git branch
* build_fixes
  master
[machinehum@whitebox build]$ git remote -v
origin	git@github.com:diath/rme.git (fetch)
origin	git@github.com:diath/rme.git (push)
[machinehum@whitebox build]$ 

- Updated the minimum required CMake version.
- Updated the minimum required C++ standard version to match the
  functions used in the code base.
- Added missing `public` visibility specifier for classes deriving from
  wxEvtHandler (DatDebugView and MainMenuBar) that is required to
  access the event table from the derived classes.
- Fixed a typo in the MainMenuBar code (`REPLACE_ITEM` =>
  `REPLACE_ITEMS`).
- Added missing ZLIB search to the CMake project (previously it was
  implicitly linked by older wxWidgets versions?).
- Fixed GLUT compatibility with newer CMake version.
- Added a new `FROM_DIP` macro that fixes wxSize scaling compatibility
  with wxWidgets <3.1.0.
- Fixed catching std::bad_cast exceptions by value instead of const
  ref.

Closes hampusborgos#329.
Closes hampusborgos#345.
Closes hampusborgos#371.
Closes hampusborgos#373.
Closes hampusborgos#375.
@diath
Copy link
Contributor Author

diath commented Jan 27, 2022

Looks like I forgot to replace the function call after adding the macro in a few places and didn't catch it because it works on newer wxWidgets version, you can try again.

@o7-machinehum
Copy link

Builds fine and I've been using the software for the last few hours, no issues so far. @diath this is enough to claim the bounty and hopefully, @hampusborgos can merge this PR when he gets the chance :)

@EPuncker
Copy link
Contributor

more luck having @Mignari or @Elime1 to merge it, than remere :D

@o7-machinehum
Copy link

@diath I've been using the software for 3 days now - you've fixed the issue, are you going to claim the bounty on bountysource?

@diath
Copy link
Contributor Author

diath commented Feb 1, 2022

@Machine-Hum Unfortunately there's a bug going on with Bountysource that doesn't allow me to submit a solution (I'm getting an internal server error in response) and the ticket is stuck at:

Please apologize for that unusual situation. I immediately transmit it to our technical team.
I get back to you as soon as I receive a response.

@Mignari Mignari merged commit 8bf57e3 into hampusborgos:master Feb 2, 2022
@diath diath deleted the build_fixes branch February 3, 2022 21:41
dex-89 added a commit to dex-89/OTACADEMY-RME that referenced this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants