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

Compile error: Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES) #25

Open
davemc50 opened this issue Sep 9, 2019 · 15 comments
Open

Comments

@davemc50
Copy link

davemc50 commented Sep 9, 2019

Kubuntu 18.04.3 LTS

Which version or package of wxWidgets is it missing?

root:/opt/rtlsdr_pi/build# cmake ..
-- *** Building rtlsdr_pi ***
-- *** Building rtlsdr_pi ***
-- Build type: 
-- *** Will install to /usr/local  ***
-- *** Build Architecture is amd64
-- *** Staging to build rtlsdr_pi ***
-- Setting C++11 standard via cmake standard mecahnism
-- OpenGL not found...
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.10/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
  cmake/PluginConfigure.cmake:248 (FIND_PACKAGE)
  CMakeLists.txt:18 (INCLUDE)

Here's what is currently installed...

root:/opt/rtlsdr_pi/build# apt list --installed | grep wx

libwxbase3.0-0v5/bionic,now 3.0.4+dfsg-3 amd64 [installed,automatic]
libwxbase3.0-dev/bionic,now 3.0.4+dfsg-3 amd64 [installed]
libwxgtk3.0-0v5/bionic,now 3.0.4+dfsg-3 amd64 [installed]
wx3.0-headers/bionic,bionic,now 3.0.4+dfsg-3 all [installed,automatic]
wx3.0-i18n/bionic,bionic,now 3.0.4+dfsg-3 all [installed,automatic]
@davemc50
Copy link
Author

davemc50 commented Sep 9, 2019

Plugin Install task depends on wxWidgets_LIBRARIES

cmake/PluginInstall.cmake:  TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${wxWidgets_LIBRARIES} ${EXTRA_LIBS} )

With debug enabled

-- /usr/share/cmake-3.10/Modules/FindwxWidgets.cmake(170): wxWidgets not found due to following missing libraries: wx_baseu_core-3.0 wx_baseu_html-3.0 wx_baseu_adv-3.0

Does rtlsdr_pi really need all those wxWidgets libraries?

cmake/PluginConfigure.cmake:  SET(wxWidgets_USE_LIBS base core net xml html adv)

@rgleason
Copy link
Contributor

rgleason commented Sep 9, 2019

don't know if it matters, but I believe wxwidgets_use_libs has been depreciated

@davemc50
Copy link
Author

davemc50 commented Sep 9, 2019

apt-get install libwxgtk-media3.0-dev gettext

@rgleason
Copy link
Contributor

rgleason commented Sep 9, 2019

Thanks, I guess we need to add those libs first chance we get.

@Fenrihr
Copy link

Fenrihr commented Apr 21, 2020

Some solutions for Archlinux?

@rgleason
Copy link
Contributor

For the current version of Opencpn 5.0 you will need version wxWidgets 3.1.2, but I know absolutely nothing about Archlinux.

@Fenrihr
Copy link

Fenrihr commented Apr 21, 2020

Some solutions for Archlinux?

Update: i found the solution in the Dockerfile for Archlinux of MoneyManagerEx 1.4.0 branch:

# fix broken wxgtk3
sudo ln -sf /usr/bin/wx-config{-gtk3,} || true

@ghost
Copy link

ghost commented May 6, 2020

Old post but since I was dropped here by a search engine, I give my two cents worth, working on another OpenCPN plug-in where I had the very same problem in one my test machines which I updated from Lubuntu 16.04LTS to 18.04LTS: The issue was with the alternatives versions of wxWidgets (2.8 and 3.0). The default selection made the cmake to fail. Probably I am using also the same PluginConfigure.cmake, which is copy-pasted on about one hundred or so plug-in for now:

PluginConfigure.cmake:IF(NOT DEFINED wxWidgets_USE_FILE)
PluginConfigure.cmake:    SET(wxWidgets_USE_LIBS base core net xml html adv aui webview)

Solution to the "alternatives" annoyance:

~$ sudo  update-alternatives --display wx-config
wx-config - auto mode
  link best version is /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0
  link currently points to /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0
  link wx-config is /usr/bin/wx-config
/usr/lib/x86_64-linux-gnu/wx/config/base-unicode-3.0 - priority 306
/usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0 - priority 308
/usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.0 - priority 307

Gtk2 is selected:

~$ sudo wx-config --selected-config
gtk2-unicode-3.0

Let's change that:

