Spidermonkey compilation failure

How are you compiling?
Recently we needed to generate an ARM64 android library for cocos2d-x v2.2 and it compiled and run Ok.
( https://github.com/ricardoquesada/Spidermonkey/tree/v22-arm64 )

I want to compile SpiderMonkey with bitcode support so I can develop JS games for tvOS.
Do you think that this branch is a good source for doing it so?

How would you recommend to proceed if I want to compile SpiderMonkey with bitcode support?

I’m trying to compile the SpiderMonkey for tvOS purposes and this is what I get.
It it your original script (not yet modified for tvOS).
Would you know what is the problem?

$ ./build64.sh 
mkdir: tmp: File exists
mv: rename libjs_static* to tmp/libjs_static*: No such file or directory
make: *** No rule to make target `distclean'.  Stop.
loading cache ./config.cache
checking host system type... x86_64-apple-darwin14.5.0
checking target system type... x86_64-apple-darwin14.5.0
checking build system type... x86_64-apple-darwin14.5.0
checking for mawk... no
checking for gawk... gawk
checking for clang... /usr/bin/clang
checking for clang++... /usr/bin/clang++
checking for perl5... no
checking for perl... /usr/bin/perl
configure: error: Invalid SDK version
make: *** No targets specified and no makefile found.  Stop.
error when compiling iOS(arm64) version of the library

fixed by setting current IOS_SDK.
in my case:

ios_sdk_version="9.1"

in ../configure

Then I ended up with:

creating fat version of the library
xcodebuild: error: SDK "AppleTVOS" cannot be located.
xcrun: error: unable to find utility "lipo", not a developer tool or in PATH
xcodebuild: error: SDK "AppleTVOS" cannot be located.
xcrun: error: unable to find utility "strip", not a developer tool or in PATH
xcodebuild: error: SDK "AppleTVOS" cannot be located.
xcrun: error: unable to find utility "lipo", not a developer tool or in PATH

Would you know is should be the proper values?

LIPO="xcrun -sdk AppleTVOS lipo"
STRIP="xcrun -sdk AppleTVOS strip"

@pepeek make sure that the command line tool that you are using is the one that has appletv support.

Thanks. I figured that out.

Please help me out. I’m really struggling with compiling SpiderMonkey for tvOS.
I’ve opened a now thread for it: Help with compiling SpiderMonkey for tvOS
Thanks a lot!

@ricardo , I downloaded version 33 of your Spidermonkey variant (equivalent to github commit SHA e41b4fe). I didn’t download the latest commit because it corresponds to v34 and I am using Cocos2D-X v3.5, which uses Spidermonkey 33 and I don’t know if changing it could create new bugs aside from the ones I am trying to fix already.

Then, I tried directly using the build.sh bash script you provide in folder js/src/build-android but it didn’t work. I gradually adapted your script, making sure I would get the exact same Spidermonkey library files Cocos2D-X provides if I compiled a release build. My last try looked like this Gist.

It compiles ok. It even runs ok by itself (I created a standalone android app to test Spidermonkey and it works fine). But when I replace the library files of Cocos2D-X with mine and run the game, it crashes at startup. How come?

The truth, Ricardo, is I simply need a working debug version of Spidermonkey, the same one you already have, that works in Cocos v3.5. I don’t want to change any of its code. I simply want it to have debug messages and validation. That’s it. And it has been a pain to get right.

Any help would really, really be appreciated.

@Ruluk
I’ll try to compile it myself, although I’ll use HEAD instead of v33.

I’ll post here my results, but I won’t be able to work on it today.

@ricardo , amazing, thanks!

If you happen to use or check my Gist, keep in mind that I tried both debug and release builds with no success.

But really, thank you!

@ricardo, do you know when will you be able to help with the compilation? I know it’s busy times, but I’d really appreciate it. :smile:

Thank you anyways!

perhaps today :slight_smile: … let me try …

@ruluk:
I didn’t have to change the target in order to make it work on tvOS.
I’ve just tried js-tests (with and changes in the js-code, not in spidermonkey) and it works on tvOS

Oh, @ricardo, really sorry. My problem is not with tvOS (that was another user), my issue is that I need a debug version of Spidermonkey to run with Cocos2D-JS for Android, especially version 3.5, which is the one I use right now.

@ruluk ha… sorry :slight_smile: I’ll try it tomorrow.

@ricardo , sorry to be so bothersome, but have you had any chance to try it yet? I know how holidays work, don’t worry. :smile:

sorry, I’ll try it right now :smile:

@ruluk
Ok. I tried compiling it but I think the master branch of my spidermonkey repo is outdated.

@pandamicro
For v3.10, which SpiderMonkey repo are we using ? Thanks.
I think we should stop using my repo, and move it to github.com/cocos2d/spidermonkey

@ricardo, wait, I’m not using Cocos 3.10. Don’t worry, your Spidermonkey (v33 or 34) is fine for my needs because I am using Cocos 3.5, which supposedly used that version. In fact, if you are remotely able to test your Spidermonkey in Android with Cocos2D-JS 3.5, that would be awesome!

@ruluk sorry, but I don’t test things cocos2d-x v3.5, not because I cannot, but basically we don’t patch those versions. Even if there is a bug, we wouldn’t fix it in v3.5… we would fix in v3.10.

my suggestion is that you post the traceback here… I might know what’s happening by taking a look at it.
thank you for your understanding.

@ricardo, don’t worry bud. BUT read on, please. Bear with me just a little more. :persevere:

The issue won’t be solved because it is from a deprecated feature (Facebook plugin-x). And that is fine, I’m not asking anyone, nor you, to help me in the issue itself. After some particular events with the plugin, the app crashes and no useful message is given, except some hints that it may be a garbage-collection issue from Spidermonkey, i.e. some bad C++ code from the Facebook plugin-x. That is why I need a debug version of Spidermonkey 33 or 34, to know where and how is that GC crash happening.

That is still fine, I can build a debug version of Spidermonkey myself, and it seems to run when I test it in a standalone Android app. But that leads me to where all this conversation began. When I test even the non-debug build of Spidermonkey 33 (your commit, that one we discussed several weeks ago) by replacing the original library files in Cocos2D, the app crashes at startup.

And I don’t understand how it can be. If Cocos2D-JS v 3.5 uses the exact same Spidermonkey 33 version you have in your repository, building my own copy shouldn’t make the app crash. That was my original question from this thread.

My new question is this: do you know where can I find the source files of the Spidermonkey version they have *actually been using?*

Sorry again to be so bothersome, but you may be my only help at making this work.