deptofdefense / AndroidTacticalAssaultKit-CIV

Other
909 stars 323 forks source link

sqlite3sqlite3.h: No such file or directory #183

Open rehovicova opened 2 years ago

rehovicova commented 2 years ago

Hi, I am having this problem while trying to run assembleCivDebug.

[1/238] Building CXX object src/main/cpp/CMakeFiles/takengine.dir/db/Database2.cpp.o
  FAILED: src/main/cpp/CMakeFiles/takengine.dir/db/Database2.cpp.o 
  /home/kristyna/Android/Sdk/ndk/12.1.2977051/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/kristyna/Android/Sdk/ndk/12.1.2977051/platforms/android-24/arch-arm  -DRTTI_ENABLED -DSQLITE_HAS_CODEC -DTE_GLES_VERSION=3 -Dtakengine_EXPORTS -I../../../../../src/main/cpp/. -I../../../../../src/main/cpp/../../../../../stl-soft/include -I/home/kristyna/.conan/data/tinygltf-tak/2.4.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -I/home/kristyna/.conan/data/tinygltfloader-tak/0.9.5/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -I/home/kristyna/.conan/data/ttp-dist/2.0.0/_/_/package/6928a34669bdb7cc655929e5858d2224aa3d3e76/android-armeabi-v7a-release/include -isystem /home/kristyna/Android/Sdk/ndk/12.1.2977051/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/kristyna/Android/Sdk/ndk/12.1.2977051/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/kristyna/Android/Sdk/ndk/12.1.2977051/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem /home/kristyna/Android/Sdk/ndk/12.1.2977051/platforms/android-24/arch-arm/usr/include -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -fexceptions -frtti -O0 -O0  -fPIC   -O3 -std=gnu++11 -MD -MT src/main/cpp/CMakeFiles/takengine.dir/db/Database2.cpp.o -MF src/main/cpp/CMakeFiles/takengine.dir/db/Database2.cpp.o.d -o src/main/cpp/CMakeFiles/takengine.dir/db/Database2.cpp.o -c ../../../../../src/main/cpp/db/Database2.cpp
  ../../../../../src/main/cpp/db/Database2.cpp:13:76: fatal error: sqlite3.h: No such file or directory
   #include "sqlite3.h"                    // Must appear before spatialite.h.
                                                                              ^
  compilation terminated.

I tried to install sqlite3 and libsqlite3-dev packages but it says they are not available (I am building it on Ubuntu 18). How do I fix this error?

matt-msi commented 2 years ago

This is the command we use to install sqlite3 on Ubuntu 20.04 LTS for our ATAK dev environments:

sudo apt install ant sqlite3 dos2unix automake swig cmake tcl tk build-essential autoconf libtool

rehovicova commented 2 years ago

@matt-msi this leads to the exact same result.

Package sqlite3 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'sqlite3' has no installation candidate

EDIT: I upgraded to Ubuntu 20.04 and I was able to install sqlite3, but I am still getting

 ../../../../../src/main/cpp/db/Database2.cpp:13:76: fatal error: sqlite3.h: No such file or directory
   #include "sqlite3.h"                    // Must appear before spatialite.h.
                                                                              ^
  compilation terminated.

when trying to run assembleCivDebug.

matt-msi commented 2 years ago

It sounds like apt is possibly missing what it needs to install sqlite3, suggest to try this and then retry sqlite3 install:

sudo apt-get update

rehovicova commented 2 years ago

I have installed sqlite3

$ sudo apt install sqlite3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
sqlite3 is already the newest version (3.31.1-4ubuntu0.2).

But while building ATAK apk it tells me that sqlite3.h cannot be found.

takdeveloper commented 2 years ago

@rehovicova Assuming master. I'm not sure where the build process is breaking down, so I'll provide some insights that may help you troubleshoot the issue.

libsqlite is distributed as part of the ATAK GitHub monorepo in the SQLCipher tarball (https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/takthirdparty/distfiles/sqlcipher.tar.gz). The current build system is fully closed for library type dependencies, meaning you should not have to install any library development packages, only tools.

Following the prebuild step (aka https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/scripts/prebuild.sh), you should find sqlite3.h under takthirdparty/builds/android-[armeabi-v7a|arm64-v8a|x86]-release/include/sqlite3.h. Starting with ATAK 4.4, libtakengine pulls in the TAK Third Party (aka TTP) dependencies via Conan. prebuild will install TTP to the local Conan repo (~/.conan) as the package, ttp-dist. You can inspect the package in Conan local to ensure that the includes appear to be in place.

Please compare the build process that you followed against one of the GitHub Actions -- the actions do a build from scratch in a pristine environment. You should be able to follow the same steps to get a build going in your local environment.

rehovicova commented 2 years ago

@takdeveloper That was actually helpful. There is only zconf.h and zlib.h in the include/ folder. I ran the prebuild.sh script previously but I didnt notice this error:

configure: error: in `/home/kristyna/Downloads/atak4.5/AndroidTacticalAssaultKit-CIV-4.4.0.15/takthirdparty/builds/android-arm64-v8a-release/libiconv':
configure: error: C preprocessor "aarch64-linux-android-cpp" fails sanity check
See `config.log' for more details
yes
checking for style of include used by make... configure: error: in `/home/kristyna/Downloads/atak4.5/AndroidTacticalAssaultKit-CIV-4.4.0.15/takthirdparty/builds/android-x86-release/libiconv':
configure: error: C preprocessor "i686-linux-android-cpp" fails sanity check
See `config.log' for more details
GNU
checking dependency style of arm-linux-androideabi-gcc... none
checking how to run the C preprocessor... arm-linux-androideabi-cpp
configure: error: in `/home/kristyna/Downloads/atak4.5/AndroidTacticalAssaultKit-CIV-4.4.0.15/takthirdparty/builds/android-armeabi-v7a-release/libiconv':
configure: error: C preprocessor "arm-linux-androideabi-cpp" fails sanity check
See `config.log' for more details
make: *** [mk/libiconv.mk:11: /home/kristyna/Downloads/atak4.5/AndroidTacticalAssaultKit-CIV-4.4.0.15/takthirdparty/builds/android-arm64-v8a-release/libiconv/.configured] Error 1
make: *** [mk/libiconv.mk:11: /home/kristyna/Downloads/atak4.5/AndroidTacticalAssaultKit-CIV-4.4.0.15/takthirdparty/builds/android-x86-release/libiconv/.configured] Error 1

It seems like a problem with my NDK. $ANDROID_NDK points to /home/kristyna/Android/Sdk/ndk/12.1.2977051/ which is the version noted in BUILDING.md. Is there anything else I am forgetting?