qwertycoin-org / qwertycoin

Qwertycoin is a decentralized peer-to-peer protocol for safe payments worldwide.
https://qwertycoin.org
MIT License
33 stars 29 forks source link

Can't compile it on linux for android #37

Closed Sw0rdf1sh1 closed 5 years ago

Sw0rdf1sh1 commented 5 years ago

Hello, i can't compile it for android on ubuntu:

root@xnx-virtual-machine:~/qwertycoin/build# cmake -DCMAKE_TOOLCHAIN_FILE=/root/qwertycoin/cmake/polly/android-ndk-r18b-api-21-x86-clang-libcxx.cmake -DBUILD_TESTS=OFF -DSTATIC=ON -DBUILD_64=OFF -DANDROID=true -DBUILD_TAG="android" .. -- Building build tag android CMake Warning (dev) at CMakeLists.txt:83 (set): implicitly converting 'TYPE' to 'STRING' type. This warning is for project developers. Use -Wno-dev to suppress it.

-- Building for a 32-bit system -- Building internal libraries as static -- Building on x86_64 for native -- AES support enabled -- Enabling PIE executable -- Installing Boost using Hunter package manager... -- [hunter] Calculating Toolchain-SHA1

[hunter INTERNAL ] Compilation of /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp failed. Result: FALSE

[hunter INTERNAL ] Output: --- OUTPUT BEGIN --- Change Dir: /root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_8a4b4/fast /usr/bin/make -f CMakeFiles/cmTC_8a4b4.dir/build.make CMakeFiles/cmTC_8a4b4.dir/build make[1]: Verzeichnis „/root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp“ wird betreten Building CXX object CMakeFiles/cmTC_8a4b4.dir/ShowPredefined.cpp.o /root/.android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android --gcc-toolchain=/root/.android/android-ndk-r18b/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/root/.android/android-ndk-r18b/sysroot -DANDROID -isystem /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include -isystem /root/.android/android-ndk-r18b/sources/android/support/include -isystem /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++abi/include -std=c++11 -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=21 -fexceptions -frtti -g -fPIE -std=c++11 -o CMakeFiles/cmTC_8a4b4.dir/ShowPredefined.cpp.o -c /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp In file included from /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp:12: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/exception:82: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cstdlib:86: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stdlib.h:94: In file included from /root/.android/android-ndk-r18b/sources/android/support/include/stdlib.h:32: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/stdlib.h:34: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/malloc.h:22: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stdio.h:108: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/stdio.h:42: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/sys/types.h:36: /root/.android/android-ndk-r18b/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found

include <asm/types.h>

     ^~~~~~~~~~~~~

1 error generated. CMakeFiles/cmTC_8a4b4.dir/build.make:65: die Regel für Ziel „CMakeFiles/cmTC_8a4b4.dir/ShowPredefined.cpp.o“ scheiterte make[1]: [CMakeFiles/cmTC_8a4b4.dir/ShowPredefined.cpp.o] Fehler 1 make[1]: Verzeichnis „/root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp“ wird verlassen Makefile:121: die Regel für Ziel „cmTC_8a4b4/fast“ scheiterte make: [cmTC_8a4b4/fast] Fehler 2

--- OUTPUT END --- [hunter INTERNAL ] [Directory:/root/qwertycoin/build/_3rdParty/Hunter/toolchain]

------------------------------ WIKI ------------------------------- https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message): Call Stack (most recent call first): /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_wiki) CMakeLists.txt:85 (hunter_internal_error)

[hunter INTERNAL ] Generate failed: exit with code 1 [hunter INTERNAL ] [Directory:/root/qwertycoin]

------------------------------ WIKI ------------------------------- https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message): Call Stack (most recent call first): /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_wiki) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_calculate_toolchain_sha1.cmake:110 (hunter_internal_error) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_apply_gate_settings.cmake:135 (hunter_calculate_toolchain_sha1) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_finalize.cmake:73 (hunter_apply_gate_settings) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_add_package.cmake:23 (hunter_finalize) CMakeLists.txt:501 (hunter_add_package)

-- Configuring incomplete, errors occurred! See also "/root/qwertycoin/build/CMakeFiles/CMakeOutput.log". See also "/root/qwertycoin/build/CMakeFiles/CMakeError.log". root@xnx-virtual-machine:~/qwertycoin/build#

speqtr commented 5 years ago

Hi @nnian,

In the latest PR hunter (package manager) was updated to the newest available version. So the first thing that can fix an issue is "remove /root/.hunter folder, remove build folder and do a clean build". Because it can be a simple version/cache mismatch for newer version of hunter.

Also the error says "fatal error: 'asm/types.h' file not found", so if the first method doesn't help then try to install linux-libc-dev and linux-libc-dev:i386 packages (those should have necessary header file).

Also please note that the build for Android requires installed gcc compiler on the system (the newer the better). It will be used internally during the build process while the app itself will be build with clang from Android NDK.

speqtr commented 5 years ago

NOTE: On Travis CI Android builds are running on Ubuntu 16.04, so you can additionally check if all the dependencies are installed on your system by looking inside .travis.yml file.

Sw0rdf1sh1 commented 5 years ago

Hi @speqtr

this is what i'm doing:

mkdir -p "$HOME/.android"
wget -O "$HOME/.android/android-ndk-r18b-linux-x86_64.zip" "https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip"
unzip -qq "$HOME/.android/android-ndk-r18b-linux-x86_64.zip" -d "$HOME/.android"

#

export CMAKE_GENERATOR_NAME="Unix Makefiles"
export CMAKE_TOOLCHAIN_FILE_NAME=android-ndk-r18b-api-21-x86-clang-libcxx.cmake
export ANDROID_NDK_r18b="$HOME/.android/android-ndk-r18b"

#

cmake -G "$CMAKE_GENERATOR_NAME" -DCMAKE_TOOLCHAIN_FILE=cmake/polly/android-ndk-r18b-api-21-x86-clang-libcxx.cmake -DBUILD_TESTS=OFF -DSTATIC=ON -DBUILD_64=OFF -DANDROID=true -DBUILD_TAG="android" ..

cmake --build . --config Release

My Test VM: Ubuntu 16.x Gcc: Version 6.0.1 All Build Essentials

After complete reinstall i got the same error. I will try it tomorrow again

Log:

