GNOME Bugzilla – Bug 732803
./configure is successful even when C++ compiler is missing
Last modified: 2014-10-20 17:10:05 UTC
Patch to follow
1) Normal working case with existing GParted code and C++ compiler: $ ./autogen.sh ... Running ./configure --enable-maintainer-mode ... ... checking for g++... g++ checking whether we are using the GNU C++ compiler... yes ... checking for Gtk::Window::set_default_icon_name method... yes ... $ fgrep SET_DEFAULT_ICON_NAME config.h #define HAVE_SET_DEFAULT_ICON_NAME 1 2) Problem case, with no C++ compiler installed: $ su - # cd /usr/bin # mv c++ c++-NOT; mv g++ g++-NOT # exit $ ./autogen.sh ... Running ./configure --enable-maintainer-mode ... ... checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking whether we are using the GNU C++ compiler... no ... checking for Gtk::Window::set_default_icon_name method... no ... $ fgrep SET_DEFAULT_ICON_NAME config.h /* #undef HAVE_SET_DEFAULT_ICON_NAME */ fragment of config.log: ./configure: line 7699: g++: command not found configure:7701: $? = 127 configure:7708: g++ -v >&5 ./configure: line 7710: g++: command not found configure:7712: $? = 127 configure:7719: g++ -V >&5 ./configure: line 7721: g++: command not found configure:7723: $? = 127 configure:7726: checking whether we are using the GNU C++ compiler configure:7779: result: no ... configure:18682: checking for Gtk::Window::set_default_icon_name method configure:18708: g++ -o conftest -pthread -I/usr/include/gtkmm-2.4 -I/usr/lib64/gtkmm-2.4/include -I/usr/include/giomm-2.4 -I/usr/lib64/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib64/pangomm-1.4/include -I/usr/include/gtk-2.0 -I/usr/include/gtk-unix-print-2.0 -I/usr/include/atkmm-1.6 -I/usr/include/gdkmm-2.4 -I/usr/lib64/gdkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib64/glibmm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/cairomm-1.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 conftest.cpp -pthread -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-x11-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 >&5 ./configure: line 18710: g++: command not found configure:18715: $? = 127 ... configure:18751: result: no Fedora and RedHat put C and C++ compilers in separate packages so when setting up a new VM for testing it is easy to not include it and have to add it later, but also re-run configure (or autogen.sh) to re-run the autoconf generated test for set_default_icon_name().
Created attachment 280786 [details] [review] Make ./configure fail when C++ compiler is missing (v1) Hi Curtis, Here's the patch for this. Tests: 1) Remove C++ compiler (rename c++ and g++ executables). -> Configure errors on C++ compiler check 2) Compile with C++ compiler installed. -> Program compiles successfully and executes Tests passed on: CentOS 5.10 CentOS 6.5 Fedora 20 Xubuntu 14.04 LTS Test 1) no C++ compiler, looks like this: $ ./autogen.sh ... Running ./configure --enable-maintainer-mode ... ... checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking for C++ compiler default output file name... configure: error: in `/home/mike/programming/c/gparted': configure: error: C++ compiler cannot create executables See `config.log' for more details. $ echo $? 1 Thanks, Mike
Thank you Mike for discovering this problem and providing a patch with background details. Using the tests in comment #2, I have confirmed the missing c++/g++ problem, and also confirmed the patch addresses the problem in the following distros: debian 7 kubuntu 12.04 opensuse 13.1 As such I have committed the patch in comment #2 to the git master repository for inclusion in the next release of GParted. The relevant git commit can be viewed at the following link: Make ./configure fail when C++ compiler is missing (#732803) https://git.gnome.org/browse/gparted/commit/?id=b1c64fdf0d9008f7f619723c5b8a7f92f58254f6
This enhancement was included in the GParted 0.20.0 release on October 20, 2014.