Closed imfatant closed 3 years ago
I'm not sure what's going on, but will try to reproduce this when I get a chance. What version Ubuntu are you using and what version of CMake are you running?
It seems to be failing on VERIFY_WXWIDGETS_COMPONENTS
(this is why you get the list of all missing components), although this doesn't seem to be the main issue and the method has the following comment, so it's possible that it's a sort of expected result:
# Search through the list of components to see what we were able to find.
# CMake's find_package for wxWidgets fails on missing components and for
# some reason CMake's find function gives no indication as to why it failed
# which makes it difficult, if not impossible, to ever 'find' wxWidgets.
# In Linux using wx-config the WX_{base/core/etc} vars are not set.
# Mark all libs as not found.
The main failure seems to be in the find_package call that comes with Cmake: find_package( wxWidgets COMPONENTS ${wxWidgets_COMPONENTS})
.
Actually, I think I know what may be going on; you run ../configure --with-gtk
, but expect gtk3 to be used. Try running ../configure --with-gtk=3
instead.
Hi,
Thanks for the reply. I tried rebuilding wxWidgets using ../configure --with-gtk=3
but it seems to have made no difference. Still the same errors.
This is Ubuntu 20.04.2 LTS and CMake version 3.16.3.
Interesting. Can you include the output from wx-config after you build wxwidgets with that command?
Here's the output of wx-config now:
wx-config:
Available libraries in this build are: xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base
wx-config --libs all:
-L/usr/local/lib -pthread -lwx_gtk3u_xrc-3.1 -lwx_gtk3u_stc-3.1 -lwx_gtk3u_richtext-3.1 -lwx_gtk3u_ribbon-3.1 -lwx_gtk3u_propgrid-3.1 -lwx_gtk3u_aui-3.1 -lwx_gtk3u_gl-3.1 -lwx_gtk3u_html-3.1 -lwx_gtk3u_qa-3.1 -lwx_gtk3u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
@pkulchenko
I have got a little further.
One problem appears to have been because of missing dependencies for wxWidgets. So, I rebuilt it after doing:
sudo apt-get install build-essential libreadline-dev
sudo apt-get install libgtk-3-dev libwxgtk-webview3.0-gtk3-dev libwxgtk-media3.0-gtk3-dev
sudo apt-get install libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-0 libgstreamer-plugins-good1.0-dev libgstreamer1.0-0 libgstreamer1.0-0-dbg libgstreamer1.0-dev
sudo apt-get install libwebkit2gtk-4.0-dev
Next, is a small issue with CMake and wxLua. CMakewxAppLib.cmake doesn't handle parsing portname for gtk3, but I managed to fix this by changing the following section:
# wxWidgets GTK1-3 build using configure
if ("${wxWidgets_PORTNAME}" STREQUAL "")
string(REGEX MATCH "wx_(gtk[1-3]?)(univ)?(u)?(d)?_core-([0-9].[0-9])" _match_gtk "${wxWidgets_LIBRARIES}")
if (NOT "${_match_gtk}" STREQUAL "")
set(wxWidgets_PORTNAME "${CMAKE_MATCH_1}" )
set(wxWidgets_UNIVNAME "${CMAKE_MATCH_2}" )
set(wxWidgets_UNICODEFLAG "${CMAKE_MATCH_3}" )
set(wxWidgets_DEBUGFLAG "${CMAKE_MATCH_4}" )
#set(wxWidgets_LIB_VERSION "${CMAKE_MATCH_5}" )
endif()
endif()
Now CMake builds... almost! Here's CMake's output:
-- * ---------------------------------------------------------------------------
-- * CMake command line options and tips specific to this project
-- *
-- * In the CMake GUI you can set values and press configure a few times
-- * and until there are no more red items, then press generate.
-- *
-- * Usage: cmake -D[OPTION_NAME]=[OPTION_VALUE] /path/to/CMakeLists.txt/
-- * ---------------------------------------------------------------------------
-- * -DHELP=TRUE
-- * Show this help message and exit, no files will be generated.
-- * -DCMAKE_BUILD_TYPE=[Debug, Release, RelWithDebInfo, MinSizeRel] : (Default Debug)
-- * Makefiles : You must set the build type to Debug, Release...
-- * MSVC GUI : No need to set this since you can choose it in the GUI.
-- * -DBUILD_SHARED_LIBS=[TRUE, FALSE] : (Default static in MSW, shared in Linux)
-- * Build shared (.DLL or .so) or static (.lib or .a) libraries.
-- * ---------------------------------------------------------------------------
--
--
-- *****************************************************************************
-- * BUILD TYPE: Debug
-- * BUILD_SHARED_LIBS: TRUE
-- *****************************************************************************
-- * System is 32-bit FALSE, is 64-bit TRUE
-- *****************************************************************************
-- * CMAKE_SOURCE_DIR = /home/anthony/git/wxlua/wxLua
-- * CMAKE_BINARY_DIR = /home/anthony/git/wxlua/wxLua/test
-- *****************************************************************************
--
-- * ---------------------------------------------------------------------------
-- * wxWidgets library settings :
-- *
-- * Note that ONLY an all shared (DLL) or all static build is supported.
-- * I.E. If you choose shared you must link to shared wxWidgets libs.
-- * Set -DBUILD_SHARED_LIBS=[TRUE, FALSE] to control shared/static lib.
-- *
-- * Finding wxWidgets for MSW and MSVC
-- * -DwxWidgets_ROOT_DIR=[path] : (e.g. /path/to/wxWidgets/)
-- * Path to the root of the wxWidgets build, must at least set this.
-- * -DwxWidgets_LIB_DIR=[path] : (e.g. /path/to/wxWidgets/lib/vc_lib/)
-- * Path to the wxWidgets lib dir also set this if libs can't be found.
-- * -DwxWidgets_CONFIGURATION=[configuration] :
-- * Set wxWidgets configuration; e.g. msw, mswu, mswunivu...
-- * Where 'u' = unicode and 'd' = debug.
-- * MSVC GUI : You need only choose msw, mswu, mswuniv, mswunivu since
-- * release or debug mode is chosen in the GUI.
-- * -DwxWidgets_COMPONENTS=[...stc;html;adv;core;base or mono] :
-- * For non-monolithic builds choose the wxWidgets libs to link to.
-- * xrc;xml;gl;net;media;propgrid;richtext;aui;stc;html;adv;core;base
-- * For monolithic builds choose mono and the contribs libs.
-- * stc;mono
-- * The extra decorations, e.g. wxmsw28ud_adv.lib, will be searched for.
-- * Libs that cannot be found will be printed below, please fix/remove
-- * them to be able to build this project.
-- * You will get compilation/linker errors if wxWidgets is not found.
-- *
-- * Finding wxWidgets for GCC and Unix type systems
-- * -DwxWidgets_CONFIG_EXECUTABLE=[path/to/wx-config] :
-- * Specify path to wx-config script for GCC and Unix type builds
-- * ---------------------------------------------------------------------------
--
-- * Using these wxWidgets components: gl;xrc;xml;net;media;richtext;aui;stc;html;adv;core;base
-- *
-- * Found wxWidgets :
-- * - wxWidgets_VERSION = 3.0.4 = 3.0.4
-- * - wxWidgets_COMPONENTS = gl;xrc;xml;net;media;richtext;aui;stc;html;adv;core;base
-- * - wxWidgets_INCLUDE_DIRS = /usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.0;/usr/include/wx-3.0
-- * - wxWidgets_LIBRARY_DIRS =
-- * - wxWidgets_LIBRARIES = -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_gtk3u_gl-3.0;-lwx_gtk3u_xrc-3.0;-lwx_baseu_xml-3.0;-lwx_baseu_net-3.0;-lwx_gtk3u_media-3.0;-lwx_gtk3u_richtext-3.0;-lwx_gtk3u_aui-3.0;-lwx_gtk3u_stc-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_adv-3.0;-lwx_gtk3u_core-3.0;-lwx_baseu-3.0
-- * - wxWidgets_CXX_FLAGS = -pthread
-- * - wxWidgets_DEFINITIONS = _FILE_OFFSET_BITS=64;__WXGTK__
-- * - wxWidgets_DEFINITIONS_DEBUG =
-- * - wxWidgets_PORTNAME = gtk3
-- * - wxWidgets_UNIVNAME =
-- * - wxWidgets_UNICODEFLAG = u
-- * - wxWidgets_DEBUGFLAG =
-- *
-- * WARNING: Specified wxLuaBinding lib 'webview' in variable wxLuaBind_COMPONENTS is missing from wxWidgets_COMPONENTS so it will not be compiled.
-- * WARNING: Specified wxLuaBinding lib 'propgrid' in variable wxLuaBind_COMPONENTS is missing from wxWidgets_COMPONENTS so it will not be compiled.
-- * wxLua using built-in Lua 5.1 library
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- * WARNING: Doxygen NOT found, wxLua_doxygen target will not be generated.
-- Configuring done
-- Generating done
The odd thing is that the wxWidgets webview and propgrid libraries DO exist, so I don't know what's going on.
EDIT: I edited CMakeLists.txt so that propgrid and webview are specified. wxLua now almost builds:
[ 92%] Building CXX object modules/wxlua/debugger/CMakeFiles/wxLuaDebuggerLib.dir/wxldtarg.cpp.o
[ 92%] Building CXX object modules/wxlua/debugger/CMakeFiles/wxLuaDebuggerLib.dir/wxlsock.cpp.o
[ 93%] Building CXX object modules/wxlua/debugger/CMakeFiles/wxLuaDebuggerLib.dir/wxluadebugger_bind.cpp.o
[ 93%] Linking CXX shared library ../../../lib/Debug/libwxlua_debugger-wx30gtk3ud-3.1.0.0.so
[ 93%] Built target wxLuaDebuggerLib
Scanning dependencies of target wxLua_app
Scanning dependencies of target wxLuaFreeze
Scanning dependencies of target wxLuaCan
[ 94%] Building CXX object apps/wxluafreeze/CMakeFiles/wxLuaFreeze.dir/wxluafreeze.cpp.o
[ 95%] Building CXX object apps/wxlua/CMakeFiles/wxLua_app.dir/wxlua.cpp.o
[ 96%] Building CXX object apps/wxluacan/CMakeFiles/wxLuaCan.dir/cancom.cpp.o
[ 96%] Building CXX object apps/wxluacan/CMakeFiles/wxLuaCan.dir/canlua.cpp.o
[ 97%] Building CXX object apps/wxluacan/CMakeFiles/wxLuaCan.dir/cansim.cpp.o
[ 98%] Building CXX object apps/wxluacan/CMakeFiles/wxLuaCan.dir/wxluacan_bind.cpp.o
[ 99%] Linking CXX executable ../../bin/Debug/wxLuaFreeze
[100%] Linking CXX executable ../../bin/Debug/wxLua
/usr/bin/ld: ../../lib/Debug/libwxlua_bind-wx30gtk3ud-3.1.0.0.so: undefined reference to `wxPluralFormsCalculatorPtr::~wxPluralFormsCalculatorPtr()'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/wxluafreeze/CMakeFiles/wxLuaFreeze.dir/build.make:89: bin/Debug/wxLuaFreeze] Error 1
make[1]: *** [CMakeFiles/Makefile2:610: apps/wxluafreeze/CMakeFiles/wxLuaFreeze.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX executable ../../bin/Debug/wxLuaCan
/usr/bin/ld: ../../lib/Debug/libwxlua_bind-wx30gtk3ud-3.1.0.0.so: undefined reference to `wxPluralFormsCalculatorPtr::~wxPluralFormsCalculatorPtr()'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/wxlua/CMakeFiles/wxLua_app.dir/build.make:89: bin/Debug/wxLua] Error 1
make[1]: *** [CMakeFiles/Makefile2:548: apps/wxlua/CMakeFiles/wxLua_app.dir/all] Error 2
/usr/bin/ld: ../../lib/Debug/libwxlua_bind-wx30gtk3ud-3.1.0.0.so: undefined reference to `wxPluralFormsCalculatorPtr::~wxPluralFormsCalculatorPtr()'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/wxluacan/CMakeFiles/wxLuaCan.dir/build.make:134: bin/Debug/wxLuaCan] Error 1
make[1]: *** [CMakeFiles/Makefile2:579: apps/wxluacan/CMakeFiles/wxLuaCan.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
@imfatant, you may need to add -DCMAKE_CXX_FLAGS="-DwxLUA_USE_wxTranslations=0"
option to cmake to fix undefined reference to 'wxPluralFormsCalculatorPtr::~wxPluralFormsCalculatorPtr()'
error. See the discussion in #80.
-- WARNING: Specified wxLuaBinding lib 'webview' in variable wxLuaBind_COMPONENTS is missing from wxWidgets_COMPONENTS so it will not be compiled. -- WARNING: Specified wxLuaBinding lib 'propgrid' in variable wxLuaBind_COMPONENTS is missing from wxWidgets_COMPONENTS so it will not be compiled.
I do see those warning too and they appear to be misleading/harmless.
Can you include a full diff with all your changes?
Good. It builds fine now. Many thanks for your help.
My recipe:
git clone https://github.com/pkulchenko/wxlua
cd wxlua
cd wxLua
mkdir test
cd test
cmake -DCMAKE_CXX_FLAGS="-DwxLUA_USE_wxTranslations=0" .. # do this twice!
make -j8
sudo make install
Is this diff what you require?
anthony@DESKTOP-AJTH7MU:~/git/wxlua/wxLua/build$ diff CMakewxAppLib_old.cmake CMakewxAppLib.cmake
467c467
< set(wxWidgets_PORTNAME "" CACHE STRING "wxWidgets port; 'msw', 'gtk1', 'gtk2'..." FORCE)
---
> set(wxWidgets_PORTNAME "" CACHE STRING "wxWidgets port; 'msw', 'gtk1', 'gtk2', 'gtk3'..." FORCE)
524c524
< # wxWidgets GTK2 build using configure
---
> # wxWidgets GTK1-3 build using configure
526c526
< string(REGEX MATCH "wx_(gtk[12]?)(univ)?(u)?(d)?_core-([0-9].[0-9])" _match_gtk "${wxWidgets_LIBRARIES}")
---
> string(REGEX MATCH "wx_(gtk[1-3]?)(univ)?(u)?(d)?_core-([0-9].[0-9])" _match_gtk "${wxWidgets_LIBRARIES}")
567c567
< set(wxWidgets_PORTNAME "${wxWidgets_PORTNAME}" CACHE STRING "wxWidgets port; 'msw', 'gtk1', 'gtk2'..." FORCE)
---
> set(wxWidgets_PORTNAME "${wxWidgets_PORTNAME}" CACHE STRING "wxWidgets port; 'msw', 'gtk1', 'gtk2', 'gtk3'..." FORCE)
Thank you for the diff! I pushed an update that incorporates these changes.
I'm trying to build wxLua (obtained from Github) on WSL Ubuntu using the method described here: https://github.com/pkulchenko/wxlua/blob/master/wxLua/docs/install.md#C4.6
The problem is that despite wxWidgets being installed, and working, CMake is not finding it.
wx-config IS found by CMake (and I checked that it works manually), but CMake still says it can't find wxWidgets.
For reference, here is how I installed wxWidgets:
The libraries are where they should be (I believe):
Here is the output from CMake when trying to build wxLua:
As I've mentioned, I have checked that
/usr/local/bin/wx-config
exists and works. Typingwx-config --libs all
comes back with the libraries:I've tried adding a new entry in cmake-gui:
wxWidgets_LIBRARY_DIRS /usr/local/lib
I've also tried adding
wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config
Can you help?
-- Anthony