libmx3 / mx3

a sample project showcasing/collecting cross platform techniques on mobile
MIT License
1.17k stars 146 forks source link

make android fails #59

Closed skypjack closed 9 years ago

skypjack commented 9 years ago

Hello, I'm trying to build the example for the android platform, but it fails with the error below:

###:~/### (master)$ make android
git clone --depth 1 https://chromium.googlesource.com/external/gyp.git ./deps/gyp
Cloning into './deps/gyp'...
remote: Sending approximately 10.51 MiB ...
remote: Counting objects: 1779, done
remote: Finding sources: 100% (1779/1779)
remote: Total 1779 (delta 353), reused 1057 (delta 353)
Receiving objects: 100% (1779/1779), 895.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (353/353), done.
Checking connectivity... done.
./deps/gradle/gradlew djinni
:djinniBuild UP-TO-DATE
:djinniGen UP-TO-DATE
:djinniOutSyncCpp UP-TO-DATE
:djinniOutSyncJava UP-TO-DATE
:djinniOutSyncJni UP-TO-DATE
:djinniOutSyncObjc UP-TO-DATE
:djinniOutSync UP-TO-DATE
:djinni UP-TO-DATE

BUILD SUCCESSFUL

Total time: 2.572 secs
ANDROID_BUILD_TOP=dirname  deps/gyp/gyp --depth=. -f android -DOS=android --root-target libmx3_android -Icommon.gypi mx3.gyp
Usage: gyp_main.py [options ...] [build_file ...]

gyp_main.py: error: no such option: --root-target
Makefile:40: recipe for target 'GypAndroid.mk' failed
make: *** [GypAndroid.mk] Error 2

It looks fine, indeed I have for ./deps/gyp/gyp -h as follows:

Usage: gyp_main.py [options ...] [build_file ...]

Options:
  -h, --help            show this help message and exit
  --build=CONFIGS       configuration for build after project generation
  --check               check format of gyp files
  --config-dir=CONFIG_DIR
                        The location for configuration files like
                        include.gypi.
  -d DEBUGMODE, --debug=DEBUGMODE
                        turn on a debugging mode for debugging GYP.  Supported
                        modes are "variables", "includes" and "general" or
                        "all" for all of them.
  -D VAR=VAL            sets variable VAR to value VAL
  --depth=PATH          set DEPTH gyp variable to a relative path to PATH
  -f FORMATS, --format=FORMATS
                        output formats to generate
  -G FLAG=VAL           sets generator flag FLAG to VAL
  --generator-output=DIR
                        puts generated build files under DIR
  --ignore-environment  do not read options from environment variables
  -I INCLUDE, --include=INCLUDE
                        files to include in all loaded .gyp files
  --msvs-version=MSVS_VERSION
                        Deprecated; use -G msvs_version=MSVS_VERSION instead
  --no-circular-check   don't check for circular relationships between files
  --parallel            Use multiprocessing for speed (experimental)
  -S SUFFIX, --suffix=SUFFIX
                        suffix to add to generated files
  --toplevel-dir=DIR    directory to use as the root of the source tree

What does the root-target option stay for? Thank you in advance for your help.

skabbes commented 9 years ago

looks like upstream gyp has started to make backwards incompatible changes to the android generator, they are moving to ninja for that. For the time being, I'll pin the version of gyp and look to upgrade to the ninja generator when I have time.

skabbes commented 9 years ago

this commit will fix your issue, and I'll look at upgrading like I mentioned.

skypjack commented 9 years ago

Unfortunately, the master still doesn't work (see the snippet below). I've walked throughout the commits on gyp and I'm not able to find any release that contains the option --root-target. I'm not sure about how I can help you, but I'm at your disposal.

ANDROID_BUILD_TOP=dirname  deps/gyp/gyp --depth=. -f android -DOS=android --root-target libmx3_android -Icommon.gypi mx3.gyp
Usage: gyp_main.py [options ...] [build_file ...]

gyp_main.py: error: no such option: --root-target
Makefile:40: recipe for target 'GypAndroid.mk' failed
make: *** [GypAndroid.mk] Error 2
skypjack commented 9 years ago

Anyway, I think it's not a matter of the version. It seems that the option is available on the master as well as on the hash you've linked. If you look at the file pylib/gyp/init.py, that parameter is there since October 2013. No backwards incompatible changes at all, it's something different and I'm trying to figure out what's wrong.

skypjack commented 9 years ago

Ok, found. It simply relies on the gyp version installed in your system, if there is one. You can rollback the commit above, the master of gyp still contains the root-target option.

I solved (even though it's not really solved) patching the file gyp_main.py in deps/gyp as follows:

try:
  import os.path
  sys.path = [os.path.join(os.path.dirname(sys.argv[0]), 'pylib')] + sys.path
  import gyp
except ImportError, e:

This way, the problem with gyp is no longer there. I'm not sure about how to proceed, it looks like a problem of gyp itself. I'll propose a patch for your repo, if I find the time to work on that during the day. Any suggestion is really appreciated!! I'm far from being a python expert...

skypjack commented 9 years ago

Please, see pull request #62 for further details.