New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 706755 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Android build fails when "test" target depends on another "test" target

Project Member Reported by oprypin@chromium.org, Mar 30 2017

Issue description

Hi, within the WebRTC codebase we occasionally run into this problem where the build fails with the following message when compiling for Android and we never knew why:

[2/44] python ../../build/android/gyp/write_ordered_libraries.py --readelf=../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-readelf --output=gen/webrtc/video_engine_tests_apk.ordered_libararies.json --libraries-dir=. --input-libraries=@FileArg\(gen/webrtc/video_engine_tests_apk.build_config:native:libraries\)
FAILED: gen/webrtc/video_engine_tests_apk.ordered_libararies.json 
python ../../build/android/gyp/write_ordered_libraries.py --readelf=../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-readelf --output=gen/webrtc/video_engine_tests_apk.ordered_libararies.json --libraries-dir=. --input-libraries=@FileArg\(gen/webrtc/video_engine_tests_apk.build_config:native:libraries\)
Traceback (most recent call last):
  File "../../build/android/gyp/write_ordered_libraries.py", line 140, in <module>
    sys.exit(main())
  File "../../build/android/gyp/write_ordered_libraries.py", line 116, in main
    libraries = GetSortedTransitiveDependenciesForBinaries(libraries)
  File "../../build/android/gyp/write_ordered_libraries.py", line 94, in GetSortedTransitiveDependenciesForBinaries
    return GetSortedTransitiveDependencies(libraries)
  File "../../build/android/gyp/write_ordered_libraries.py", line 83, in GetSortedTransitiveDependencies
    libraries, GetNonSystemDependencies)
  File "/usr/local/google/home/oprypin/webrtc/src/build/android/gyp/util/build_utils.py", line 392, in GetSortedTransitiveDependencies
    new_deps = deps_func(dep).difference(all_deps)
  File "../../build/android/gyp/write_ordered_libraries.py", line 76, in GetNonSystemDependencies
    all_deps = GetDependencies(library_name)
  File "../../build/android/gyp/write_ordered_libraries.py", line 71, in GetDependencies
    elf = CallReadElf(library_or_executable)
  File "../../build/android/gyp/write_ordered_libraries.py", line 67, in CallReadElf
    return build_utils.CheckOutput(readelf_cmd)
  File "/usr/local/google/home/oprypin/webrtc/src/build/android/gyp/util/build_utils.py", line 170, in CheckOutput
    raise CalledProcessError(cwd, args, stdout + stderr)
util.build_utils.CalledProcessError: Command failed: ( cd /usr/local/google/home/oprypin/webrtc/src/out/debug-android; ../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-readelf -d libc++.so )
readelf: Error: 'libc++.so': No such file

See:
https://codereview.webrtc.org/2609443003/#msg7
https://codereview.webrtc.org/2767383005/#ps100001

Turns out that this happens when one target that uses the "test" template depends on another target that uses the "test" template. This probably should never be done, but the problem is one may not realize that this is happening, and at least a good error message would save a lot of time.

CL that reproduces it in the simplest way (base_perftests depends on base_unittests):
https://codereview.chromium.org/2785133002
The build succeeds for some reason, but locally I reproduce it like this:

cd ~/chromium/src
gn gen out/debug-android --args='is_debug=true target_os="android" target_cpu="arm"'
ninja -C out/debug-android base_perftests
 
Labels: QuickFix

Sign in to add a comment