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

Build failure: ‘gtk_combo_box_get_active_text’ was not declared in this scope #41

Closed
jcbollinger opened this issue Apr 6, 2022 · 5 comments

Comments

@jcbollinger
Copy link

I'm trying to build Coot 1 on CentOS Stream 8, using (mostly) the system libraries. In particular, I am using the system's GTK+ 3, version 3.22.30. Coot's configure script finds GTK3 just fine, and it puts what appears to be the correct -I flag for that into the compilation command:
libtool: compile: g++ -DPACKAGE_NAME=\"coot\" -DPACKAGE_TARNAME=\"coot\" -DPACKAGE_VERSION=\"1\" "-DPACKAGE_STRING=\"coot 1\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"coot\" -DVERSION=\"1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_OPENMP=1 -DHAVE_CXX11=1 -DHAVE_CXX_THREAD=1 -DHAVE_PYTHON=\"3.6\" "-DHAVE_BOOST=/**/" "-DHAVE_BOOST_PYTHON=/**/" -I. -DUSE_PYTHON -I.. -I/usr/include -I/usr/include/goocanvas-2.0 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -pthread -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -pthread -I/opt/ccp4/ccp4-7.1/include -DCLIPPER_HAS_TOP8000 -DHAVE_CCP4SRS -I/opt/ccp4/ccp4-7.1/include -I/opt/ccp4/ccp4-7.1/include -DMMDB_HAS_LINK_DISTANCE -DMAKE_ENHANCED_LIGAND_TOOLS -I/usr/include/rdkit -DRDKIT_HAS_CAIRO_SUPPORT -I/usr/include -I/usr/include/python3.6m -DPKGDATADIR=\"/usr/local/share/coot\" -g -O2 -Wall -Wno-unused -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual -std=c++11 -MT lbg-search.lo -MD -MP -MF .deps/lbg-search.Tpo -c lbg-search.cc -fPIC -DPIC -o .libs/lbg-search.o

Nevertheless, the build fails:

lbg-search.cc: In member function ‘double lbg_info_t::get_search_similarity() const’:
lbg-search.cc:214:17: error: ‘gtk_combo_box_get_active_text’ was not declared in this scope
    gchar *txt = gtk_combo_box_get_active_text(GTK_COMBO_BOX(lbg_search_combobox));
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Function gtk_combo_box_get_active_text() has been deprecated since GTK+ 2.24, but apparently it has now been removed altogether, at least from some builds. The GTK 2 docs provide some recommendations for replacements.

@pemsley
Copy link
Owner

pemsley commented Apr 6, 2022

@jcbollinger -DHAVE_CCP4SRS is causing the problems. I don't test with this enabled - not for several years. What build system are you using?

Possible fix d210ca6

@jcbollinger
Copy link
Author

You judge correctly that I am compiling with CCP4SRS.

I'm using the provided Autotools build system, and configuring like so:

export PKG_CONFIG_PATH="${CCP4}/lib/pkgconfig"
./configure \
  --disable-static \
  --enable-cxx-warnings=yes \
  --with-backward \
  --with-boost \
  --with-boost-python \
  --with-ccp4srs-prefix="$CCP4" \
  --with-enhanced-ligand-tools \
  --with-guile \
  --with-rdkit-prefix=/usr \
  --with-sqlite3

@jcbollinger
Copy link
Author

jcbollinger commented Apr 6, 2022

Also, I'm no GTK expert, and I haven't gotten a successful build with which to test, but it looks to me like this might be the appropriate GTK 3 way to get the combobox text:

double
lbg_info_t::get_search_similarity() const {

   double r = search_similarity;
   gint active_index = gtk_combo_box_get_active(GTK_COMBO_BOX(lbg_search_combobox));

   if (active_index >= 0) {
      GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(lbg_search_combobox));
      GtkTreeIter iter;
      gtk_tree_model_iter_nth_child(model, &iter, NULL, active_index);
      gchar *txt;
      gtk_tree_model_get(model, &iter, 0, &txt, -1);  // txt needs to be freed

      try { 
	 r = lig_build::string_to_float(txt);
      }
      catch (const std::runtime_error &rte) {
	 std::cout << "WARNING:: Bad number " << txt << " " << rte.what() << std::endl;
	 std::cout << "WARNING:: Using " << r << std::endl;
      }

      g_free(txt);
   } 
   return r;
}

At minimum, this does compile.

@pemsley
Copy link
Owner

pemsley commented Apr 6, 2022

@jcbollinger #41 (comment) You will also need to specify boost-lib-dir

       --with-boost=$install_top_dir  \
       --with-boost-libdir=$install_top_dir/lib  \

I think.

@pemsley
Copy link
Owner

pemsley commented Apr 11, 2022

Fixed in 1.0.03

@pemsley pemsley closed this as completed Apr 14, 2022
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

2 participants