Closed
Bug 735728
Opened 12 years ago
Closed 9 years ago
add support for building JS on iOS
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: m, Assigned: m)
References
Details
Attachments
(2 files, 4 obsolete files)
1.36 KB,
text/plain
|
Details | |
8.18 KB,
patch
|
ted
:
review-
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1067.0 Safari/536.3 Steps to reproduce: Added support on the configure.in to be able to build SpiderMonkey using Xcode >= 4.3.1 (Lion, iOS 5.1 tested) Actual results: Successfully built of a universal version of the static library (using a helper script, that would build first the simulator version and then the armv7 version, then using lipo to create a fat library) Expected results: Seamless integration of the iOS build with the rest of the targets. The configure flags are what I came up with, would be more than happy to fix them in order to be more general or aligned with the rest of the other targets.
Assignee | ||
Comment 1•12 years ago
|
||
I used this script to build a fat (universal) version of the library
Assignee | ||
Updated•12 years ago
|
OS: Mac OS X → iOS 5
Hardware: x86 → ARM
Updated•12 years ago
|
Attachment #605804 -
Attachment is patch: true
Comment 2•12 years ago
|
||
For reference, I was able to build a working Spidermonkey for iOS after fixing bug 676585. I only tested on jailbroken devices though. Your solution of disabling the JIT is probably (sadly) necessary for stock iOS.
Assignee | ||
Comment 3•12 years ago
|
||
Is there a way to really test if JIT is disabled? AFAIR there's no --disable-jit but several --disable-*-jit flags. Should I use them all to effectively disable JIT?
Assignee | ||
Comment 4•12 years ago
|
||
I created a public fork on github where I'm working on a "stable" version of spidermonkey that builds for iOS and Android, not sure if you're interested but I'll be more than happy to contribute more patches back: https://github.com/funkaster/spidermonkey So far the only changes are located in the build-ios dir in js/src/build-ios, which is a simple script + the already submitted patch for the configure script.
Comment 5•12 years ago
|
||
I think we'd certainly take patches. Is the patch here something you'd like to get reviewed and landed? I completely forgot about it.
Assignee | ||
Comment 6•12 years ago
|
||
@Ted: yes, that would be great. I'm not sure it's the right way to fix it to support iOS (specially the Simulator vs Device thing), but I'll be happy to fix it in order to comply with the rest of the configure script. Also, that configure script will only work with Xcode >= 4.3, since that's fixed to live in /Applications/Xcode.app. It could work with older versions of xcode, but then you would have to provide the path to the toolchain.
Updated•12 years ago
|
Assignee: general → m
Updated•12 years ago
|
Attachment #605804 -
Flags: review?(ted.mielczarek)
Comment 7•12 years ago
|
||
Comment on attachment 605804 [details] [diff] [review] 0001-adds-iOS-support-in-configure.patch I'm clearing out old review requests. Feel free to rerequest and get it started again.
Attachment #605804 -
Flags: review?(ted.mielczarek)
Assignee | ||
Comment 8•12 years ago
|
||
thanks. I'll submit a new patch today. I cleaned/refactored this up a little bit and now compiles ok using the tip of the hg repo (http://hg.mozilla.org/mozilla-central/). The only requirement for compiling Spidermonkey for iOS is having an AppStore installed Xcode, although this could be easily changed by adding some extra flag in the configure.
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #605804 -
Attachment is obsolete: true
Assignee | ||
Comment 10•12 years ago
|
||
I just submitted a new patch. One thing to note, is that in js/src/vm/NumericConversions.h I had to disable the assembly code when compiling for arm & using clang. Not sure why, but it was crashing the compiler...
Assignee | ||
Comment 11•12 years ago
|
||
Attachment #605815 -
Attachment is obsolete: true
Assignee | ||
Comment 12•12 years ago
|
||
after compiling for iOS and running the test suite on an iOS device (iPhone 4, running iOS 5.1.1), some of the tests failed: REGRESSIONS e4x/Regress/regress-371369.js e4x/XMLList/13.5.4.2.js e4x/XMLList/13.5.4.4.js e4x/extensions/regress-305335.js e4x/extensions/regress-313080.js e4x/extensions/regress-353165.js ecma/Math/15.8.2.6.js ecma_2/Exceptions/string-001.js ecma_3/Object/regress-385393-07.js ecma_3/String/regress-304376.js ecma_3_1/Object/regress-444787.js ecma_5/Object/extensibility-01.js ecma_5/extensions/15.4.4.11.js ecma_5/misc/unwrapped-no-such-method.js ecma_5/strict/15.4.4.12.js ecma_5/strict/15.4.4.13.js ecma_5/strict/15.4.4.6.js ecma_5/strict/15.4.4.8.js ecma_5/strict/15.4.4.9.js js1_5/Exceptions/regress-347674.js js1_5/Regress/regress-114493.js js1_5/Regress/regress-334807-01.js js1_5/Regress/regress-334807-02.js js1_5/Regress/regress-334807-03.js js1_5/Regress/regress-334807-04.js js1_5/Regress/regress-355556.js js1_5/Regress/regress-372364.js js1_5/Regress/regress-462292.js js1_5/Regress/regress-89474.js js1_5/extensions/regress-564577.js js1_6/Array/regress-290592.js js1_6/Array/regress-304828.js js1_6/Regress/regress-351795.js js1_7/block/regress-352616.js js1_7/geniter/regress-351120.js js1_8/extensions/regress-385393-10.js js1_8/extensions/regress-469625.js js1_8/regress/regress-384412.js js1_8_1/jit/math-jit-tests.js js1_8_5/extensions/clone-forge.js js1_8_5/regress/regress-560101.js js1_8_5/regress/regress-571014.js js1_8_5/regress/regress-597870.js FAIL
Assignee | ||
Comment 13•12 years ago
|
||
The final output (before the list of failing tests): [2955| 43| 0| 165] 100% ==========================================>|1766.0s Configure flags: ../configure --with-ios-target=iPhoneOS --with-ios-version=5.1 --with-ios-min-version=4.3 --enable-llvm-hacks --with-thumb=yes --disable-shared-js --enable-strip
Comment 14•12 years ago
|
||
You'd have to look at individual tests to figure out what's failing. It may be there are just a couple of bugs causing all these tests to fail.
Assignee | ||
Comment 15•12 years ago
|
||
I issued a Pull Request on the github repo to review the code: https://github.com/mozilla/mozilla-central/pull/6
Assignee | ||
Comment 16•12 years ago
|
||
Add build support for iOS (for both device and simulator)
Attachment #647787 -
Attachment is obsolete: true
Assignee | ||
Comment 17•12 years ago
|
||
Just added a patch, which is essentially the same as the pull request
Assignee | ||
Comment 18•12 years ago
|
||
Attachment #674313 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #675291 -
Flags: review?(ted)
Comment 19•12 years ago
|
||
Comment on attachment 675291 [details] [diff] [review] adds support for iOS build (armv7, armv7s, i386) Review of attachment 675291 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the patch! I have a few issues with it, but hopefully we can get it cleaned up and landed. ::: js/src/build-ios/build_ios_static_fat.sh @@ +1,4 @@ > +#!/bin/sh > + > +## this script is supposed to be run one directory below the original configure script > +## usually in build-ios We don't typically have scripts like this committed. Generally, you should try to make as many of these configure options select proper defaults when targeting iOS so that configuring is not painful, then a script shouldn't be necessary. ::: js/src/build/autoconf/ios.m4 @@ +24,5 @@ > + > +MOZ_ARG_WITH_STRING(ios-arch, > +[ --with-ios-arch=ARCH > + iOS architecture, defaults to armv7 for device, x86 for simulator], > + ios_arch=$withval) This shouldn't be necessary. You already have $target_cpu, and we already have a --with-arch argument you can reuse for targeting specific CPU types. @@ +88,5 @@ > + if test -z "$HOST_LDFLAGS" ; then > + HOST_LDFLAGS=" " > + fi > + > + AC_DEFINE(IPHONEOS) I don't think we should need this define. ::: js/src/configure.in @@ +157,5 @@ > > +MOZ_ARG_WITH_STRING(ios-target, > +[ --with-ios-target=SDK > + what target sdk to use, defaults to iPhoneSimulator], > + ios_target=$withval) I don't think this ought to be necessary. You should be able to select the proper target based on the target CPU architecture, right? ::: js/src/vm/NumericConversions.h @@ +154,4 @@ > inline int32_t > ToInt32(double d) > { > +#if defined (__arm__) && defined (__GNUC__) && !defined(__clang__) If you're making changes to JS source you'll need a JS peer to review them.
Attachment #675291 -
Flags: review?(ted) → review-
Comment 20•12 years ago
|
||
Thanks! I'll make the proper changes, remove the script and for the js code, I'll ask in IRC who can review this.
Comment 21•12 years ago
|
||
about this:
::: js/src/configure.in
@@ +157,5 @@
>
> +MOZ_ARG_WITH_STRING(ios-target,
> +[ --with-ios-target=SDK
> + what target sdk to use, defaults to iPhoneSimulator],
> + ios_target=$withval)
I think we need either this or a flag that says "enable iOS", because otherwise the --arch=i386 will get confused with plain mac os x i386. There are some flags I need to pass to the compiler to tell it that it's compiling for iOS and not Mac OS X.
Maybe we could just use --with-arch and --enable-ios ? from there I can infer that we're targeting the simulator if arch == i386 and device in any other case.
Comment 22•12 years ago
|
||
Also, the changes to vm/NumericConversions.h are apparently no longer needed.
Comment 23•12 years ago
|
||
There's already a check for this in the top-level configure: http://mxr.mozilla.org/mozilla-central/source/configure.in#1939 You can use that (or maybe move all of this into a build/autoconf/ios.m4 file to share it).
Updated•12 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 24•9 years ago
|
||
Ted, would you say this item has been resolved as a consequence of your recent work?
Flags: needinfo?(ted)
Comment 25•9 years ago
|
||
I still need to land the patch in bug 1171649, but with that, yes, things work fine on iOS.
Depends on: 1171649
Flags: needinfo?(ted)
Comment 26•9 years ago
|
||
Fixed by bug 1171649.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment 27•9 years ago
|
||
For reference, you should now be able to configure with --target=armv7-apple-darwin10 and get a working build (assuming you have an iOS SDK installed).
Comment 28•9 years ago
|
||
Simulator builds should be possible with `--with-ios-sdk=iphonesimulator`
Comment 29•7 years ago
|
||
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #27) > For reference, you should now be able to configure with > --target=armv7-apple-darwin10 and get a working build (assuming you have an > iOS SDK installed). Hi Ted, I am trying to build js engine for iOS using above provided options. I'm passing these arguments to the configure. ../configure --target=armv7-apple-darwin16.4 --without-intl-api --disable-debug --enable-llvm-hacks --with-thumb=yes --disable-shared-js --enable-strip It creates MakeFile successfully but when I do make, it gives error. Here's the full output : https://pastebin.com/1mWiQ6U7 I would like to know if build steps got changed. Right now I'm using latest code from github repo. Thanks!
You need to log in
before you can comment on or make changes to this bug.
Description
•