BOINC / boinc

Open-source software for volunteer computing and grid computing.
https://boinc.berkeley.edu
GNU Lesser General Public License v3.0
2k stars 445 forks source link

Bad GTK detection in configure build script #3644

Open truboxl opened 4 years ago

truboxl commented 4 years ago

Describe the bug https://boinc-dev.ssl.berkeley.narkive.com/9pBp8olG/boinc-should-check-for-gtk-libs Under certain conditions, the build will eventually fail at gtk.h not found even though its present. Also need to improve webview detection.

...
/usr/include/wx-3.0/wx/gtk/dataform.h:31:19: note: because ‘wxDataFormat’ has user-provided ‘wxDataFormat& wxDataFormat::operator=(const wxDataFormat&)’
   31 |     wxDataFormat& operator=(const wxDataFormat& format)
      |                   ^~~~~~~~
  CXX      boincmgr-taskbarex.o
gtk/taskbarex.cpp:17:10: fatal error: gtk/gtk.h: No such file or directory
   17 | #include <gtk/gtk.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1329: boincmgr-taskbarex.o] Error 1
make[2]: Leaving directory '/home/jylo/Projects/boinc2/clientgui'
make[1]: *** [Makefile:649: all-recursive] Error 1
make[1]: Leaving directory '/home/jylo/Projects/boinc2'
make: *** [Makefile:553: all] Error 2

Steps To Reproduce

  1. Ubuntu, installed all the relevant *dev packages and deps (eg: libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev)
  2. pkg-config --libs gtk+-3.0 is present
  3. pkg-config --libs gtk+-2.0 is not present
  4. wx-config --selected-config outputs gtk2-unicode-3.0 instead of gtk3-unicode-3.0
  5. wx-config --list shows gtk3-unicode-3.0 as a valid alternative

Expected behavior ./configure script should fail during pkg-config choosing gtk2 when this error is shown:

...
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for wx-config... /usr/bin/wx-config
checking for wxWidgets version >= 3.0.0... yes (version 3.0.4)
checking for wxWidgets static library... no
checking if wxWidgets works... yes
checking for default wxWidgets config... gtk2-unicode-3.0
checking for wxwidgets options...  --unicode=yes
checking wxWidgets config to use... gtk2-unicode-3.0
checking for wx-config... (cached) /usr/bin/wx-config
checking for wxWidgets version >= 3.0.0 ( --unicode=yes)... yes (version 3.0.4)
checking for wxWidgets static library... no
checking if wxWidgets uses the GTK+ toolkit... Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
gtk+-2.0
checking for pkg-config... /usr/bin/pkg-config
...

For webview, the user will not know about the error until they see build failed with lots of undefined webview errors. Some detection here perhaps?

zlib.h may also suffer the same problem...

Workaround Currently passing --with-wx-config=/usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.0 to ./configure without having to override wx-config output using update-alternatives. Trying to build with the least argument as possible here.

Additional context

  1. Unrelated info: Some distro does not provide wx-config-3.0 which is confusingly named (to me) with no relations to GTK3. If they need to know what version of wx-config, use wx-config --version. https://bugs.archlinux.org/task/56051 Some however decided to put this under wxGTK3-devel, I am not even sure the 3 stands for wxWidgets version or GTK3 anymore https://bugzilla.redhat.com/show_bug.cgi?id=1077718

  2. Under m4 directory there's boinc_gtk.m4, boinc_wxwidgets.m4 and gtk-2.0.m4 that probably need updating...

  3. Also the build instructions for Linux are all over the place with wildly different variations and lots of overrides are needed. Looks daunting to someone new like me. https://github.com/BOINC/boinc/issues/2360#issuecomment-367959535 https://boinc.berkeley.edu/wiki/Installing_BOINC#Build_BOINC_from_source https://boinc.berkeley.edu/trac/wiki/SoftwarePrereqsUnix

RichardHaselgrove commented 4 years ago

Could this explain the report at https://boinc.berkeley.edu/forum_thread.php?id=13635&postid=98001#98001 and subsequent posts? User trying to run from repo distribution, on newly-upgraded Ubuntu 20.4 - error

boincmgr: error while loading shared libraries: libwx_gtk2u_html-3.0.so.0: cannot open shared object file: No such file or directory

Peppernrino commented 4 years ago

I also have a gtk error from BOINC running a new copy of UbuntuStudio 20.04:

(boincmgr:4705): Gtk-CRITICAL **: (timestamp): gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

Is this related, or should I make a new issue, or is it my fault somehow? I honestly don't know enough about Linux yet to know. lol :D