Closed Bug 360195 Opened 18 years ago Closed 16 years ago

Patch: Compiling Tamarin under Linux/X86

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: lucian.cionca, Assigned: mtilburg)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; chrome://navigator/locale/navigator.properties; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; chrome://navigator/locale/navigator.properties; rv:1.7.5) Gecko/20041107 Firefox/1.0

If you want to compile on Linux/86 and start playing with Tamarin
right now :-) here is a quick and dirty patch allowing you to do so.

 - Note that you will still to get zlib as described on the wiki:
http://developer.mozilla.org/en/docs/Tamarin_Build_Documentation
 - Create a file named tamarin/platform/unix/AvmDebugUnix.cpp with the
following content:

 #include "avmplus.h"

 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>

 #ifdef MEMORY_CHECK
 #include <malloc.h>
 #include <DbgHelp.h>
 #include <strsafe.h>
 #endif

 namespace avmplus
 {
        void AvmDebugMsg(bool /*debuggerBreak*/, const char* format, ...)
        {
                va_list ap;
                va_start(ap, format);
                vfprintf(stderr, format, ap);
                putc('\n', stderr);
                va_end(ap);
        }

        void AvmDebugMsg(const char* p, bool /*debugBreak*/)
        {
                fprintf(stderr, "%s\n", p);
        }
 }

 - Apply the following patch in the tamarin directory, like this:
patch -p2 < patchfile

diff -rN -u old-js/tamarin/codegen/CodegenMIR.cpp
new-js/tamarin/codegen/CodegenMIR.cpp
--- old-js/tamarin/codegen/CodegenMIR.cpp       2006-11-06 21:34:00.000000000 -0800
+++ new-js/tamarin/codegen/CodegenMIR.cpp       2006-11-08 15:54:02.000000000 -0800
@@ -1716,6 +1716,7 @@
                       // start over with bigger buffer.
                       expansionFactor *= 2;
                       #ifdef AVMPLUS_PROFILE
+                       /*
                       if (StaticProfiler::sprofile)
                       {
                               core->console  << "INFO: MIR buffer expanding ("
@@ -1728,6 +1729,7 @@
                                       #endif
                                       << " )\n";
                       }
+                       */
                       #endif /* AVMPLUS_PROFILE */

                       overflow = true;
diff -rN -u old-js/tamarin/core/builtin.cpp new-js/tamarin/core/builtin.cpp
--- old-js/tamarin/core/builtin.cpp     2006-11-06 21:34:00.000000000 -0800
+++ new-js/tamarin/core/builtin.cpp     2006-11-08 17:40:01.000000000 -0800
@@ -29,6 +29,13 @@
 *
 ***** END LICENSE BLOCK ***** */

+namespace avmplus
+{
+       namespace NativeID
+       {
+
+#include "builtin.h"
+
 const unsigned char builtin_abc_data[26281] = {
 0x10, 0x00, 0x2e, 0x00, 0x0b, 0x00, 0x01, 0x02, 0x0a, 0x03, 0xff,
0xff, 0xff, 0xff, 0x07, 0x10,
 0x04, 0x08, 0x07, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff,
@@ -1673,3 +1680,5 @@
 0x65, 0x00, 0x5d, 0x08, 0x66, 0x08, 0x30, 0x5d, 0xa4, 0x05, 0x66,
0xa4, 0x05, 0x58, 0x1b, 0x1d,
 0x68, 0xc7, 0x04, 0x65, 0x00, 0x5d, 0x08, 0x66, 0x08, 0x30, 0x5d,
0xa4, 0x05, 0x66, 0xa4, 0x05,
 0x58, 0x1c, 0x1d, 0x68, 0x9d, 0x05, 0x47, 0x00, 0x00 };
+       }
+}
diff -rN -u old-js/tamarin/MMgc/GC.cpp new-js/tamarin/MMgc/GC.cpp
--- old-js/tamarin/MMgc/GC.cpp  2006-11-06 21:33:59.000000000 -0800
+++ new-js/tamarin/MMgc/GC.cpp  2006-11-08 15:54:01.000000000 -0800
@@ -54,7 +54,7 @@
 #include "alloca.h"
 #endif

-#if defined(_MAC) && defined(MMGC_IA32)
+#if !defined(WIN32) && defined(MMGC_IA32)
 #include <pthread.h>
 #endif

@@ -515,6 +515,7 @@

       void GC::Free(void *item)
       {
+               bool isLarge;
               CheckThread();
               // we can't allow free'ing something during Sweeping, otherwise
alloc counters
               // get decremented twice and destructors will be called twice.
@@ -526,7 +527,7 @@
                       goto bail;
               }

-               bool isLarge = GCLargeAlloc::IsLargeBlock(GetRealPointer(item));
+               isLarge = GCLargeAlloc::IsLargeBlock(GetRealPointer(item));

               if (marking) {
                       // if its on the work queue don't delete it, if this item is
@@ -2591,11 +2592,16 @@
       }
 #endif  /* DEBUGGER*/

-#if defined(_MAC) && defined(MMGC_IA32)
+#if !defined(WIN32) && defined(MMGC_IA32)
       // FIXME: 64 bit problem, use intptr
       int GC::GetStackTop() const
       {
+#ifdef _MAC
               return (int)pthread_get_stackaddr_np(pthread_self());
+#else
+               int dummy;
+               return (int)&dummy;
+#endif
       }
 #endif

diff -rN -u old-js/tamarin/MMgc/makecommon new-js/tamarin/MMgc/makecommon
--- old-js/tamarin/MMgc/makecommon      2006-11-06 21:33:59.000000000 -0800
+++ new-js/tamarin/MMgc/makecommon      2006-11-08 15:54:01.000000000 -0800
@@ -75,7 +75,6 @@
                       ${MMGC_ROOT}/GCHashtable.cpp \
                       ${MMGC_ROOT}/GCDebugUnix.cpp \
                       ${MMGC_ROOT}/GCAllocObjectUnix.cpp \
-                       ${MMGC_ROOT}/GCAllocBase.cpp \
                       ${MMGC_ROOT}/GCAlloc.cpp \
                       ${MMGC_ROOT}/GC.cpp \
                       ${MMGC_ROOT}/GCTests.cpp \
diff -rN -u old-js/tamarin/platform/unix/makecommon
new-js/tamarin/platform/unix/makecommon
--- old-js/tamarin/platform/unix/makecommon     2006-11-06 21:34:05.000000000 -0800
+++ new-js/tamarin/platform/unix/makecommon     2006-11-09 15:51:32.000000000 -0800
@@ -33,8 +33,12 @@
 AVMPLUS_DEBUG_CFLAGS     := -g
 AVMPLUS_RELEASE_CFLAGS   := -O3

-AVMPLUS_DEBUG_CXXFLAGS   := ${AVMPLUS_DEBUG_CFLAGS}
-DAVMPLUS_NOVIRTUAL -DAVMPLUS_SHELL -fno-exceptions -fno-rtti
-Wno-invalid-offsetof -rdynamic
-AVMPLUS_RELEASE_CXXFLAGS := ${AVMPLUS_RELEASE_CFLAGS}
-DAVMPLUS_NOVIRTUAL -DAVMPLUS_SHELL -fno-exceptions -fno-rtti
-Wno-invalid-offsetof
+ifdef GCC4
+GCC4FLAGS := -Wno-invalid-offsetof
+endif
+
+AVMPLUS_DEBUG_CXXFLAGS   := ${AVMPLUS_DEBUG_CFLAGS}
-DAVMPLUS_NOVIRTUAL -DAVMPLUS_SHELL -fno-exceptions -fno-rtti
$(GCC4FLAGS) -rdynamic
+AVMPLUS_RELEASE_CXXFLAGS := ${AVMPLUS_RELEASE_CFLAGS}
-DAVMPLUS_NOVIRTUAL -DAVMPLUS_SHELL -fno-exceptions -fno-rtti
$(GCC4FLAGS)

 ifeq (YES, ${DEBUG})
   AVMPLUS_CFLAGS       := ${AVMPLUS_DEBUG_CFLAGS} -D_DEBUG -DDEBUG
@@ -73,24 +77,23 @@
    ${ZLIB_ROOT}/zlib/adler32.cpp

 AVMPLUS_SRCS := ${AVMPLUS_ROOT}/core/AbcEnv.cpp \
+       ${AVMPLUS_ROOT}/core/builtin.cpp \
       ${AVMPLUS_ROOT}/core/AbcGen.cpp \
       ${AVMPLUS_ROOT}/core/AbcParser.cpp \
       ${AVMPLUS_ROOT}/core/AbstractFunction.cpp \
