androidthings / sample-nativepio

Basic Peripheral I/O examples in C/C++ with Android Things
Apache License 2.0
48 stars 28 forks source link

Latest version of `native-libandroidthings` makes the build fail #4

Open leinardi opened 6 years ago

leinardi commented 6 years ago

The latest version of native-libandroidthings (6900125a40e7ce4f76f094b67ba78a2defdb7709) is breaking the build of this project:

$ ./gradlew build

> Task :blink:generateJsonModelDebug
-- Check for working C compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found AndroidThings: /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/armeabi-v7a/lib/libandroidthings.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/leinardi/Workspace/androidThings/sample-nativepio/blink/.externalNativeBuild/cmake/debug/armeabi-v7a
-- Check for working C compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
-- Check for working CXX compiler: /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found AndroidThings: /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/x86/lib/libandroidthings.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/leinardi/Workspace/androidThings/sample-nativepio/blink/.externalNativeBuild/cmake/debug/x86

> Task :blink:externalNativeBuildDebug
Build blink x86
[1/6] Building C object CMakeFiles/native-app-glue.dir/home/leinardi/android-sdk/ndk-bundle/sources/android/native_app_glue/android_native_app_glue.c.o
[2/6] Building CXX object CMakeFiles/android-system-properties.dir/home/leinardi/Workspace/androidThings/sample-nativepio/android-system-properties/AndroidSystemProperties.cpp.o
[3/6] Linking C static library libnative-app-glue.a
[4/6] Linking CXX static library libandroid-system-properties.a
[5/6] Building CXX object CMakeFiles/blink.dir/blink.cpp.o
[6/6] Linking CXX shared library /home/leinardi/Workspace/androidThings/sample-nativepio/blink/build/intermediates/cmake/debug/obj/x86/libblink.so
FAILED: : && /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=i686-none-linux-android --gcc-toolchain=/home/leinardi/android-sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/home/leinardi/android-sdk/ndk-bundle/sysroot -fPIC -isystem /home/leinardi/android-sdk/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=26 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11  -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /home/leinardi/android-sdk/ndk-bundle/platforms/android-26/arch-x86 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now  -u ANativeActivity_onCreate -shared -Wl,-soname,libblink.so -o /home/leinardi/Workspace/androidThings/sample-nativepio/blink/build/intermediates/cmake/debug/obj/x86/libblink.so CMakeFiles/blink.dir/blink.cpp.o  -landroid -llog libnative-app-glue.a /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/x86/lib/libandroidthings.so libandroid-system-properties.a -latomic -lm "/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a" "/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a" && :
/home/leinardi/android-sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/x86/lib/libandroidthings.so: incompatible target
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:51: error: undefined reference to 'APeripheralManagerClient_new'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/m
ain/cpp/blink.cpp:54: error: undefined reference to 'APeripheralManagerClient_openGpio'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:56: error: undefined reference to 'AGpio_setDirection'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:61: error: undefined reference to 'AGpio_getValue'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:65: error: undefined reference to 'AGpio_setValue'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:82: error: undefined reference to 'AGpio_delete'
/home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:83: error: undefined reference to 'APeripheralManagerClient_delete'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':blink:externalNativeBuildDebug'.
> Build command failed.
  Error while executing process /media/Dati_ext4/android-sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/leinardi/Workspace/androidThings/sample-nativepio/blink/.externalNativeBuild/cmake/debug/x86 --target blink}
  [1/6] Building C object CMakeFiles/native-app-glue.dir/home/leinardi/android-sdk/ndk-bundle/sources/android/native_app_glue/android_native_app_glue.c.o
  [2/6] Building CXX object CMakeFiles/android-system-properties.dir/home/leinardi/Workspace/androidThings/sample-nativepio/android-system-properties/AndroidSystemProperties.cpp.o
  [3/6] Linking C static library libnative-app-glue.a
  [4/6] Linking CXX static library libandroid-system-properties.a
  [5/6] Building CXX object CMakeFiles/blink.dir/blink.cpp.o
  [6/6] Linking CXX shared library /home/leinardi/Workspace/androidThings/sample-nativepio/blink/build/intermediates/cmake/debug/obj/x86/libblink.so
  FAILED: : && /home/leinardi/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=i686-none-linux-android --gcc-toolchain=/home/leinardi/android-sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64 --sysroot=/home/leinardi/android-sdk/ndk-bundle/sysroot -fPIC -isystem /home/leinardi/android-sdk/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=26 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11  -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /home/leinardi/android-sdk/ndk-bundle/platforms/android-26/arch-x86 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -L/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now  -u ANativeActivity_onCreate -shared -Wl,-soname,libblink.so -o /home/leinardi/Workspace/androidThings/sample-nativepio/blink/build/intermediates/cmake/debug/obj/x86/libblink.so CMakeFiles/blink.dir/blink.cpp.o  -landroid -llog libnative-app-glue.a /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/x86/lib/libandroidthings.so libandroid-system-properties.a -latomic -lm "/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a" "/home/leinardi/android-sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a" && :
  /home/leinardi/android-sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: /home/leinardi/Workspace/androidThings/sample-nativepio/libandroidthings/x86/lib/libandroidthings.so: incompatible target
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:51: error: undefined reference to 'APeripheralManagerClient_new'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:54: error: undefined reference to 'APeripheralManagerClient_openGpio'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:56: error: undefined reference to 'AGpio_setDirection'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:61: error: undefined reference to 'AGpio_getValue'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:65: error: undefined reference to 'AGpio_setValue'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:82: error: undefined reference to 'AGpio_delete'
  /home/leinardi/Workspace/androidThings/sample-nativepio/blink/src/main/cpp/blink.cpp:83: error: undefined reference to 'APeripheralManagerClient_delete'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org
proppy commented 6 years ago

Thanks for the report, I think this may comes from the x86 target, can you try to remove it from abiFilters in https://github.com/androidthings/sample-nativepio/blob/master/blink/build.gradle#L30

leinardi commented 6 years ago

Can confirm that removing the target x86 solves the problem.