[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.
Please include more info on what you are trying to do and what is not working.
use ndk tool chain
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
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.
Cc: @ken-martin
I use the same method
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
.
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.
@ben.boeckel
I like to use vtk 9.1.x in android studio as a native c++ android library module.
-
I built vtk for android many times as static and dynamic in wsl2 linux under windows 10.
-
command in Ubuntu terminal under wsl2 linux subsystem of windows 10:
Android/Sdk/cmake/3.18.1/bin/cmake.exe -DVTK_ANDROID_BUILD=ON -DANDROID_ARCH_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=26 -DANDROID_NDK=/home/myname/Android/Sdk/ndk/21.4.xxx -DANDROID -DCMAKE_MAKE_PROGRAM=/home/myname/Android/Sdk/cmake/3.18.1/bin/ninja -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=26 -DANDROID_PLATFORM=Android-26 -DANDROID_TOOLCHAIN=/home/myname/Android/Sdk/ndk/21.4.xxx/toolchains/llvm/prebuilt/linux-x86_64/ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_CXX_STANDARD=11 -DBUILD_SHARED_LIBS=0 -GNinja …/…/ -
glang & clang++ seems to be the only toolchain used after ndk r17c! that is why I use clang. it seems goes out to my ndk toolchains and calls the aarch64-linux-android26-clang/clang++ hopefully. llvm is the backend for clang toolchain.
-
I also to ccmake to check the setting of the cmake and configure in the ccmake GUI so that it picks up clang toolchain components like clang++ clang clang-ar(archiver for static build) clang-nm etc.
then I do final configure and generate the code. -
I do /home/myname/Android/Sdk/cmake/3.18.1/bin/ninja.
vtk build as static library with all .a library extension under CMakeEternals/… -
I have all my include files and libraries in include/ and lib/ directories in inside the arm64-v8a folder! I check the .a library files with 7zip open archive and it seems different xx.o objects are inside the vtkxxxx.a library, here I assume It is a fine build
-
I copy include/ and lib/ folders of vtk to the windows 10 android studio project folder.
-
I create an android basic project, or it could be native c++ application project.
-
under this android project I add a android library module called vtk. under /src/main/ folder I create a folder called jni; in that I add my android build vtk arm64-v8a lib/ & include/ folders; I add a CMakeLists.txt file; I add vtk-lib.cpp file to include my vtk cone example in that, all include files for cone is there.
-
in the CMakeLists.txt I basically add all my vtkxx.a libraries from android linux built in that. in the target_link_libraries(-Wl, --start-group -L ${TARGET_OUT} … -Wl, --end-group), this assures me that all dependencies are considered inside the vtkxxx.a libraries.
-
I configure my android vtk library to use externalNativeBuild{cmake{ cppflags … arguments… abiFilters ‘arm64-v8a’}}; I compile the lib-vtk.cpp application properly, because if I have a compile error I see the android studio gives me compile error or the name of vtkxxx.a has typo error and etc. so I am sure it comiles; when it comes to link with ninja it gives me clang++ linker error; when I check it, there is not much in error message except except it is ninja build which fails!
c/c++ clang++: error: linker command failed with exit code 1use -v to use invocation).
now I wonder how I can check if there is a problem with my android build of VTK in wsl linux ubuntu? how to check if that is build correctly.
the ndk version is the same in linux android build For VTK and in android studio I set vtk android library use the same ndk.
I use the same cmake from ndk 21.4.xxxx toolchain like I explained.
I need to make sure my vtk android build is correct
thanks
@Sohrab_Azami