Problem 1327 - Compilation issue induced by a small change in a QT 4.8 OpenGL header file
Summary: Compilation issue induced by a small change in a QT 4.8 OpenGL header file
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization/OpenGL (show other problems)
Version: 9.5
Hardware: All Linux
: P5 minor
Assignee: garnier
URL:
Depends on:
Blocks:
 
Reported: 2012-06-26 17:03 CEST by Bob Velghe
Modified: 2014-05-09 14:44 CEST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Bob Velghe 2012-06-26 17:03:57 CEST
Hi,

I run into a small issue while compiling Geant 4.9.5.p01 with libqt 4.8.1.

I belive the root of the problem is in /source/visualization/OpenGL/include/G4OpenGL.hh. Since QT version 4.8.0 GL/glu.h is not included anymore in qgl.h (http://qt.gitorious.org/qt/qt/blobs/4.8/dist/changes-4.8.0, line 153), causing the following compliation error:

/home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc: In member function ‘virtual void G4OpenGLViewer::SetView()’:
/home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:295:47: error: ‘gluLookAt’ was not declared in this scope
/home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc: In member function ‘void G4OpenGLViewer::Pick(GLdouble, GLdouble)’:
/home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:426:53: error: ‘gluPickMatrix’ was not declared in this scope
/home/bvelghe/geant4.9.5.p01/source/externals/clhep/include/CLHEP/Units/PhysicalConstants.h: At global scope:
/home/bvelghe/geant4.9.5.p01/source/externals/clhep/include/CLHEP/Units/PhysicalConstants.h:79:21: warning: ‘CLHEP::electron_charge’ defined but not used [-Wunused-variable]
make[2]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/src/G4OpenGLViewer.cc.o] Error 1
make[1]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/all] Error 2
make: *** [all] Error 2

The quick and dirty fix consist in adding #include <GL/glu.h> in the bloc G4VIS_BUILD_OPENGLQT_DRIVER

Cheers,

Bob
Comment 1 garnier 2012-06-27 10:57:04 CEST
Hi bob,  

What is your configuration and system version ?

Cheers, 

Laurent


(In reply to comment #0)
> Hi,
> 
> I run into a small issue while compiling Geant 4.9.5.p01 with libqt 4.8.1.
> 
> I belive the root of the problem is in
> /source/visualization/OpenGL/include/G4OpenGL.hh. Since QT version 4.8.0
> GL/glu.h is not included anymore in qgl.h
> (http://qt.gitorious.org/qt/qt/blobs/4.8/dist/changes-4.8.0, line 153), causing
> the following compliation error:
> 
> /home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:
> In member function ‘virtual void G4OpenGLViewer::SetView()’:
> /home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:295:47:
> error: ‘gluLookAt’ was not declared in this scope
> /home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:
> In member function ‘void G4OpenGLViewer::Pick(GLdouble, GLdouble)’:
> /home/bvelghe/geant4.9.5.p01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:426:53:
> error: ‘gluPickMatrix’ was not declared in this scope
> /home/bvelghe/geant4.9.5.p01/source/externals/clhep/include/CLHEP/Units/PhysicalConstants.h:
> At global scope:
> /home/bvelghe/geant4.9.5.p01/source/externals/clhep/include/CLHEP/Units/PhysicalConstants.h:79:21:
> warning: ‘CLHEP::electron_charge’ defined but not used [-Wunused-variable]
> make[2]: ***
> [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/src/G4OpenGLViewer.cc.o]
> Error 1
> make[1]: *** [source/visualization/OpenGL/CMakeFiles/G4OpenGL.dir/all] Error 2
> make: *** [all] Error 2
> 
> The quick and dirty fix consist in adding #include <GL/glu.h> in the bloc
> G4VIS_BUILD_OPENGLQT_DRIVER
> 
> Cheers,
> 
> Bob
Comment 2 Nicola Mori 2013-10-17 10:41:30 CEST
I can confirm this on Archlinux 64 bit, Qt 4.8.5 and Geant4.10.00.b01:

/home/mori/software/source/geant4.10.00.b01/source/visualization/OpenGL/src/G4OpenGLViewer.cc: In member function ‘void G4OpenGLViewer::Pick(GLdouble, GLdouble)’:
/home/mori/software/source/geant4.10.00.b01/source/visualization/OpenGL/src/G4OpenGLViewer.cc:428:53: error: ‘gluPickMatrix’ was not declared in this scope
   gluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
                                                     ^

It seems to be a long-standing issue; a working hack is described here:


  http://hypernews.slac.stanford.edu/HyperNews/geant4/get/installconfig/1531/1/1/1.html

but modifying the Qt header is not a satisfactory solution and a fix within the Geant4 code would be appreciated.
Comment 3 garnier 2014-05-09 14:44:21 CEST
Hi, 

Sorry for the delay. I think that your problem was the same as here :
http://hypernews.slac.stanford.edu/HyperNews/geant4/get/installconfig/1638.html

A patch for Geant4 (since Geant4.10.1) on Linux will consist in building Geant4 adding -DGEANT4_USE_OPENGL_X11=ON.
This will be fixed in next Geant4 version.

Cheers,