SLADE icon indicating copy to clipboard operation
SLADE copied to clipboard

Cannot build with Cmake due to WX_LIBS on Ubuntu

Open Fifis opened this issue 2 years ago • 1 comments

SLADE Version: (3.1.13) Operating System: (Linux Mint 20.2 / Ubuntu 20.04)

Issue Details: To make sure I have the latest build system and libraries, I compiled and installed Cmake 3.21.3 (3.16 does not work either) and wxWidgets 3.0.5 (GTK3; 3.0.4 does not work for me either).

When I am trying the official instructions (cmake .. -DUSE_WEBKIT_STARTPAGE=ON), the error is

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES) (Required is at
  least version "3.0.4")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindwxWidgets.cmake:1008 (find_package_handle_standard_args)
  src/CMakeLists.txt:62 (find_package)

When cmake . is used, the following error pops up:

-- cotire 1.7.9 loaded.
-- wx-config used is: /usr/local/bin/wx-config
-- wxWidgets version is: 3.0.5
-- gtk version is: 3
CMake Error at /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES) (Required is at
  least version "3.0.5")
Call Stack (most recent call first):
  /usr/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.21/Modules/FindwxWidgets.cmake:1025 (find_package_handle_standard_args)
  src/CMakeLists.txt:62 (find_package)

It can be somewhat remedied by changing src/CMakeLists.txt:

SET(WX_LIBS std aui gl stc richtext propgrid media)
if (NO_WEBVIEW)
	SET(WX_LIBS ${WX_LIBS} html)
else (NO_WEBVIEW)
	SET(WX_LIBS ${WX_LIBS} webview)
	ADD_DEFINITIONS(-DUSE_WEBVIEW_STARTPAGE)
endif (NO_WEBVIEW)
find_package(wxWidgets ${WX_VERSION} COMPONENTS ${WX_LIBS} REQUIRED)

to

SET(wxWidgets_FIND_COMPONENTS std aui gl stc richtext propgrid media)
if (NO_WEBVIEW)
	SET(wxWidgets_FIND_COMPONENTS ${wxWidgets_FIND_COMPONENTS} html)
else (NO_WEBVIEW)
	SET(wxWidgets_FIND_COMPONENTS ${wxWidgets_FIND_COMPONENTS} webview)
	ADD_DEFINITIONS(-DUSE_WEBVIEW_STARTPAGE)
endif (NO_WEBVIEW)
find_package(wxWidgets ${WX_VERSION} COMPONENTS ${wxWidgets_FIND_COMPONENTS})

Unless this fix is applied, it cannot find any wxWidgets.

The cmake command then runs successfully, although not without a hiccup:

-- wx-config used is: /usr/local/bin/wx-config
-- wxWidgets version is: 3.0.5
-- gtk version is: 3
-- Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES) (Required is at least version "3.0.5")
wxWidgets requested but not found.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'gtk+-3.0'
--   Found gtk+-3.0, version 3.24.20
-- Found FluidSynth: /usr/lib/x86_64-linux-gnu/libfluidsynth.so  

I re-tested it with Cmake 3.16 and wxWidgets 3.0.4 from the standard Ubuntu 20.04 repositories. Maybe there is a silly mistake on my part since I am only a beginner, but the part finding wxWidgets for Cmake seems to need an update because now compilation stops after 21% at

[ 21%] Building C object src/External/CMakeFiles/external.dir/dumb/it/xmeffect.o
[ 21%] Building CXX object src/External/CMakeFiles/external.dir/email/wxEmailMessage.o
In file included from /home/fifis/Pictures/SLADE-3.1.13/src/External/email/wxEmailMessage.cpp:4:
/home/fifis/Pictures/SLADE-3.1.13/src/External/email/wxEmailMessage.h:7:10: fatal error: wx/string.h: No such file or directory
    7 | #include <wx/string.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

Fifis avatar Oct 20 '21 02:10 Fifis

Make sure the wxwebview libs are installed, I think that is the main cause of similar issues

If that isn't the problem, maybe try removing wx 3.0.5 and installing 3.1.x from here: https://wiki.codelite.org/pmwiki.php/Main/WxWidgets31Binaries

sirjuddington avatar Mar 11 '22 14:03 sirjuddington