djinni icon indicating copy to clipboard operation
djinni copied to clipboard

Stop using gyp's android generator

Open mrdomino opened this issue 9 years ago • 5 comments

The gyp team removed support for the android format since a lot of people (present company included) mistook it for a way to build Android NDK libraries. It's apparently not meant to do that.

One of the proposed alternatives is to use gyp to generate ninja build files and to compile them using a toolchain generated with the NDK's make-standalone-toolchain.sh. I have a work-in-progress to do this at mrdomino/ninja-android-build. Still needed is to update the gradle config or otherwise cause ninja to be invoked on the library target, and probably to fix a few things here and there.

mrdomino avatar May 18 '15 23:05 mrdomino

Yup, we're still figuring out what our plan is here; ninja is definitely a possibility. Also paging @skabbes

j4cbo avatar May 19 '15 17:05 j4cbo

My knee-jerk reaction is that what @mrdomino suggests is actually the right thing to do.

skabbes avatar May 19 '15 22:05 skabbes

It's almost certainly a right thing to do — I'm successfully using a minor variation on that in production on a project that uses both gyp and djinni. It's probably not the only right thing to do, but I haven't yet found anything better than that particular local optimum for that particular use case.

mrdomino avatar May 20 '15 14:05 mrdomino

Did you guys look into incorporating the ninja solution? The android example still doesn't build for me due to the same issue here:

ROID_BUILD_TOP= deps/gyp/gyp --depth=. -f android -DOS=android -Icommon.gypi example/libtextsort.gyp --root-target=libtextsort_jni
Traceback (most recent call last):
  File "deps/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "/Library/Python/2.7/site-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/Library/Python/2.7/site-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/Library/Python/2.7/site-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "/Library/Python/2.7/site-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 91, in Load
    generator = __import__(generator_name, globals(), locals(), generator_name)
ImportError: No module named android

syedhali avatar Oct 15 '15 17:10 syedhali

@syedhali you should be able to pull a specific old commit of gyp which still supports Android, which is what's done in the Djinni Makefile. Not a great solution, but we haven't put the time into a better one yet at Dropbox. Ninja may be good, but the NDK is what Google supports for ordinary developers to use on Android so we're a bit hesitant about going to another Chromium-specific solution. Android Studio is moving toward its own Gradle build using the NDK tools (but not the NDK makefiles), which may be the right target, but we haven't yet looked into adding a gyp generator for that, and I'm not confident that the Chromium team will make one.

artwyman avatar Oct 15 '15 23:10 artwyman