I want to use VTK on Android.

(文峰 阮) #1

[10/1033] Building CXX object IO/Export/CMakeFiles/vtkIOExport.dir/vtkGL2PSExporter.cxx.o
FAILED: IO/Export/CMakeFiles/vtkIOExport.dir/vtkGL2PSExporter.cxx.o
D:\Android\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi28 --gcc-toolchain=D:/Android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DVTK_IN_VTK -IIO/Export -I…/IO/Export -ICommon/Core -I…/Common/Core -IUtilities/KWIML -I…/Utilities/KWIML -IUtilities/KWSys -I…/Utilities/KWSys -IThirdParty/utf8 -I…/ThirdParty/utf8 -ICommon/DataModel -I…/Common/DataModel -ICommon/Math -I…/Common/Math -ICommon/Misc -I…/Common/Misc -ICommon/System -I…/Common/System -ICommon/Transforms -I…/Common/Transforms -IFilters/Geometry -I…/Filters/Geometry -ICommon/ExecutionModel -I…/Common/ExecutionModel -IFilters/Core -I…/Filters/Core -IIO/Core -I…/IO/Core -I…/ThirdParty/doubleconversion/vtkdoubleconversion -IThirdParty/doubleconversion/vtkdoubleconversion -IThirdParty/doubleconversion -I…/ThirdParty/doubleconversion -I…/ThirdParty/lz4/vtklz4/lib -IThirdParty/lz4/vtklz4 -IThirdParty/lz4 -I…/ThirdParty/lz4 -IThirdParty/lzma -I…/ThirdParty/lzma -IThirdParty/zlib -I…/ThirdParty/zlib -IIO/Image -I…/IO/Image -IUtilities/DICOMParser -I…/Utilities/DICOMParser -IUtilities/MetaIO/vtkmetaio -IUtilities/MetaIO -I…/Utilities/MetaIO -IThirdParty/jpeg/vtkjpeg -IThirdParty/jpeg -I…/ThirdParty/jpeg -IThirdParty/png -I…/ThirdParty/png -IThirdParty/tiff/vtktiff/libtiff -IThirdParty/tiff -I…/ThirdParty/tiff -IIO/XML -I…/IO/XML -IIO/XMLParser -I…/IO/XMLParser -IThirdParty/expat -I…/ThirdParty/expat -IImaging/Core -I…/Imaging/Core -IRendering/Context2D -I…/Rendering/Context2D -IFilters/General -I…/Filters/General -ICommon/ComputationalGeometry -I…/Common/ComputationalGeometry -IRendering/Core -I…/Rendering/Core -ICommon/Color -I…/Common/Color -IFilters/Sources -I…/Filters/Sources -IRendering/FreeType -I…/Rendering/FreeType -IThirdParty/freetype -I…/ThirdParty/freetype -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -mfpu=neon -Wa,–noexecstack -Wformat -Werror=format-security -stdlib=libc++ -O0 -fno-limit-debug-info -fPIC -std=c++11 -MD -MT IO/Export/CMakeFiles/vtkIOExport.dir/vtkGL2PSExporter.cxx.o -MF IO\Export\CMakeFiles\vtkIOExport.dir\vtkGL2PSExporter.cxx.o.d -o IO/Export/CMakeFiles/vtkIOExport.dir/vtkGL2PSExporter.cxx.o -c …/IO/Export/vtkGL2PSExporter.cxx
…/IO/Export/vtkGL2PSExporter.cxx:22:10: fatal error: ‘vtk_gl2ps.h’ file not found
#include “vtk_gl2ps.h”
^~~~~~~~~~~~~
1 error generated.
[15/1033] Building CXX object IO/Export/CMakeFiles/vtkIOExport.dir/vtkPOVExporter.cxx.o
ninja: build stopped: subcommand failed.

(Mathieu Westphal (Kitware)) #2

Please include more info on what you are trying to do and what is not working.

(文峰 阮) #4

use ndk tool chain

(文峰 阮) #5

I want to use VTK on Android.
Some problems have been solved, but there are still some problems that can not be solved.

Here is one of the problems

…/IO/Export/vtkGL2PSExporter.cxx:22:10: fatal error: ‘vtk_gl2ps.h’ file not found
#include “vtk_gl2ps.h”
^~~~~~~~~~~~~
1 error generated.
[15/1033] Building CXX object IO/Export/CMakeFiles/vtkIOExport.dir/vtkPOVExporter.cxx.o
ninja: build stopped: subcommand failed
(Ben Boeckel) #6