`root@ubuntu-2gb-nbg1-2:~/qwertycoin/build# cmake -G "$CMAKE_GENERATOR_NAME" -DCMAKE_TOOLCHAIN_FILE=cmake/polly/android-ndk-r18b-api-21-x86-clang-libcxx.cmake -DBUILD_TESTS=OFF -DSTATIC=ON -DBUILD_64=OFF -DANDROID=true -DBUILD_TAG="android" .. -- Building build tag android CMake Warning (dev) at CMakeLists.txt:83 (set): implicitly converting 'TYPE' to 'STRING' type. This warning is for project developers. Use -Wno-dev to suppress it.

-- [polly] Used toolchain: Android NDK r18b / API 21 / x86 / Clang / c++11 support / libc++ static -- Building for a 32-bit system -- Building internal libraries as static -- Could NOT find Threads (missing: Threads_FOUND) -- Building on i686 for native -- AES support enabled -- Enabling PIE executable -- Installing Boost using Hunter package manager... -- [hunter] Calculating Toolchain-SHA1 CMake Error at /usr/share/cmake-3.14/Modules/CMakeDetermineSystem.cmake:99 (message): Could not find toolchain file: cmake/polly/android-ndk-r18b-api-21-x86-clang-libcxx.cmake Call Stack (most recent call first): CMakeLists.txt:2 (project)

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

[hunter INTERNAL ] Generate failed: exit with code 1 [hunter INTERNAL ] [Directory:/root/qwertycoin]

------------------------------ WIKI ------------------------------- https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message): Call Stack (most recent call first): /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_wiki) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_calculate_toolchain_sha1.cmake:110 (hunter_internal_error) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_apply_gate_settings.cmake:135 (hunter_calculate_toolchain_sha1) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_finalize.cmake:73 (hunter_apply_gate_settings) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_add_package.cmake:23 (hunter_finalize) CMakeLists.txt:501 (hunter_add_package)

-- Configuring incomplete, errors occurred! See also "/root/qwertycoin/build/CMakeFiles/CMakeOutput.log". See also "/root/qwertycoin/build/CMakeFiles/CMakeError.log". root@ubuntu-2gb-nbg1-2:~/qwertycoin/build# clear root@ubuntu-2gb-nbg1-2:~/qwertycoin/build# cmake -G "$CMAKE_GENERATOR_NAME" -DCMAKE_TOOLCHAIN_FILE=/root/qwertycoin/cmake/polly/android-ndk-r18b-api-21-x86-clang-libcxx.cmake -DBUILD_TESTS=OFF -DSTATIC=ON -DBUILD_64=OFF -DANDROID=true -DBUILD_TAG="android" .. -- Building build tag android CMake Warning (dev) at CMakeLists.txt:83 (set): implicitly converting 'TYPE' to 'STRING' type. This warning is for project developers. Use -Wno-dev to suppress it.

-- [polly] Used toolchain: Android NDK r18b / API 21 / x86 / Clang / c++11 support / libc++ static -- Building for a 32-bit system -- Building internal libraries as static -- Could NOT find Threads (missing: Threads_FOUND) -- Building on i686 for native -- AES support enabled -- Enabling PIE executable -- Installing Boost using Hunter package manager... -- [hunter] Calculating Toolchain-SHA1

[hunter INTERNAL ] Compilation of /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp failed. Result: FALSE

[hunter INTERNAL ] Output: --- OUTPUT BEGIN --- Change Dir: /root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_9a1d6/fast /usr/bin/make -f CMakeFiles/cmTC_9a1d6.dir/build.make CMakeFiles/cmTC_9a1d6.dir/build make[1]: Entering directory '/root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_9a1d6.dir/ShowPredefined.cpp.o /root/.android/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android --gcc-toolchain=/root/.android/android-ndk-r18b/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/root/.android/android-ndk-r18b/sysroot -DANDROID -isystem /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include -isystem /root/.android/android-ndk-r18b/sources/android/support/include -isystem /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++abi/include -std=c++11 -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=21 -fexceptions -frtti -g -fPIE -std=c++11 -o CMakeFiles/cmTC_9a1d6.dir/ShowPredefined.cpp.o -c /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp In file included from /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/scripts/ShowPredefined.cpp:12: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/exception:82: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cstdlib:86: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stdlib.h:94: In file included from /root/.android/android-ndk-r18b/sources/android/support/include/stdlib.h:32: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/stdlib.h:34: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/malloc.h:22: In file included from /root/.android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/stdio.h:108: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/stdio.h:42: In file included from /root/.android/android-ndk-r18b/sysroot/usr/include/sys/types.h:36: /root/.android/android-ndk-r18b/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found

include <asm/types.h>

     ^~~~~~~~~~~~~

1 error generated. CMakeFiles/cmTC_9a1d6.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_9a1d6.dir/ShowPredefined.cpp.o' failed make[1]: [CMakeFiles/cmTC_9a1d6.dir/ShowPredefined.cpp.o] Error 1 make[1]: Leaving directory '/root/qwertycoin/build/_3rdParty/Hunter/toolchain/_builds/_test/CMakeFiles/CMakeTmp' Makefile:121: recipe for target 'cmTC_9a1d6/fast' failed make: [cmTC_9a1d6/fast] Error 2

--- OUTPUT END --- [hunter INTERNAL ] [Directory:/root/qwertycoin/build/_3rdParty/Hunter/toolchain]

------------------------------ WIKI ------------------------------- https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message): Call Stack (most recent call first): /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_wiki) CMakeLists.txt:85 (hunter_internal_error)

[hunter INTERNAL ] Generate failed: exit with code 1 [hunter INTERNAL ] [Directory:/root/qwertycoin]

------------------------------ WIKI ------------------------------- https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message): Call Stack (most recent call first): /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_wiki) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_calculate_toolchain_sha1.cmake:110 (hunter_internal_error) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_apply_gate_settings.cmake:135 (hunter_calculate_toolchain_sha1) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_finalize.cmake:73 (hunter_apply_gate_settings) /root/.hunter/_Base/Download/Hunter/0.23.105/1c7aaff/Unpacked/cmake/modules/hunter_add_package.cmake:23 (hunter_finalize) CMakeLists.txt:501 (hunter_add_package)

-- Configuring incomplete, errors occurred! See also "/root/qwertycoin/build/CMakeFiles/CMakeOutput.log". See also "/root/qwertycoin/build/CMakeFiles/CMakeError.log". root@ubuntu-2gb-nbg1-2:~/qwertycoin/build# `

speqtr commented 5 years ago

@nnian you could also try running export ARCH=x86 and then run build process again.

speqtr commented 5 years ago

Also please make sure that all the necessary kernel headers are installed by running:

sudo apt-get install linux-headers-$(uname -r)
speqtr commented 5 years ago

Basically, in order to fix this issue you just need to figure out why build system can't find asm/types.h include on your virtual machine.

speqtr commented 5 years ago

@nnian were you able to compile from source for linux target inside this VM? Or did you get the same error?

Sw0rdf1sh1 commented 5 years ago

@speqtr i've changed to Ubuntu 18.x and it's working now 💯 Strange bug under Ubuntu 16.x Anyway i could compile it now.

speqtr commented 5 years ago

@nnian glad that it worked for you with Ubuntu 18.04 🙂

speqtr commented 5 years ago

Can we close this issue? Seems to be resolved :)

cc @qwertycoin-org