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

Compilation error in model_viewer_widget.h #745

Open
KhaledSharif opened this issue Nov 28, 2019 · 18 comments
Open

Compilation error in model_viewer_widget.h #745

KhaledSharif opened this issue Nov 28, 2019 · 18 comments

Comments

@KhaledSharif
Copy link
Contributor

Error output

[ 80%] Building CXX object src/CMakeFiles/colmap.dir/ui/colormaps.cc.o
In file included from /home/khaled/Repositories/colmap/src/ui/main_window.h:50:0,
                 from /home/khaled/Repositories/colmap/src/ui/automatic_reconstruction_widget.cc:34:
/home/khaled/Repositories/colmap/src/ui/model_viewer_widget.h:55:63: error: expected class-name before ‘{’ token
                           protected QOpenGLFunctions_3_2_Core {
                                                               ^
[ 80%] Building CXX object src/CMakeFiles/colmap.dir/ui/database_management_widget.cc.o
src/CMakeFiles/colmap.dir/build.make:1718: recipe for target 'src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/khaled/Repositories/colmap/src/ui/main_window.h:50:0,
                 from /home/khaled/Repositories/colmap/src/ui/bundle_adjustment_widget.cc:35:
/home/khaled/Repositories/colmap/src/ui/model_viewer_widget.h:55:63: error: expected class-name before ‘{’ token
                           protected QOpenGLFunctions_3_2_Core {
                                                               ^
src/CMakeFiles/colmap.dir/build.make:1742: recipe for target 'src/CMakeFiles/colmap.dir/ui/bundle_adjustment_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/bundle_adjustment_widget.cc.o] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Environment

khaled@jetson-nano:~/Repositories/colmap/build$ uname -a
Linux jetson-nano 4.9.140-tegra #1 SMP PREEMPT Tue Nov 5 13:43:53 PST 2019 aarch64 aarch64 aarch64 GNU/Linux

Steps to recreate

git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make -j4
@tsattler
Copy link
Contributor

Did you install all dependencies? It looks a bit like you might be missing the Qt library (which is used for the GUI) or might only have an older version of Qt installed.

@KhaledSharif
Copy link
Contributor Author

Thanks for your reply. I did install all dependencies as show below:

sudo apt-get install \
    git \
    cmake \
    build-essential \
    libboost-program-options-dev \
    libboost-filesystem-dev \
    libboost-graph-dev \
    libboost-regex-dev \
    libboost-system-dev \
    libboost-test-dev \
    libeigen3-dev \
    libsuitesparse-dev \
    libfreeimage-dev \
    libgoogle-glog-dev \
    libgflags-dev \
    libglew-dev \
    qtbase5-dev \
    libqt5opengl5-dev \
    libcgal-dev \
    libcgal-qt5-dev

When running cmake prior to running make, I can see that it can find Qt5.

khaled@jetson-nano:~/Repositories/colmap/build$ cmake ..
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/aarch64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: /usr with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, OpenMP]
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   graph
--   regex
--   system
--   unit_test_framework
-- Found Eigen
--   Includes : /usr/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib/aarch64-linux-gnu/libfreeimage.so
-- Found Glog
--   Includes : /usr/include
--   Libraries : /usr/lib/aarch64-linux-gnu/libglog.so
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/aarch64-linux-gnu/libGLEW.so
-- Found Qt
--   Module : /usr/lib/aarch64-linux-gnu/cmake/Qt5Core
--   Module : /usr/lib/aarch64-linux-gnu/cmake/Qt5OpenGL
--   Module : /usr/lib/aarch64-linux-gnu/cmake/Qt5Widgets
-- Found CGAL
--   Includes : /usr//include
--   Libraries : /usr/lib/aarch64-linux-gnu/libCGAL.so.13.0.1
-- Build type not specified, using Release
-- Enabling SIMD support
-- Enabling OpenMP support
-- Disabling interprocedural optimization
-- Autodetected CUDA architecture(s):  5.3
-- Enabling CUDA support (version: 10.0, archs: sm_53)
-- Enabling OpenGL support
-- Disabling profiling support
-- Enabling CGAL support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/khaled/Repositories/colmap/build

The error however unfortunately persists.

[ 52%] Building CXX object src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o
In file included from /home/khaled/Repositories/colmap/src/ui/main_window.h:50:0,
                 from /home/khaled/Repositories/colmap/src/ui/automatic_reconstruction_widget.cc:34:
/home/khaled/Repositories/colmap/src/ui/model_viewer_widget.h:55:63: error: expected class-name before ‘{’ token
                           protected QOpenGLFunctions_3_2_Core {
                                                               ^
src/CMakeFiles/colmap.dir/build.make:1718: recipe for target 'src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

By running qtchooser I can see that I have both 4 and 5 on my device. Please let me know if this could be causing the problem.

khaled@jetson-nano:~/Repositories/colmap/build$ qtchooser -l
4
5
default
qt4-aarch64-linux-gnu
qt4
qt5-aarch64-linux-gnu
qt5

Additionally, qmake seems to be using 4.8.7. Could this be a problem?

khaled@jetson-nano:~/Repositories/colmap/build$ qmake --version
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/aarch64-linux-gnu

@KhaledSharif
Copy link
Contributor Author

Update: I've removed qt4 from my device and installed qt5-default to make qt5 the default for qmake. Now running qmake shows it is using qt5. However the compilation error persists.

khaled@jetson-nano:~/Repositories/colmap/build$ qmake -v
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/aarch64-linux-gnu

@KhaledSharif
Copy link
Contributor Author

KhaledSharif commented Nov 29, 2019

@ahojnnes
Copy link
Contributor

ahojnnes commented Dec 1, 2019 via email

@KhaledSharif
Copy link
Contributor Author

@ahojnnes I'm not actually using qmake for compilation. I just used it to check which version of Qt is on my machine and which version of Qt is selected by default.

@KhaledSharif
Copy link
Contributor Author

@ahojnnes @tsattler
Is there a way to build a headless version of COLMAP (i.e. to only use the COLMAP command line interface)? I assume this way would not require Qt and therefore I could successfully build this on the Jetson device.

@ahojnnes
Copy link
Contributor

ahojnnes commented Dec 9, 2019 via email

@iliesaya
Copy link

iliesaya commented Jul 6, 2020

Dear @KhaledSharif , could you detail how you managed to solve this issue? I am trying to install colmap on the jetson and facing the same error. Thank you.

@KhaledSharif
Copy link
Contributor Author

@iliesaya
I got it to compile by changing that line from
protected QOpenGLFunctions_3_2_Core
to
protected QOpenGLExtraFunctions

@karthikarvind1295
Copy link

I followed all these instructions. Yet I am still getting the error as below :
[ 52%] Automatic RCC for target colmap
[ 52%] Built target colmap_autogen
[ 52%] Building CXX object src/CMakeFiles/colmap.dir/ui/model_viewer_widget.cc.o
/home/xosight/colmap/src/ui/model_viewer_widget.cc: In member function ‘virtual void colmap::ModelViewerWidget::initializeGL()’:
/home/xosight/colmap/src/ui/model_viewer_widget.cc:234:12: error: ‘GL_VERTEX_PROGRAM_POINT_SIZE’ was not declared in this scope
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xosight/colmap/src/ui/model_viewer_widget.cc:234:12: note: suggested alternative: ‘GL_VERTEX_ARRAY_BINDING’
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
GL_VERTEX_ARRAY_BINDING
/home/xosight/colmap/src/ui/model_viewer_widget.cc: In member function ‘void colmap::ModelViewerWidget::SelectObject(int, int)’:
/home/xosight/colmap/src/ui/model_viewer_widget.cc:472:13: error: ‘GL_MULTISAMPLE’ was not declared in this scope
glDisable(GL_MULTISAMPLE);
^~~~~~~~~~~~~~
/home/xosight/colmap/src/ui/model_viewer_widget.cc:472:13: note: suggested alternative: ‘GL_MULTISAMPLES_NV’
glDisable(GL_MULTISAMPLE);
^~~~~~~~~~~~~~
GL_MULTISAMPLES_NV
src/CMakeFiles/colmap.dir/build.make:2030: recipe for target 'src/CMakeFiles/colmap.dir/ui/model_viewer_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/model_viewer_widget.cc.o] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

@KhaledSharif
Copy link
Contributor Author

@karthikarvind1295 can you give more details please? Which system are you compiling on? Which version of QT are you using? etc

@ShreyasManjunath
Copy link

Hi @KhaledSharif .

I am trying to compile colmap on Jetson TX2 with Qt5 installed.

Got this error with QOpenGLFunctions_3_2_Core:

In file included from /home/nvidia/colmap/src/ui/main_window.h:50:0,
                 from /home/nvidia/colmap/src/ui/automatic_reconstruction_widget.cc:34:
/home/nvidia/colmap/src/ui/model_viewer_widget.h:55:63: error: expected class-name before ‘{’ token
                           protected QOpenGLFunctions_3_2_Core {
                                                               ^
src/CMakeFiles/colmap.dir/build.make:1718: recipe for target 'src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/automatic_reconstruction_widget.cc.o] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

and

With QOpenGLExtraFunctions:

/home/nvidia/colmap/src/ui/model_viewer_widget.cc: In member function ‘virtual void colmap::ModelViewerWidget::initializeGL()’:
/home/nvidia/colmap/src/ui/model_viewer_widget.cc:221:12: error: ‘GL_VERTEX_PROGRAM_POINT_SIZE’ was not declared in this scope
   glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/nvidia/colmap/src/ui/model_viewer_widget.cc:221:12: note: suggested alternative: ‘GL_VERTEX_ARRAY_BINDING’
   glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
            GL_VERTEX_ARRAY_BINDING
/home/nvidia/colmap/src/ui/model_viewer_widget.cc: In member function ‘void colmap::ModelViewerWidget::SelectObject(int, int)’:
/home/nvidia/colmap/src/ui/model_viewer_widget.cc:459:13: error: ‘GL_MULTISAMPLE’ was not declared in this scope
   glDisable(GL_MULTISAMPLE);
             ^~~~~~~~~~~~~~
/home/nvidia/colmap/src/ui/model_viewer_widget.cc:459:13: note: suggested alternative: ‘GL_MULTISAMPLES_NV’
   glDisable(GL_MULTISAMPLE);
             ^~~~~~~~~~~~~~
             GL_MULTISAMPLES_NV
src/CMakeFiles/colmap.dir/build.make:2030: recipe for target 'src/CMakeFiles/colmap.dir/ui/model_viewer_widget.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/ui/model_viewer_widget.cc.o] Error 1
CMakeFiles/Makefile2:1009: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Could you please advice me?

Thank you
Shreyas

@KhaledSharif
Copy link
Contributor Author

@ShreyasManjunath

I believe that I had to remove the model_viewer_widget.cc from my source code in order for it to compile. I'm using the command line version of COLMAP so it wasn't needed for me.

@KhaledSharif
Copy link
Contributor Author

@karthikarvind1295 see comment above

@charlsb
Copy link

charlsb commented Jan 25, 2021

Finally I've been able to compile it on a nVidia Jetson TX1.
These are the changes that I've made:

  • model_viewer_widget.h: change line 38 from #include <QOpenGLFunctions_3_2_Core> to #include <QOpenGLExtraFunctions>, and so line 55 from protected QOpenGLFunctions_3_2_Core { to protected QOpenGLExtraFunctions { (as @KhaledSharif mentioned)
  • model_viewer_widget.cc: manually define non-declared GL capabilities (to solve the error reported by @karthikarvind1295 and @ShreyasManjunath).
    #ifndef GL_MULTISAMPLE #define GL_MULTISAMPLE 0x809D #endif and
    #ifndef GL_VERTEX_PROGRAM_POINT_SIZE #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #endif

Hope it helps

mlourakis added a commit to terzakig/colmap that referenced this issue Jun 20, 2022
mlourakis added a commit to terzakig/colmap that referenced this issue Jun 20, 2022
mlourakis added a commit to terzakig/colmap that referenced this issue Jun 21, 2022
Previous commit did not include all changes suggested in colmap#745
@kxdhwdgq1108
Copy link

我通过将该行从 toprotected QOpenGLFunctions_3_2_Core protected QOpenGLExtraFunctions
This modification will still result in errors:

In file included from /home/hanjie/colmap-3.7/src/ui/main_window.h:50:0,
from /home/hanjie/colmap-3.7/src/exe/gui.h:36,
from /home/hanjie/colmap-3.7/src/exe/feature.cc:36:
/home/hanjie/colmap-3.7/src/ui/model_viewer_widget.h:23:10: fatal error: QOpenGLExtraFunctions_3_2_Core: No such file or directory
#include <QOpenGLExtraFunctions_3_2_Core>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
src/CMakeFiles/colmap.dir/build.make:751: recipe for target 'src/CMakeFiles/colmap.dir/exe/feature.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/exe/feature.cc.o] Error 1
CMakeFiles/Makefile2:768: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

@kxdhwdgq1108
Copy link

Finally I've been able to compile it on a nVidia Jetson TX1. These are the changes that I've made:

  • model_viewer_widget.h: change line 38 from to , and so line 55 from to (as @KhaledSharif mentioned)#include <QOpenGLFunctions_3_2_Core>``#include <QOpenGLExtraFunctions>``protected QOpenGLFunctions_3_2_Core {``protected QOpenGLExtraFunctions {
  • model_viewer_widget.cc: manually define non-declared GL capabilities (to solve the error reported by @karthikarvind1295 and @ShreyasManjunath).
    and#ifndef GL_MULTISAMPLE #define GL_MULTISAMPLE 0x809D #endif
    #ifndef GL_VERTEX_PROGRAM_POINT_SIZE #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #endif

Hope it helps

This modification will still result in errors:
In file included from /home/hanjie/colmap-3.7/src/ui/main_window.h:50:0,
from /home/hanjie/colmap-3.7/src/exe/gui.h:36,
from /home/hanjie/colmap-3.7/src/exe/feature.cc:36:
/home/hanjie/colmap-3.7/src/ui/model_viewer_widget.h:23:10: fatal error: QOpenGLExtraFunctions_3_2_Core: No such file or directory
#include <QOpenGLExtraFunctions_3_2_Core>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
src/CMakeFiles/colmap.dir/build.make:751: recipe for target 'src/CMakeFiles/colmap.dir/exe/feature.cc.o' failed
make[2]: *** [src/CMakeFiles/colmap.dir/exe/feature.cc.o] Error 1
CMakeFiles/Makefile2:768: recipe for target 'src/CMakeFiles/colmap.dir/all' failed
make[1]: *** [src/CMakeFiles/colmap.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

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

8 participants