GithubHelp home page GithubHelp logo

Compiling for arm? about badslam HOT 13 OPEN

eth3d avatar eth3d commented on July 18, 2024
Compiling for arm?

from badslam.

Comments (13)

donalj avatar donalj commented on July 18, 2024 1

@donalj Did you get this working on the Jetson Nano?

@tkircher sorry for the late response. I did, but like mentioned above, it was too heavy for the Nano. I did manage to get it to run with some of the example datasets but when using physical cameras (kinect v2 and Realsense d435i) it couldn't handle it. If you want to try I think I made a set of instructions on how to build/run it for the Nano that I could give.

from badslam.

tkircher avatar tkircher commented on July 18, 2024 1

I should mention, I'm especially curious in trying one more time to get badslam working, because I'm getting an Xavier NX soonish which has better performance.

from badslam.

puzzlepaint avatar puzzlepaint commented on July 18, 2024

I don't know, I haven't tried.

from badslam.

magnusbarata avatar magnusbarata commented on July 18, 2024

It seems like arm is not yet supported. I have installed all the dependencies, and had succeeded on generating cmake files, but gets the c++: error: unrecognized command line option ‘-msse2’ error on compile. Then I tried to remove -msse option from CMakeLists.txt and recompile but still no luck. Here is part of the error message:

[  0%] Built target Dependencies
[  0%] Generating pnglibconf.c
[  0%] Building CXX object CMakeFiles/loguru.dir/libvis/third_party/loguru/loguru.cpp.o
[  0%] Generating pngprefix.h
[  0%] Generating scripts/pnglibconf.c
[  0%] Generating scripts/symbols.out
[  0%] Generating pnglibconf.out
[  1%] Generating scripts/symbols.chk
[  3%] Generating pnglibconf.h
[  4%] Generating scripts/prefix.out
[  4%] Generating scripts/sym.out
[  6%] Generating scripts/vers.out
[  7%] Generating scripts/intprefix.out
[  7%] Generating libpng.sym
[  9%] Generating libpng.vers
[  9%] Built target genfiles
[ 10%] Automatic MOC and RCC for target DBoW2
[ 10%] Built target DBoW2_autogen
Scanning dependencies of target png
[ 10%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/png.c.o
[ 12%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngerror.c.o
[ 12%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngget.c.o
[ 12%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngmem.c.o
[ 14%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngpread.c.o
[ 14%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngread.c.o
[ 15%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngrio.c.o
[ 15%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngrtran.c.o
[ 17%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngrutil.c.o
[ 17%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngset.c.o
[ 18%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngtrans.c.o
[ 18%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngwio.c.o
[ 20%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngwrite.c.o
[ 20%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngwtran.c.o
[ 20%] Building C object libvis/third_party/libpng/CMakeFiles/png.dir/pngwutil.c.o
...
...
...
[ 37%] Built target DBoW2
[ 39%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_display.cc.o
[ 39%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_display_qt_widget.cc.o
[ 40%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_display_qt_window.cc.o
[ 40%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_io.cc.o
[ 42%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_io_libpng.cc.o
[ 42%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_io_netpbm.cc.o
[ 43%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/image_io_qt.cc.o
[ 43%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/libvis.cc.o
[ 43%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/opengl.cc.o
[ 45%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/opengl_context.cc.o
[ 45%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/opengl_context_glx.cc.o
[ 46%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/opengl_context_qt.cc.o
[ 46%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/patch_match_stereo.cc.o
[ 48%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/qt_thread.cc.o
[ 48%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/render_display.cc.o
[ 50%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/render_window.cc.o
[ 50%] Building CXX object CMakeFiles/libvis.dir/libvis/src/libvis/render_window_qt.cc.o
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:526:60: error: ‘void __glewActiveTexture(GLenum)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
                                                            ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:16749:40: note: previous declaration ‘void (* __glewActiveTexture)(GLenum)’
 GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;
                                        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:527:74: error: ‘void __glewAttachShader(GLuint, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
                                                                          ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:16864:39: note: previous declaration ‘void (* __glewAttachShader)(GLuint, GLuint)’
 GLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader;
                                       ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:528:99: error: ‘void __glewBindAttribLocation(GLuint, GLuint, const GLchar*)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
                                                                                                   ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:16865:45: note: previous declaration ‘void (* __glewBindAttribLocation)(GLuint, GLuint, const GLchar*)’
 GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation;
                                             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:529:71: error: ‘void __glewBindBuffer(GLenum, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
                                                                       ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:16845:37: note: previous declaration ‘void (* __glewBindBuffer)(GLenum, GLuint)’
 GLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer;
                                     ^~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:530:81: error: ‘void __glewBindFramebuffer(GLenum, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
...
...
...
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:17831:45: note: previous declaration ‘void (* __glewVertexAttribFormat)(GLuint, GLint, GLenum, GLboolean, GLuint)’
 GLEW_FUN_EXPORT PFNGLVERTEXATTRIBFORMATPROC __glewVertexAttribFormat;
                                             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:1516:118: error: ‘void __glewVertexAttribIFormat(GLuint, GLint, GLenum, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
                                                                                                                      ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:17832:46: note: previous declaration ‘void (* __glewVertexAttribIFormat)(GLuint, GLint, GLenum, GLuint)’
 GLEW_FUN_EXPORT PFNGLVERTEXATTRIBIFORMATPROC __glewVertexAttribIFormat;
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:1517:91: error: ‘void __glewVertexAttribBinding(GLuint, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
                                                                                           ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:17830:46: note: previous declaration ‘void (* __glewVertexAttribBinding)(GLuint, GLuint)’
 GLEW_FUN_EXPORT PFNGLVERTEXATTRIBBINDINGPROC __glewVertexAttribBinding;
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/qt5/QtGui/qopengl.h:105:0,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/aarch64-linux-gnu/qt5/QtWidgets/QOpenGLWidget:1,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:34,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GLES3/gl31.h:1518:88: error: ‘void __glewVertexBindingDivisor(GLuint, GLuint)’ redeclared as different kind of symbol
 GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
                                                                                        ^
In file included from /home/optimizer/badslam/./libvis/src/libvis/opengl.h:48:0,
                 from /home/optimizer/badslam/./libvis/src/libvis/render_window_qt_opengl.h:32,
                 from /home/optimizer/badslam/libvis/src/libvis/render_window.cc:33:
/usr/include/GL/glew.h:17834:47: note: previous declaration ‘void (* __glewVertexBindingDivisor)(GLuint, GLuint)’
 GLEW_FUN_EXPORT PFNGLVERTEXBINDINGDIVISORPROC __glewVertexBindingDivisor;
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
CMakeFiles/libvis.dir/build.make:494: recipe for target 'CMakeFiles/libvis.dir/libvis/src/libvis/render_window.cc.o' failed
make[3]: *** [CMakeFiles/libvis.dir/libvis/src/libvis/render_window.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:146: recipe for target 'CMakeFiles/libvis.dir/all' failed
make[2]: *** [CMakeFiles/libvis.dir/all] Error 2
CMakeFiles/Makefile2:875: recipe for target 'applications/badslam/CMakeFiles/badslam.dir/rule' failed
make[1]: *** [applications/badslam/CMakeFiles/badslam.dir/rule] Error 2
Makefile:435: recipe for target 'badslam' failed
make: *** [badslam] Error 2

Any help?
Thanks in advance.

from badslam.

puzzlepaint avatar puzzlepaint commented on July 18, 2024

Seems that GLEW conflicts with Qt's OpenGL support. One way to address this might be to try to separate the includes, such that no file includes both glew.h and Qt's opengl.h. Another, possibly simpler, way might be to drop GLEW altogether and use Qt's OpenGL functions instead. See the corresponding Qt documentation for QOpenGLWidget. Basically, one could obtain an OpenGL function object at the start of functions dealing with OpenGL, like:

QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions();

and then prefix all gl functions with f->.

from badslam.

donalj avatar donalj commented on July 18, 2024

On ARM architectures, the Qt5 version you get with apt-get install qt5-default is built with GLES which is where the conflicts arise. You can build Qt5 from source using following the steps here and at Step 3 do

./configure -opengl desktop 

If you do this I would recommend cross-compiling as it took 4-5 hours for Qt5 to build on my Nano.

Make sure to also modify CMakeLists.txt as like @magnusbarata said, the -msse* options are for x86/x86-64 and is not supported on ARM. You can either remove these lines from the CMakeLists.txt or wrap them in an

  if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
    set(LIBVIS_WARNING_OPTIONS "${LIBVIS_WARNING_OPTIONS};$<$<COMPILE_LANGUAGE:CXX>:-msse2>")
    set(LIBVIS_WARNING_OPTIONS "${LIBVIS_WARNING_OPTIONS};$<$<COMPILE_LANGUAGE:CXX>:-msse3>")
  endif()  

from badslam.

magnusbarata avatar magnusbarata commented on July 18, 2024

Thank you for your reply @puzzlepaint and @donalj. Both answers provide solution for compiling with jetson nano. In the end, it seems like the slam work is too heavy for jetson nano.

from badslam.

tkircher avatar tkircher commented on July 18, 2024

@donalj Did you get this working on the Jetson Nano?

from badslam.

tkircher avatar tkircher commented on July 18, 2024

@donalj I just got the Kinect Azure DK working in RTAB-Map, just a few minutes ago.

https://github.com/tkircher/rtabmap

Should be merged in main tomorrow. I'm curious to know how you got badslam working on the Nano. I got it compiled but it never seemed to do anything. I didn't have the energy to track down whatever issue I was having, but it does make amazingly great point clouds on my i7 workstation.

from badslam.

jcyhcs avatar jcyhcs commented on July 18, 2024

@tkircher
hi,professor, have you success run badslam on jetson xavier nx? i have success run on jetson nano, but jetson nano too weak

from badslam.

mississippia avatar mississippia commented on July 18, 2024

I have succeed compiled badslam on a TX2 NX and tested it with a Kinect Azure DK on realtime.
The key is to compile Qt5 form source with desktop configuration of openGL.
It will run but won't last.
Since Tx2 has a 4GB GPU memory, and badslam takes 3.5GB+ in initialization, and 10MB+ per second during running, if GPU memory safety threshold is set to 250 MB, then badslam can run for less than 2 minutes.
More to it , RGBD input won't work, use a IR image stream input.
badslam
It's my office, pretty abstract...

from badslam.

puzzlepaint avatar puzzlepaint commented on July 18, 2024

Regarding the initial GPU memory consumption, notice that this is largely due to the pre-allocation of ample memory for surfel storage. However, under normal conditions, the default number of surfels won't be reached. In the screenshot above, only a tiny fraction of the 25 million pre-allocated surfels are actually used, as seen from the corresponding display in the window's status bar. To reduce the initial memory consumption, the number of surfels pre-allocated can thus be reduced. This may be done with the --max_surfel_count command-line parameter.

from badslam.

mississippia avatar mississippia commented on July 18, 2024

badslam_tx2
@puzzlepaint
I changed the max surfel count, it works.
Now I can run with RGB stream input.
Tx2 is a little bit slow, badslam runs with a significant delay.

from badslam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.