Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building examples out-of-workspace #8

Open
ghost opened this issue Aug 14, 2018 · 2 comments
Open

Building examples out-of-workspace #8

ghost opened this issue Aug 14, 2018 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Aug 14, 2018

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 and ros2_android built in their own directories, as per the instructions here: https://github.com/esteve/ros2_java

Having 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 with Execution failed for task ':copyNativeLibs'. > path may not be null or empty string. path='')
  • ament build from the ros2_listener_android subdir (`All selected packages are being skipped. Nothing to do)
  • ament build . from the ros2_listener_android subdir. This one causes ament to try and recusively copy ros2_listener_android/ into ros2_listener_android/build -- not fun.
  • Each of the above with the --ament-gradle-args section from https://github.com/esteve/ros2_java

My 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 from ament_java) is being run

@ghost
Copy link
Author

ghost commented Aug 14, 2018

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.

@esteve esteve self-assigned this Aug 28, 2018
@ghost
Copy link
Author

ghost commented Aug 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant