Bug 197058 - [arm] lang/spidermonkey24 fails to build for arm
Summary: [arm] lang/spidermonkey24 fails to build for arm
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Some People
Assignee: Koop Mast
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-24 23:04 UTC by Sean Bruno
Modified: 2015-01-30 09:59 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (kwm)


Attachments
Upstream patches and stuff I needed to do to get an ARM build (3.90 KB, patch)
2015-01-24 23:04 UTC, Sean Bruno
no flags Details | Diff
arm patches, upstream version (5.09 KB, patch)
2015-01-26 17:10 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Bruno freebsd_committer freebsd_triage 2015-01-24 23:04:37 UTC
Created attachment 152112 [details]
Upstream patches and stuff I needed to do to get an ARM build

Grabbed some upstream bits, I think, its hard to tell with mozilla projects. 

1.  Patch ExecutableAllocator.h with a clear_cache function
2.  Patchout the use of PC_sig() as it was only used for ARM and replace it with a direct call to R15_sig()
3.  #ifdef around the use of asm/hwcap.h for __FreeBSD__


Currently, this compiles, but I get an orphaned file during STAGE

====> Compressing man pages (compress-man)
===========================================================================
====> Running Q/A tests (stage-qa)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: lib/libmozjs-24.a
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-24 23:04:37 UTC
Auto-assigned to maintainer kwm@FreeBSD.org
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2015-01-24 23:25:01 UTC
(In reply to Sean Bruno from comment #0)

2.  Patchout the use of PC_sig() as it was only used for ARM and replace it with a direct call to R15_sig()

Is definitely upstream, here:
http://hg.mozilla.org/mozilla-central/file/7148aa99ad67/js/src/asmjs/AsmJSSignalHandlers.cpp#l195
Comment 3 Sean Bruno freebsd_committer freebsd_triage 2015-01-24 23:31:40 UTC
(In reply to Sean Bruno from comment #0)

1.  Patch ExecutableAllocator.h with a clear_cache function
 Is not upstreamed according to what I can tell:

http://hg.mozilla.org/mozilla-central/file/7148aa99ad67/js/src/jit/ExecutableAllocator.h
Comment 4 Sean Bruno freebsd_committer freebsd_triage 2015-01-24 23:33:17 UTC
(In reply to Sean Bruno from comment #0)
3.  #ifdef around the use of asm/hwcap.h for __FreeBSD__
 Is not upstream and the #ifdef logic in their head is reversed

http://hg.mozilla.org/mozilla-central/file/7148aa99ad67/js/src/jit/arm/Architecture-arm.cpp
Comment 5 Sean Bruno freebsd_committer freebsd_triage 2015-01-24 23:34:19 UTC
Can I get a review from the gecko team here?  I think that this is "correct" and I'd love to get these upstream if possible.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2015-01-25 02:08:01 UTC
Comment on attachment 152112 [details]
Upstream patches and stuff I needed to do to get an ARM build

AsmJSSignalHandlers.cpp chunk should probably go into files/patch-bug919968 and replaced with upstream version.

https://hg.mozilla.org/mozilla-central/rev/07ce4364fbec

> ++#elif CPU(ARM_TRADITIONAL) && OS(FREEBSD) && COMPILER(CLANG)
> ++    static void cacheFlush(void* code, size_t size)
> ++    {
> ++	__clear_cache(code, reinterpret_cast<char*>(code) + size);

Why is this limited to compiler-rt? Wouldn't __clear_cache() from libgcc
implemented via ARM_SYNC_ICACHE for NetBSD also work for us?

  #elif CPU(ARM_TRADITIONAL) && (OS(FREEBSD) || OS(NETBSD))

> +-#if !(defined(ANDROID) || defined(MOZ_B2G))
> ++#if !(defined(ANDROID) || defined(MOZ_B2G) || defined(__FreeBSD__))

The header probably doesn't exist anywhere else.

  #if defined(__linux__) && !defined(ANDROID) && !defined(MOZ_B2G)

> + #include <asm/hwcap.h>
> + #else
> + #define HWCAP_VFP      (1<<0)
Comment 7 Jan Beich freebsd_committer freebsd_triage 2015-01-25 02:36:11 UTC
Reserved upstream bug numbers for the rest.
Comment 8 Sean Bruno freebsd_committer freebsd_triage 2015-01-25 17:03:38 UTC
(In reply to Jan Beich from comment #6)
AsmJSSignalHandlers.cpp chunk should probably go into files/patch-bug919968 and replaced with upstream version.

https://hg.mozilla.org/mozilla-central/rev/07ce4364fbec

> ++#elif CPU(ARM_TRADITIONAL) && OS(FREEBSD) && COMPILER(CLANG)
> ++    static void cacheFlush(void* code, size_t size)
> ++    {
> ++	__clear_cache(code, reinterpret_cast<char*>(code) + size);

Why is this limited to compiler-rt? Wouldn't __clear_cache() from libgcc
implemented via ARM_SYNC_ICACHE for NetBSD also work for us?

^^ Probably because I only test on clang and head right now.  I have no intention of building package sets for 8/9 ... but might want to build for stable/10 someday.
Comment 9 Jan Beich freebsd_committer freebsd_triage 2015-01-26 17:10:19 UTC
Created attachment 152187 [details]
arm patches, upstream version

Can you test this version? Mostly style changes. This is how the patches would look like if upstreamed and then backported to esr24.
Comment 10 Sean Bruno freebsd_committer freebsd_triage 2015-01-26 18:01:23 UTC
(In reply to Jan Beich from comment #9)
Port compiles, but getting a packaging error at the moment.


====>> Checking for filesystem violations... done
=======================<phase: run-depends    >============================
===========================================================================
====>> Recording filesystem state for prestage... done
=======================<phase: stage          >============================
===>  Staging for spidermonkey24-24.2.0
===>   spidermonkey24-24.2.0 depends on shared library: libnspr4.so - found (/usr/local/lib/libnspr4.so.1)
===>   spidermonkey24-24.2.0 depends on shared library: libreadline.so.6 - found (/usr/local/lib/libreadline.so.6)
===>   Generating temporary packing list
gmake[1]: Entering directory '/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src'
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/_virtualenv/bin/python ./config/Preprocessor.py -Dprefix="/usr/local" -Dexec_prefix="/usr/local" -Dincludedir="/usr/local/include" -Dlibdir="/usr/local/lib" -DMOZILLA_VERSION="24.2.0" -DLIBRARY_NAME="mozjs-24" -DJS_CONFIG_LIBS="-L/usr/local/lib -lplds4 -lplc4 -lnspr4 -pthread  -lm -lz -pthread" -DJS_CONFIG_MOZ_JS_LIBS="-L/usr/local/lib -lmozjs-24" -DMOZJS_MAJOR_VERSION="24" -DMOZJS_MINOR_VERSION="2" -DMOZJS_PATCH_VERSION="0" -DMOZJS_ALPHA="" -DNSPR_CFLAGS="-I/usr/local/include/nspr" -DNSPR_PKGCONF_CHECK="nspr >= 4.9.2" -DUSE_CXX11="" js.pc.in > mozjs-24.pc
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t mozjs-24.pc /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/libdata/pkgconfig
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t js-config.h js.msg jsalloc.h jsapi.h jsclass.h jsclist.h jscpucfg.h jsdbgapi.h jsfriendapi.h jslock.h ./perf/jsperf.h jsprf.h jsprototypes.h jsproxy.h jsprvtd.h jspubtd.h jstypes.h jsutil.h jsversion.h jswrapper.h /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/include/mozjs-24
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t ./../public/Anchor.h ./../public/CallArgs.h ./../public/CharacterEncoding.h ./../public/Date.h ./../public/GCAPI.h ./../public/HashTable.h ./../public/HeapAPI.h ./../public/LegacyIntTypes.h ./../public/MemoryMetrics.h ./../public/PropertyKey.h ./../public/RequiredDefines.h ./../public/RootingAPI.h ./../public/TemplateLib.h ./../public/Utility.h ./../public/Value.h ./../public/Vector.h /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/include/mozjs-24/js
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t ./../../mfbt/Assertions.h ./../../mfbt/Atomics.h ./../../mfbt/Attributes.h ./../../mfbt/BloomFilter.h ./../../mfbt/Casting.h ./../../mfbt/Char16.h ./../../mfbt/CheckedInt.h ./../../mfbt/Compiler.h ./../../mfbt/Constants.h ./../../mfbt/DebugOnly.h ./../../mfbt/decimal/Decimal.h ./../../mfbt/Endian.h ./../../mfbt/EnumSet.h ./../../mfbt/FloatingPoint.h ./../../mfbt/GuardObjects.h ./../../mfbt/HashFunctions.h ./../../mfbt/Likely.h ./../../mfbt/LinkedList.h ./../../mfbt/MathAlgorithms.h ./../../mfbt/MemoryChecking.h ./../../mfbt/MSStdInt.h ./../../mfbt/NullPtr.h ./../../mfbt/PodOperations.h ./../../mfbt/Poison.h ./../../mfbt/Range.h ./../../mfbt/RangedPtr.h ./../../mfbt/RefPtr.h ./../../mfbt/Scoped.h ./../../mfbt/SHA1.h ./../../mfbt/SplayTree.h ./../../mfbt/StandardInteger.h ./../../mfbt/ThreadLocal.h ./../../mfbt/TypedEnum.h ./../../mfbt/Types.h ./../../mfbt/TypeTraits.h ./../../mfbt/Util.h ./../../mfbt/WeakPtr.h /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/include/mozjs-24/mozilla
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t js24-config /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/bin
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t libjs_static.a /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/lib
mv -f /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/lib/libjs_static.a /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/lib/libmozjs-24.a
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t libmozjs-24.so /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/lib
gmake -C shell install
gmake[2]: Entering directory '/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/shell'
/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/config/nsinstall -t js24 /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/bin
gmake[2]: Leaving directory '/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src/shell'
gmake[1]: Leaving directory '/wrkdirs/usr/ports/lang/spidermonkey24/work/mozjs-24.2.0/js/src'
/bin/ln -s libmozjs-24.so /wrkdirs/usr/ports/lang/spidermonkey24/work/stage/usr/local/lib/libmozjs-24.so.1
====> Compressing man pages (compress-man)
===========================================================================
====> Running Q/A tests (stage-qa)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: lib/libmozjs-24.a
===> Checking for items in pkg-plist which are not in STAGEDIR
===> Error: Plist issues found.
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/spidermonkey24
====>> Error: check-plist failures detected
=======================<phase: Interactive    >============================
[00:03:41] ====>> Installing packages
[00:03:41] ====>> Installing run-depends for lang/spidermonkey24
[00:03:42] ====>> Installing lang/spidermonkey24
pkg-static: /tmp/pkgs/spidermonkey24-24.2.0.txz: No such file or directory
pkg-static: Was 'pkg install /tmp/pkgs/spidermonkey24-24.2.0.txz' meant?

Failed to install the following 1 package(s): /tmp/pkgs/spidermonkey24-24.2.0.txz
*** Error code 70

Stop.
make: stopped in /usr/ports/lang/spidermonkey24
[00:03:43] ====>> Warning: Failed to install lang/spidermonkey24
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-01-26 20:30:11 UTC
A commit references this bug:

Author: jbeich
Date: Mon Jan 26 20:30:09 UTC 2015
New revision: 377953
URL: https://svnweb.freebsd.org/changeset/ports/377953

Log:
  Add ARM build fixes for JavaScript engine

  PR:		197058
  Differential Revision:	https://reviews.freebsd.org/D1683
  Submitted by:	sbruno (earlier version)
  Approved by:	bapt (mentor)

Changes:
  head/mail/thunderbird/files/patch-bug1125579
  head/mail/thunderbird/files/patch-bug1125580
  head/www/firefox/files/patch-bug1125579
  head/www/firefox/files/patch-bug1125580
  head/www/firefox-esr/files/patch-bug1125579
  head/www/firefox-esr/files/patch-bug1125580
  head/www/libxul/files/patch-bug1125579
  head/www/libxul/files/patch-bug1125580
  head/www/seamonkey/files/patch-bug1125579
  head/www/seamonkey/files/patch-bug1125580
Comment 12 Sean Bruno freebsd_committer freebsd_triage 2015-01-30 01:18:56 UTC
Are we still waiting for something here?
Comment 13 commit-hook freebsd_committer freebsd_triage 2015-01-30 09:58:15 UTC
A commit references this bug:

Author: kwm
Date: Fri Jan 30 09:58:07 UTC 2015
New revision: 378144
URL: https://svnweb.freebsd.org/changeset/ports/378144

Log:
  Fix the build on ARM [1]
  Add DTRACE option (default off) [2]

  PR:		197058 [1]
  PR:		192614 [2]
  Submitted by:	sbruno@ [1], jbeich@ [2]

Changes:
  head/lang/spidermonkey24/Makefile
  head/lang/spidermonkey24/files/
  head/lang/spidermonkey24/files/patch-assembler_jit_ExecutableAllocator.h
  head/lang/spidermonkey24/files/patch-bug1041795
  head/lang/spidermonkey24/files/patch-bug1046224
  head/lang/spidermonkey24/files/patch-bug702179
  head/lang/spidermonkey24/files/patch-jit_AsmJSSignalHandlers.cpp
  head/lang/spidermonkey24/files/patch-jit_arm_Architecture-arm.cpp
  head/lang/spidermonkey24/pkg-plist