Last Comment Bug 767250 - redefined webrtc targets fails b2g build
: redefined webrtc targets fails b2g build
Status: RESOLVED FIXED
[qa-]
:
Product: Core
Classification: Components
Component: WebRTC (show other bugs)
: unspecified
: ARM Gonk (Firefox OS)
: -- critical (vote)
: mozilla16
Assigned To: [:jesup] on pto until 2016/7/5 Randell Jesup
:
Mentors:
Depends on:
Blocks: b2g-webrtc
  Show dependency treegraph
 
Reported: 2012-06-21 20:22 PDT by Vicamo Yang [:vicamo][:vyang]
Modified: 2012-07-27 10:23 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
example gecko/media/webrtc/trunk/src/Android.mk (283 bytes, text/plain)
2012-06-22 09:17 PDT, Vicamo Yang [:vicamo][:vyang]
no flags Details
Stop B2G/Gonk from trying to build Android.mk's in media/webrtc (694 bytes, patch)
2012-06-22 15:57 PDT, [:jesup] on pto until 2016/7/5 Randell Jesup
mwu.code: review+
Details | Diff | Review

Description Vicamo Yang [:vicamo][:vyang] 2012-06-21 20:22:47 PDT
Imported WebRTC source code contains multiple Android.mk files that confuse gonk build system. Removing them or reassign GECKO_PATH to somewhere not under B2G topsrcdir fix this problem.

Reproduce steps:
$ cd B2G/gecko
$ git remote add mozilla git://github.com/mozilla/mozilla-central.git
$ git fetch mozilla
$ git checkout mozilla/master
$ cd ..; ./build.sh

gecko/media/webrtc/trunk/src/common_audio/resampler/Android.mk:13:
gecko/media/webrtc/trunk/src/common_audio/resampler/../../../android-webrtc.mk:
No such file or directory
build/core/base_rules.mk:170: ***
gecko/media/webrtc/trunk/src/common_audio/resampler:
MODULE.TARGET.STATIC_LIBRARIES.libwebrtc_resampler already defined by
external/webrtc/src/common_audio/resampler/main/source. Stop.
Comment 1 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-21 20:36:02 PDT
For my reference, what assumptions does the gonk build system make about Android.mk files?  In an imported project, if we end up needing those files it may be problematic to remove them.  They may no longer be needed (in preference to .gypi files), but I'd have to check each of 46 Android.mk files to be sure.

Since there are no other Android.mk files in the tree outside of media/webrtc, what's looking for Android.mk files and why?  How important is the assumption about the purpose of these files?
Comment 2 Kan-Ru Chen [:kanru] (UTC+8) 2012-06-21 20:46:12 PDT
(In reply to Randell Jesup [:jesup] from comment #1)
> For my reference, what assumptions does the gonk build system make about
> Android.mk files?  In an imported project, if we end up needing those files
> it may be problematic to remove them.  They may no longer be needed (in
> preference to .gypi files), but I'd have to check each of 46 Android.mk
> files to be sure.

The gonk build system uses the Android build system. It scans all Android.mk files under the b2g repository and includes them all.

> Since there are no other Android.mk files in the tree outside of
> media/webrtc, what's looking for Android.mk files and why?  How important is
> the assumption about the purpose of these files?

There is no special use for these Android.mk files in gonk. If they are not used in other builds, I think it is safe to remove them.
Comment 3 Vicamo Yang [:vicamo][:vyang] 2012-06-21 20:49:27 PDT
(In reply to Randell Jesup [:jesup] from comment #1)
> For my reference, what assumptions does the gonk build system make about
> Android.mk files?  In an imported project, if we end up needing those files
> it may be problematic to remove them.  They may no longer be needed (in
> preference to .gypi files), but I'd have to check each of 46 Android.mk
> files to be sure.

Yup, that's the last thing anyone would want to do.

> Since there are no other Android.mk files in the tree outside of
> media/webrtc, what's looking for Android.mk files and why?

The Gonk(in fact, same as Android's) build system searches every first leaf Android.mk files and includes them after board config is done. So, any Android.mk files under B2G topsrcdir without a previous one in its path will be included directly. See B2G/build/main.mk line 466, 467:

466 subdir_makefiles := \
467         $(shell build/tools/findleaves.py --prune=out --prune=.repo --prune=.git $(subdirs) Android.mk)

> How important is the assumption about the purpose of these files?

I'm not sure whether or not does Fennec or other possible Android variants need them, but we may have two solutions here:

1.) Place a Android.mk in media/webrtc and invoke all-makefiles-under if we're not building B2G.
2.) Remove webrtc from B2G manifest.xml. But I'm not pretty sure what are the differences between external/webrtc and gecko/media/webrtc.
Comment 4 Vicamo Yang [:vicamo][:vyang] 2012-06-21 21:02:16 PDT
FYI. The results of above two solutions are:
1.) B2G build passed.
2.) missing *a lot* android-webrtc.mk files in gecko/media/webrtc. B2G build failed.
Comment 5 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-21 21:17:44 PDT
care to put up a patch for option 1?
Comment 6 Vicamo Yang [:vicamo][:vyang] 2012-06-22 09:17:42 PDT
Created attachment 635777 [details]
example gecko/media/webrtc/trunk/src/Android.mk

I failed to find some useful variable defined only for B2G. If any, just replace "SOME_VAR_ONLY_DEFINED_FOR_B2G" with that.
Comment 7 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-22 15:03:26 PDT
Correction: I read the patch and more carefully read above, and you're saying they independently imported the webrtc.org code into external/webrtc!

So, if that's the case, the solution is to remove external/webrtc (and maybe to also do what you have above until we have it building for B2G)

Adding Chris Jones to help figure out what's up. (I haven't installed B2G source before, and the set of commands above I think assumes a working B2G repo setup - they fail for me).
Comment 8 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-22 15:14:11 PDT
Per mwu on IRC, we just need an blank Android.mk in a root dir to the offending makefiles.  Taking bug.  Should be simple
Comment 9 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-22 15:57:01 PDT
Created attachment 635955 [details] [diff] [review]
Stop B2G/Gonk from trying to build Android.mk's in media/webrtc
Comment 10 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-22 16:07:10 PDT
Note: bustage fix; I don't have a B2g/Gonk build env
Comment 11 [:jesup] on pto until 2016/7/5 Randell Jesup 2012-06-22 16:11:26 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/83bde5a2881f
Comment 12 Michael Wu [:mwu] 2012-06-22 16:44:40 PDT
FWIW I have applied the patch and confirmed that this fixes the issue.
Comment 13 Ryan VanderMeulen [:RyanVM] 2012-06-23 05:44:26 PDT
https://hg.mozilla.org/mozilla-central/rev/83bde5a2881f

Note You need to log in before you can comment on or make changes to this bug.