~$ sudo  update-alternatives --config wx-config
There are 3 choices for the alternative wx-config (providing /usr/bin/wx-config).

  Selection    Path                                                  Priority   Status
------------------------------------------------------------
* 0            /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0   308       auto mode
  1            /usr/lib/x86_64-linux-gnu/wx/config/base-unicode-3.0   306       manual mode
  2            /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0   308       manual mode
  3            /usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.0   307       manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.0 to provide
/usr/bin/wx-config (wx-config) in manual mode

Now OK Gtk3:

~$ sudo wx-config --selected-config
gtk3-unicode-3.0

Try to build again:

build$ cmake -DCMAKE_BUILD_TYPE=Release ..

Works now:

-- Found wxWidgets: -L/usr/lib/x86_64-linux-gnu;-pthread;;;-lwx_baseu-3.0;-lwx_gtk3u_core-3.0;
-lwx_baseu_net-3.0;-lwx_baseu_xml-3.0;-lwx_gtk3u_html-3.0;-lwx_gtk3u_adv-3.0;
-lwx_gtk3u_aui-3.0;-lwx_gtk3u_webview-3.0;-lwx_gtk3u_gl-3.0 (found version "3.0.4")

@rgleason
Copy link
Contributor

rgleason commented May 6, 2020

Thanks Petri I always learn something from you.

@ghost
Copy link

ghost commented May 8, 2020

As mentioned above, on *ubuntu 18.04 LTS (cmake 3.10) one needs to replace wxWidgets_USE_LIBS. But with what? You can get the selection 2 (see above), gtk2-unicode-3.0 to work, by modifying in PluginConfigure.cmake

-  SET(wxWidgets_USE_LIBS base core net xml html adv)
+  SET(wxWidgets_FIND_COMPONENTS base core net xml html adv)
-    FIND_PACKAGE(wxWidgets REQUIRED)
+    FIND_PACKAGE(wxWidgets COMPONENTS ${wxWidgets_FIND_COMPONENTS}

@rgleason
Copy link
Contributor

rgleason commented May 8, 2020

Petri, this is something we'll might need to do in all plugin frontend setups, isn't it?

See this concurrent issue OpenCPN/OpenCPN#1898

@ghost
Copy link

ghost commented May 8, 2020

Rick, probably you do not want to enforce it everywhere. "If it ain' t broke, don' t fix it." Ubuntu 18.04LTS is the only platform on which I have had this issue. And there is 20.04LTS already, what will be the problem there, who knows? On Debian 10 there is an issue with wxWebView... it never ends!

I noticed this on a Travis build for 18.04 LTS - it goes unnoticed - binary without a test is not a binary! Fix like this is not a big deal once you know where the problem is.

Seeing the Travis issue, maybe, in your CI template for plug-ins, you could start looking for a scripted solution to prepare various platforms, something like in this script from OpenCPN v5.1 beta: https://git.io/JfcNi . The investment to embed this wisdom in build processes for stable platforms like the LTSs would not be useless but, of course it will be a big investment, human resource wise.

@ghost
Copy link

ghost commented May 9, 2020

Out of curiosity, I installed Ubuntu 20.04LTS and OpenCPN v5.0 and also v5.1beta. There is no ambiguity with "alternative" GTK-version anymore: there is only one, the sharp-looking GTK3 available! From the build point of view it is simpler for the plug-in than 18.04LTS (which I am personally going to drop now, too much hassle).

Nevertheless, to find wxWidgets, one needs to use method explained above.

In addition, in order to not to have ambiguity (there is always one!) with OpenGL version with CMake v3.17, one can add - if your plug-in needs those functions:

IF (CMAKE_VERSION VERSION_GREATER_EQUAL "3.12.0")
  # `FindOpenGL`` prefers GLVND by default when available:
  CMAKE_POLICY(SET CMP0072 NEW)
ENDIF(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12.0")

FIND_PACKAGE(OpenGL)

For memory, in Ubuntu 18.04LTS CMake version is 3.10. The above policy was introduced in 3.12.

@bretttolbert
Copy link

apt-get install libwxgtk-media3.0-dev gettext

FYI on Ubuntu 22.04 I had to use:

apt install libwxgtk-media3.0-gtk3-dev gettext

@Quentin-xue
Copy link

Don't install gtk2,you can see this the difference From the following logs

image

image

or just change find_package(GTK2) to find_package(GTK3) in file cmake/PluginConfigure.cmake
image
After change logs

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants