Building v8 for MIPs platform.

330 views
Skip to first unread message

Nilima Chavan

unread,
Jul 8, 2010, 8:12:45 AM7/8/10
to v8-users
When I am trying to build v8 for MIP platform, I am getting following
errors:
$ scons simulator=mips

In file included from src/virtual-frame.h:41,
from src/virtual-frame-inl.h:31,
from src/codegen.cc:41:
src/mips/virtual-frame-mips.h:74: error: 'NumberInfo' has not been
declared
src/mips/virtual-frame-mips.h:366: error: 'NumberInfo' has not been
declared
src/mips/virtual-frame-mips.h:390: error: 'NumberInfo' has not been
declared
src/mips/virtual-frame-mips.h:391: error: 'NumberInfo' has not been
declared
src/mips/virtual-frame-mips.h:74: error: 'NumberInfo' has not been
declared
src/mips/virtual-frame-mips.h:366: error: 'NumberInfo' has not been
declared
In file included from src/virtual-frame-inl.h:36,
from src/codegen.cc:41:
src/virtual-frame-light-inl.h: In constructor
'v8::internal::VirtualFrame::VirtualFrame()':
src/virtual-frame-light-inl.h:41: error: class
'v8::internal::VirtualFrame' does not have any field named
'element_count_'
src/virtual-frame-light-inl.h:42: error: class
'v8::internal::VirtualFrame' does not have any field named
'top_of_stack_state_'
src/virtual-frame-light-inl.h:42: error: 'NO_TOS_REGISTERS' was not
declared in this scope
src/virtual-frame-light-inl.h:43: error: class
'v8::internal::VirtualFrame' does not have any field named
'register_allocation_map_'
src/virtual-frame-light-inl.h:43: error: no matching function for call
to 'v8::internal::ZoneList<v8::internal::FrameElement>::ZoneList()'
src/zone.h:170: note: candidates are:
v8::internal::ZoneList<T>::ZoneList(int) [with T =
v8::internal::FrameElement]
src/zone.h:166: note:
v8::internal::ZoneList<v8::internal::FrameElement>::ZoneList(const
v8::internal::ZoneList<v8::internal::FrameElement>&)
src/virtual-frame-light-inl.h: In constructor
'v8::internal::VirtualFrame::VirtualFrame(v8::internal::VirtualFrame*)':
src/virtual-frame-light-inl.h:48: error: class
'v8::internal::VirtualFrame' does not have any field named
'element_count_'
src/virtual-frame-light-inl.h:49: error: class
'v8::internal::VirtualFrame' does not have any field named
'top_of_stack_state_'
src/virtual-frame-light-inl.h:49: error: 'class
v8::internal::VirtualFrame' has no member named 'top_of_stack_state_'
src/virtual-frame-light-inl.h:50: error: class
'v8::internal::VirtualFrame' does not have any field named
'register_allocation_map_'
src/virtual-frame-light-inl.h:50: error: 'class
v8::internal::VirtualFrame' has no member named
'register_allocation_map_'
src/virtual-frame-light-inl.h:50: error: no matching function for call
to 'v8::internal::ZoneList<v8::internal::FrameElement>::ZoneList()'
src/zone.h:170: note: candidates are:
v8::internal::ZoneList<T>::ZoneList(int) [with T =
v8::internal::FrameElement]
src/zone.h:166: note:
v8::internal::ZoneList<v8::internal::FrameElement>::ZoneList(const
v8::internal::ZoneList<v8::internal::FrameElement>&)
src/virtual-frame-light-inl.h: In member function 'bool
v8::internal::VirtualFrame::Equals(v8::internal::VirtualFrame*)':
src/virtual-frame-light-inl.h:55: error: 'top_of_stack_state_' was not
declared in this scope
src/virtual-frame-light-inl.h:55: error: 'class
v8::internal::VirtualFrame' has no member named 'top_of_stack_state_'
src/virtual-frame-light-inl.h:56: error: 'register_allocation_map_'
was not declared in this scope
src/virtual-frame-light-inl.h:56: error: 'class
v8::internal::VirtualFrame' has no member named
'register_allocation_map_'
src/codegen.cc: At global scope:
src/codegen.cc:325: error: 'GenerateCallFunction' is not a member of
'v8::internal::CodeGenerator'
src/codegen.cc:325: error: 'GenerateRegExpConstructResult' is not a
member of 'v8::internal::CodeGenerator'
src/codegen.cc:325: error: 'GenerateGetFromCache' is not a member of
'v8::internal::CodeGenerator'
src/codegen.cc:325: error: 'GenerateSwapElements' is not a member of
'v8::internal::CodeGenerator'
cc1plus: warnings being treated as errors
src/mips/virtual-frame-mips.h:486: warning: inline function 'void
v8::internal::VirtualFrame::PushFrameSlotAt(int)' used but never
defined
src/mips/virtual-frame-mips.h:366: warning: inline function 'void
v8::internal::VirtualFrame::Push(v8::internal::Register, int)' used
but never defined
src/mips/virtual-frame-mips.h:367: warning: inline function 'void
v8::internal::VirtualFrame::Push(v8::internal::Handle<v8::internal::Object>)'
used but never defined
scons: *** [obj/debug/codegen.o] Error 1
scons: building terminated because of errors.


Can anyone help on this ??

Erik Corry

unread,
Jul 8, 2010, 4:41:41 PM7/8/10
to v8-u...@googlegroups.com
The MIPS port isn't done.  It doesn't work.




--
Erik Corry, Software Engineer
Google Denmark ApS.  CVR nr. 28 86 69 84
c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018 Copenhagen K, Denmark.

Nilima Chavan

unread,
Jul 9, 2010, 7:02:49 AM7/9/10
to v8-users
So we can not use v8 JavaScript engine on MIPs platform?
Does anybody working on this. Since I see mips directory under
Sources. Even SConstruct provides a way to select the architecture as
"mips".
If yes can you let us know when the work is expected to get over.

Thanks & Regards,
Nilima


On Jul 9, 1:41 am, Erik Corry <erik.co...@gmail.com> wrote:
> The MIPS port isn't done.  It doesn't work.
>

Alexandre Rames

unread,
Jul 9, 2010, 9:39:15 AM7/9/10
to v8-u...@googlegroups.com
Hi,

You can find the v8 MIPS repository with the latest code on github:

Alexandre

Nilima Chavan

unread,
Jul 12, 2010, 8:57:40 AM7/12/10
to v8-users
Thanks for the info Alexandre.

I have downloaded v8 sources from github.
But when I tried to build those sources for mips platform its giving
compilation error.
I am building the source code on UBuntu 8 (Linux 2.6.24-16-generic #1
SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux).

Environment variables are as below:
AR=/opt/kenati/bin/mips_sfp-uclibc-ar
LD=/opt/kenati/bin/mips_sfp-uclibc-ld
CXX=/opt/kenati/bin/mips_sfp-uclibc-g++
CC=/opt/kenati/bin/mips_sfp-uclibc-gcc
RANLIB=/opt/kenati/bin/mips_sfp-uclibc-ranlib

Compilation Error:
opt/kenati/bin/mips_sfp-uclibc-g++ -o obj/release/platform-linux.o -c -
Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -EL
-mips32r2 -Wa,-mips32r2 -fno-inline -mhard-float -O3 -fomit-frame-
pointer -fdata-sections -ffunction-sections -ansi -fno-strict-aliasing
-fno-rtti -fno-exceptions -Wall -Werror -W -Wno-unused-parameter -Wnon-
virtual-dtor -pedantic -EL -mips32r2 -Wa,-mips32r2 -fno-inline -mhard-
float -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -
ansi -fno-strict-aliasing -DV8_TARGET_ARCH_MIPS -
DENABLE_DEBUGGER_SUPPORT -DENABLE_LOGGING_AND_PROFILING -Isrc src/
platform-linux.cc

src/platform-linux.cc: In function `void
v8::internal::ProfilerSignalHandler(int, siginfo_t*, void*)':
src/platform-linux.cc:828: error: 'struct mcontext_t' has no member
named 'pc'
src/platform-linux.cc:829: error: 'struct mcontext_t' has no member
named 'gregs'
src/platform-linux.cc:830: error: 'struct mcontext_t' has no member
named 'gregs'
scons: *** [obj/release/platform-linux.o] Error 1
scons: building terminated because of errors.

Can anybody from your side help me on this?
Thanks & Regards,
Nilima

On Jul 9, 6:39 pm, Alexandre Rames <alexandre.ra...@gmail.com> wrote:
> Hi,
>
> You can find the v8 MIPS repository with the latest code on github:http://github.com/paul99/v8mips
>
> <http://github.com/paul99/v8mips>Alexandre
>

Nilima Chavan

unread,
Jul 12, 2010, 9:26:46 AM7/12/10
to v8-users
Finally i was able to build the libv8.a successfully with following
command line:
scons arch=mips mode=debug regexp=interpreted library=static

Have done following changes in platform-linux.cc
#elif V8_HOST_ARCH_MIPS
sample.pc = reinterpret_cast<Address>(mcontext.gpregs[35]);
sample.sp = reinterpret_cast<Address>(mcontext.gpregs[29]);
sample.fp = reinterpret_cast<Address>(mcontext.gpregs[30]);
#endif

But still I am not able to build shell with following command:
scons mode=debug simulator=mips regexp=interpreted sample=shell -j4

It is giving following kind of error:
/opt/kenati/lib/gcc/mips-kenati-linux-uclibc/3.4.3/../../../../mips-
kenati-linux-uclibc/bin/ld: /opt/kenati/lib/gcc/mips-kenati-linux-
uclibc/3.4.3/../../../../mips-kenati-linux-uclibc/lib/crt1.o: compiled
for a big endian system and target is little endian
/opt/kenati/lib/gcc/mips-kenati-linux-uclibc/3.4.3/../../../../mips-
kenati-linux-uclibc/bin/ld: /opt/kenati/lib/gcc/mips-kenati-linux-
uclibc/3.4.3/../../../../mips-kenati-linux-uclibc/lib/crt1.o:
endianness incompatible with that of the selected emulation
/opt/kenati/lib/gcc/mips-kenati-linux-uclibc/3.4.3/../../../../mips-
kenati-linux-uclibc/bin/ld: failed to merge target specific data of
file /opt/kenati/lib/gcc/mips-kenati-linux-uclibc/3.4.3/../../../../
mips-kenati-linux-uclibc/lib/crt1.o

Please let me know if I need to any kind of environment settings for
this too.

Thanks & Regards,
Nilima

Alexandre Rames

unread,
Jul 13, 2010, 5:57:23 AM7/13/10
to v8-u...@googlegroups.com, Lind, Paul
Hi,

It has been some time I haven't build it.
There is something weird with the endianness here. The MIPS build should use the -EL option to build for little endian.

Did you follow the instructions here?
Also you should try to build the "integration" branch. This branch should always compile and work (kind of dev branch).

Alexandre

paul lind

unread,
Jul 13, 2010, 2:02:38 PM7/13/10
to v8-users
Hi Nilima -

I'll try to answer your questions:

1. Alexandre is correct, you must make sure you are using the
'integration' branch (it is the default).

2. Per your command, you built libv8 for arch=mips, but you are trying
to build your shell for the simulator (simulator=mips). You cannot mix
the two. The simulator for local testing on your x86 development
platform, but if you want to build the shell for your target, you must
use a line like:

scons arch=mips mode=debug library=static sample=shell -j4

(note that I left out regexp=interpreted. That is no longer needed,
since we now have the native regular expression compiler working. I
have updated the wiki page http://wiki.github.com/paul99/v8mips/building-v8mips)

3. I see from your build log that it appears that your target is beg-
endian. That is unfortunately, as v8mips does not currently support
big-endian targets. That will get done eventually, but it is low on
our priority list. Is there any way your target can be run in little-
endian mode? (the mips cores are configurable, some target boards are
configurable, some are fixed).

I know for a fact there are places in the generated code where we make
little-endian assumptions (we have commented these), but I suspect
that there will be more issues, as to my knowledge the whole of v8 has
never been run on a big-endian target.

4. I also see that you are using uclibc. I do not know if that will
work, as it has not been tried. We have been using a mips Linux distro
with full glibc (both Debian and Timesys). We are now porting to
Android, which uses bionic.

5. The issue you fixed with mcontext.gpregs is just used when
profiling. I have only tried that on Linux 2.6. It is possibly you
just have a problem with kernel-headers, or it may be that your kernel
does not support. In any cause, it will not impact regular operation
of v8, just the profiling option (--prof option to shell).

I hope this helps,

paul

On Jul 13, 2:57 am, Alexandre Rames <alexandre.ra...@gmail.com> wrote:
> Hi,
>
> It has been some time I haven't build it.
> There is something weird with the endianness here. The MIPS build should use
> the -EL option to build for little endian.
>
> Did you follow the instructions
> here<http://wiki.github.com/paul99/v8mips/building-v8mips>
> ?
> Also you should try to build the "integration" branch. This branch should
> always compile and work (kind of dev branch).
>
> Alexandre
>
> > > > > > > defined...
>
> read more »

Nilima Chavan

unread,
Jul 14, 2010, 1:49:35 AM7/14/10
to v8-u...@googlegroups.com
Hi Paul,

Thanks for your detailed response.
But now I am bit confused about what do you mean by target.

Here is my build procedure:
I am building on Linux x86 machine with following environment variables set:
export CCPATH=/opt/kenati/mips-kenati-linux-uclibc/bin
export CC=$CCPATH/gcc
export CXX=$CCPATH/g++
export LD=$CCPATH/ld
export AR=$CCPATH/ar
export RANLIB=$CCPATH/ranlib

Build command:

scons arch=mips mode=debug library=static sample=shell -j4

Output:
libv8.a is getting compiled.
But giving endianness errors for shell.

So I have question here, I am going to use libv8.a with v8cgi and apache. So can I survive currently with just v8 library build. I do not require shell at this point of time.

Thanks & Regards,
Nilima


--

Nilima Chavan

unread,
Jul 14, 2010, 5:07:39 AM7/14/10
to v8-u...@googlegroups.com
Hi Paul,

Now I am clear about the target thing.
We were using the mips toolchain which was for Big endian to do the compilation. And as you have specified Big endian MIPs porting is not yet supported, we were getting compilation errors.
After I used mips toolchain which was little endian, compilation was successful.

We need v8 for our Big endian Targets only.

Since you know the code better, can you please provides us following information for porting the same mips code to support Big endian.
1. Complexity
2. Efforts
3. Testing required ( I think we can get this from your web site )
4. When you have planned for Big endian porting ( This is required just for information )

Thanks & Regards,
Nilima

Paul Lind

unread,
Jul 15, 2010, 12:05:59 AM7/15/10
to v8-u...@googlegroups.com, Nilima Chavan
Hi Nilima - 

It is hard to estimate the time/complexity for this. There are a few known areas that require code-generation fixes for big-endian. Search for 'endian' in src/mips/codegen-mips.cc. Fixing those should take a few days or a week.

But as I said before I do not think that v8 has ever been run big-endian. That means there are likely to be problems that will only be uncovered by trying it and debugging. Very hard to predict the time for that. I would guess a month if you know v8, and another month or two if you are starting from scratch.

One issue is that v8 is partly implemented in javascript (the native functions), and if the natives do not compile and run, then you cannot even bring up the shell. It is hard to get the system bootstrapped to the state you can debug. Alexandre wrote a nice "simplified shell" that can come up without compiling the natives. I was going to remove that stuff, but it may be useful when trying big-endian. 

Take a look at src/mips/test-mips.cc, src/mips/test-interface-mips.cc & h, and compile_mips-test.sh, and the flag "disable_native_files" in src/flag-definitions.h


I'd just suggest you jump in and give it a try. Maybe it will come up without too much trouble.

Per your other questions: the test-suites are very complete, and the wiki pages shows how to run them. Please note that v8mips is not passing all the tests yet ... we're workin on it. The status page shows our results.

I would guess that we have 3 months of other activity before we would start working on big-endian. We still need to pass 100% of tests, improve our performance, bring our codebase up to current google codebase, and integrate with Chrome. As well as re-start the submission process of our code back to google.

Anyway, I hope that you have the interest to jump in and contribute. It is a great project, and a lot of fun. If so, we can work out how best to collaborate on the github codebase. It might be easiest to just fork the project and start. We can merge it back later.

If anyone from the google v8 team has made it this far into this long reply, we sure would love to get your feedback on possible big-endian issues......

thanks.,

paul

Nilima Chavan

unread,
Jul 16, 2010, 6:36:04 AM7/16/10
to Paul Lind, v8-u...@googlegroups.com
Hi Paul,

Thanks again.
I will definetly consider the option of porting this to mips Big-endian architecture.
But only thing worrying me now is the size of v8 library which is around 5 MB after removing debug option.
Such a big size is not suitable for the embedded devices.
Have you also seen the same observation in terms of library size.
Is there any way to optimize this?

Thanks & Regards,
Nilima

Jérémy Lal

unread,
Jul 16, 2010, 7:01:25 AM7/16/10
to v8-u...@googlegroups.com
On 16/07/2010 12:36, Nilima Chavan wrote:
> Hi Paul,
>
> Thanks again.
> I will definetly consider the option of porting this to mips Big-endian
> architecture.
> But only thing worrying me now is the size of v8 library which is around 5
> MB after removing debug option.
> Such a big size is not suitable for the embedded devices.
> Have you also seen the same observation in terms of library size.
> Is there any way to optimize this?

Strip the symbols from the lib, and then get e.g. 2627132 bytes !

Nilima Chavan

unread,
Jul 28, 2010, 9:57:00 AM7/28/10
to Paul Lind, v8-u...@googlegroups.com
Was able to get compiling for Mips after playing with some compilation flags.
But still I do need to port for source code portion.

One question, When you are planning to sync up with Google's v8 source code.
Since now I can see there are some code in Google's v8 source code which is different than yours.
Or do I need to integrate your MIPs code with Google's v8 source code?

Thanks & Regards,
Nilima

Paul Lind

unread,
Jul 28, 2010, 5:38:55 PM7/28/10
to v8-u...@googlegroups.com, Nilima Chavan
Hi Nilima - 

At this point I plan to start migrating our code forward to the latest google source next week. Depending on what bugs get either fixed or uncovered this week, that might get delayed by a bit. But I am hoping to start soon.

I don't have any suggestion about the size. v8 aims for high performance, and it does use significant resources to achieve that.

thanks,

paul
Reply all
Reply to author
Forward
0 new messages