There’s the VTK_ANDROID_BUILD option which should do things properly. It makes a superbuild which generates the VTK executables for the host and then uses those with the Android toolchain to compile for the device.

(Ben Boeckel) #7

Cc: @ken-martin

(文峰 阮) #8

I use the same method

(Ben Boeckel) #9

This seems to be with 8.2. On master, this class is masked to not build on Android. Try commenting out the vtkGL2PSExporter source addition in the associated CMakeLists.txt.

(文峰 阮) #10

Thank for your reply
The following problem has occurred. I am going to collapse

D:\Android\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi28 --gcc-toolchain=D:/Android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/Android/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -DGLEW_STATIC -DVTK_IN_VTK -IRendering/ContextOpenGL2 -I../Rendering/ContextOpenGL2 -ICommon/Core -I../Common/Core -IUtilities/KWIML -I../Utilities/KWIML -IUtilities/KWSys -I../Utilities/KWSys -IThirdParty/utf8 -I../ThirdParty/utf8 -ICommon/DataModel -I../Common/DataModel -ICommon/Math -I../Common/Math -ICommon/Misc -I../Common/Misc -ICommon/System -I../Common/System -ICommon/Transforms -I../Common/Transforms -IImaging/Core -I../Imaging/Core -ICommon/ExecutionModel -I../Common/ExecutionModel -IRendering/Context2D -I../Rendering/Context2D -IFilters/General -I../Filters/General -ICommon/ComputationalGeometry -I../Common/ComputationalGeometry -IFilters/Core -I../Filters/Core -IRendering/Core -I../Rendering/Core -ICommon/Color -I../Common/Color -IFilters/Geometry -I../Filters/Geometry -IFilters/Sources -I../Filters/Sources -IRendering/FreeType -I../Rendering/FreeType -IThirdParty/freetype -I../ThirdParty/freetype -IThirdParty/zlib -I../ThirdParty/zlib -IRendering/OpenGL2 -I../Rendering/OpenGL2 -IThirdParty/glew -I../ThirdParty/glew -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++   -O0 -fno-limit-debug-info  -fPIC   -std=c++11 -MD -MT Rendering/ContextOpenGL2/CMakeFiles/vtkRenderingContextOpenGL2.dir/vtkOpenGLContextDevice2D.cxx.o -MF Rendering\ContextOpenGL2\CMakeFiles\vtkRenderingContextOpenGL2.dir\vtkOpenGLContextDevice2D.cxx.o.d -o Rendering/ContextOpenGL2/CMakeFiles/vtkRenderingContextOpenGL2.dir/vtkOpenGLContextDevice2D.cxx.o -c ../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx
In file included from ../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:60:
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2DPrivate.h:316:32: error: use of undeclared identifier 'GL_DRAW_BUFFER'
      ostate->vtkglGetIntegerv(GL_DRAW_BUFFER, &this->SavedDrawBuffer);
                               ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:342:14: error: use of undeclared identifier 'GL_LINE_SMOOTH'
    glEnable(GL_LINE_SMOOTH);
             ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:369:15: error: use of undeclared identifier 'GL_LINE_SMOOTH'
    glDisable(GL_LINE_SMOOTH);
              ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1174:16: error: use of undeclared identifier 'GL_POINT_SPRITE'
      glEnable(GL_POINT_SPRITE);
               ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1175:17: error: use of undeclared identifier 'GL_POINT_SPRITE'
      glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
                ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1175:34: error: use of undeclared identifier 'GL_COORD_REPLACE'
      glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
                                 ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1177:23: error: use of undeclared identifier 'GL_POINT_SPRITE_COORD_ORIGIN'
    glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
                      ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1177:53: error: use of undeclared identifier 'GL_LOWER_LEFT'
    glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
                                                    ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1185:17: error: use of undeclared identifier 'GL_POINT_SPRITE'
      glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
                ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1185:34: error: use of undeclared identifier 'GL_COORD_REPLACE'
      glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
                                 ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1186:17: error: use of undeclared identifier 'GL_POINT_SPRITE'
      glDisable(GL_POINT_SPRITE);
                ^
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:2001:3: error: use of undeclared identifier 'glPointSize'; did you mean 'SetPointSize'?
  glPointSize(size);
  ^~~~~~~~~~~
  SetPointSize
../Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx:1994:32: note: 'SetPointSize' declared here
void vtkOpenGLContextDevice2D::SetPointSize(float size)
                               ^
12 errors generated.
ninja: build stopped: subcommand failed.