Open ghost opened 6 years ago
It seems to be a problem with ament
not parsing the package.xml
properly.
For example, if the main workspace has been built in ~/3rdparty/ros2_android
, and we have a directory ~/ros2_listener_android
containing src/ros2_listener_android/...
then
cd ~/ros2_listener
ament build --directory ../3rdparty/ros2_android --ament-gradle-args -Pament.android_stl=gnustl_shared -Pament.android_abi=armeabi-v7 -Pament.android_ndk=/home/johnmark/Android/Skd/ndk-bundle --
will try and run the underlying gradle
command
/opt/gradle/gradle-4.8/bin/gradle -Pament.source_space=/home/johnmark/ros2_listener_android/src/ros2_listener_android -Pament.build_space=/home/johnmark/ros2_listener_android/build/ros2_listener_android -Pament.install_space=/home/johnmark/ros2_listener_android/install -Pament.dependencies= -Pament.build_tests=False -Pament.package_manifest.name=ros2_listener_android -Pament.exec_dependency_paths_in_workspace= -Pament.gradle_recursive_dependencies=False -Pament.gradle_isolated=False --directory ../3rdparty/ros2_android -Pament.android_stl=gnustl_shared -Pament.android_abi=armeabi-v7 -Pament.android_ndk=/home/johnmark/Android/Skd/ndk-bundle -Pament.android_variant=release assemble --stacktrace'
which fails with
> Task :copyNativeLibs FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':copyNativeLibs'.
> path may not be null or empty string. path=''
Note how the android.dependencies
and android.exec_dependency_paths_in_workspace
arguments given to gradle
are empty.
Compare that to running
cd ~/ros2_android
ament build --only-packages ros2_listener_android --ament-gradle-args -Pament.android_stl=gnustl_shared -Pament.android_abi=armeabi-v7 -Pament.android_ndk=/home/johnmark/Android/Skd/ndk-bundle --
where the android.dependencies
and android.exec_dependency_paths_in_workspace
are filled in with the correct list of paths from ~/ros2_android
.
If I manually pass in those same arguments when building in ~/ros2_listener_android
then the build works, but it would (clearly) be much nicer if those arguments were inferred for me by ament
.
Reproducible example: https://gist.github.com/johnmarkwayve/5764dc0f24f71e54a4f85dd9fecd615c
How can these examples (or, indeed, any project that uses ros2_android) be built without existing within the ros2_android workspace?
I have
ament_java
andros2_android
built in their own directories, as per the instructions here: https://github.com/esteve/ros2_javaHaving sourced
{ament_java|ros2_android}/install/local_setup.bash
, I then want to build these examples.I've tried:
ament build .
from the root of this repo (fails withExecution failed for task ':copyNativeLibs'. > path may not be null or empty string. path=''
)ament build
from theros2_listener_android
subdir (`All selected packages are being skipped. Nothing to do)ament build .
from theros2_listener_android
subdir. This one causesament
to try and recusively copyros2_listener_android/
intoros2_listener_android/build
-- not fun.--ament-gradle-args
section from https://github.com/esteve/ros2_javaMy guess is that I'm supposed to be copying these examples into the
ros2_android
workspace, and building the lot. But I really don't want to embed my project in the directory structure of one of its dependencies, that feels very backwards.Edit: To answer the obvious question, yes the correct version of
ament
(the one fromament_java
) is being run