-       ${AVMPLUS_ROOT}/core/Accessor.cpp \
       ${AVMPLUS_ROOT}/core/ActionBlockConstants.cpp \
       ${AVMPLUS_ROOT}/core/ArrayClass.cpp \
       ${AVMPLUS_ROOT}/core/ArrayObject.cpp \
       ${AVMPLUS_ROOT}/core/AtomArray.cpp \
       ${AVMPLUS_ROOT}/core/AtomConstants.cpp \
       ${AVMPLUS_ROOT}/core/AvmCore.cpp \
-       ${AVMPLUS_ROOT}/core/AvmDebugUnix.cpp \
+       ${AVMPLUS_ROOT}/core/AvmPlusScriptableObject.cpp \
       ${AVMPLUS_ROOT}/core/avmplus.cpp \
       ${AVMPLUS_ROOT}/core/avmplusDebugger.cpp \
       ${AVMPLUS_ROOT}/core/avmplusHashtable.cpp \
       ${AVMPLUS_ROOT}/core/avmplusProfiler.cpp \
       ${AVMPLUS_ROOT}/core/BigInteger.cpp \
       ${AVMPLUS_ROOT}/core/BooleanClass.cpp \
-       ${AVMPLUS_ROOT}/core/builtin.cpp \
       ${AVMPLUS_ROOT}/codegen/Ia32Assembler.cpp \
       ${AVMPLUS_ROOT}/codegen/CodegenMIR.cpp \
       ${AVMPLUS_ROOT}/core/BuiltinTraits.cpp \
@@ -147,6 +150,7 @@
       ${AVMPLUS_ROOT}/core/XMLListObject.cpp \
       ${AVMPLUS_ROOT}/core/XMLObject.cpp \
       ${AVMPLUS_ROOT}/core/XMLParser16.cpp \
+       ${AVMPLUS_ROOT}/extensions/JavaGlue.cpp \
       ${AVMPLUS_ROOT}/pcre/pcre_chartables.cpp \
       ${AVMPLUS_ROOT}/pcre/pcre_compile.cpp \
       ${AVMPLUS_ROOT}/pcre/pcre_config.cpp \
@@ -165,6 +169,7 @@
       ${AVMPLUS_ROOT}/pcre/pcre_valid_utf8.cpp \
       ${AVMPLUS_ROOT}/pcre/pcre_version.cpp \
       ${AVMPLUS_ROOT}/pcre/pcre_xclass.cpp \
+       ${AVMPLUS_ROOT}/platform/unix/AvmDebugUnix.cpp \
       ${AVMPLUS_ROOT}/platform/unix/DateUnix.cpp \
       ${AVMPLUS_ROOT}/platform/unix/MathUtilsUnix.cpp \
       ${AVMPLUS_ROOT}/platform/unix/OSDepUnix.cpp
diff -rN -u old-js/tamarin/platform/unix/OSDepUnix.cpp
new-js/tamarin/platform/unix/OSDepUnix.cpp
--- old-js/tamarin/platform/unix/OSDepUnix.cpp  2006-11-06
21:34:05.000000000 -0800
+++ new-js/tamarin/platform/unix/OSDepUnix.cpp  2006-11-09
16:28:47.000000000 -0800
@@ -37,7 +37,6 @@
 #ifdef DEBUGGER
 #include <unistd.h>
 #include <pthread.h>
-#include <CoreServices/CoreServices.h>
 #endif

 namespace avmplus

============= patch ends

- Start the build by just saying make in the tamarin/platform/unix directory.

Reproducible: Always
attaching patch against HEAD (2006/11/09)
*** Bug 360226 has been marked as a duplicate of this bug. ***
Comment on attachment 245166 [details] [diff] [review]
patch for compilation on Linux/x86

Too many cosmetic changes (cosmetic and functional patches should be kept separate so we can focus on stuff that actually fixes bugs). Need
to justify why various files were added to or deleted from the build system.
Attachment #245166 - Flags: review-
FYI: We will be merging in Adobe's Linux branch within a week or so, so this work is probably not necessary, and is being declined in order to prevent any conflicts.  (Adobe already has a working build for Linux -- it just happens to be in a different code branch that needs to be merged in.)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → mtilburg
Assignee: mtilburg → nobody
Component: Tamarin → Virtual Machine
Flags: review-
Product: Core → Tamarin
QA Contact: tamarin → vm
Version: Trunk → unspecified
Assignee: nobody → mtilburg
tamarin-central compiles under linux now using the cross platform build scripts.

Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: