compiling node.js (v8) natively on ARMv7a (overo) and setting -march

246 views
Skip to first unread message

AJ ONeal

unread,
Jul 26, 2010, 9:55:23 AM7/26/10
to General mailing list for gumstix users., node.js mailing list
I'm compiling on an arm7va Cortex-A8 [1] (omap3530 Gumstix Overo) using OpenEmbebbed's task-sdk-native and it seems that the compiler's environment variables aren't being set correctly. I'd like some direction as to how to fix this.

The comments in the source also recommend using -march=armv7 to tell the compiler that it's on the right cpu, but how do I do this with WAF?



The details:

When I run 

touch foo.cc
g++ -dM -E foo.cc > environment.txt 

I can see

#define __ARM_ARCH_4T__ 1

whereas I expect

#define __ARM_ARCH_7A__ 1


Because the environment is improper the constants in ./deps/v8/src/arm/constants-arm.h are off I get

deps/v8/src/arm/macro-assembler-arm.cc:
error "For thumb inter-working we require an architecture which supports blx"

Note 

// We do not support thumb inter-working with an arm architecture not supporting
// the blx instruction (below v5t).  If you know what CPU you are compiling for
// you can use -march=armv7 or similar.


For now I'm changing the source to manually set and seeing if it works or not

#define CAN_USE_ARMV7_INSTRUCTIONS 1


I'm working on putting up a blog with instructions to get as far as I've gotten (there was some trouble getting the right modules installed for python so that WAF could run). I'll post that once I have it up.

AJ ONeal

AJ ONeal

unread,
Jul 26, 2010, 11:22:43 AM7/26/10
to node.js mailing list
Manually setting CAN_USE_ARMV7_INSTRUCTIONS did not help. It lead to an assembler error:

/tmp/ccxCSjUb.s: Assembler messages:
/tmp/ccxCSjUb.s:47: Error: selected processor does not support `bkpt 0'
scons: *** [obj/release/arm/cpu-arm.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/home/root/node-v0.1.101/build'
Build failed:  -> task failed (err #2): 
  {task: libv8.a SConstruct -> libv8.a}
make: *** [all] Error 1

I did find how to pass the -march flag to WAF, however:

export CC="gcc -march=armv7-a"
export CXX="g++ -march=armv7-a"

And now I get the results I expected

Waf: Leaving directory `/home/root/node-v0.1.101/build'
'build' finished successfully (40m36.030s)

My next step is to finish writing my post on how to do this and then to figure out how to cross-compile with bitbake.

AJ ONeal

Tom

unread,
Jul 26, 2010, 1:24:14 PM7/26/10
to nod...@googlegroups.com
Very nice.

Are you trying to get Node running on Android?

- Tom

2010/7/26 AJ ONeal <cool...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

AJ ONeal

unread,
Jul 26, 2010, 2:06:01 PM7/26/10
to nod...@googlegroups.com
Not yet, but I was thinking about it as I was driving to work this morning and yes, I do want to get there.

Do you have some tips for doing so?

AJ ONeal

Tom

unread,
Jul 26, 2010, 3:53:39 PM7/26/10
to nod...@googlegroups.com
I wish I could help you, but afraid I don't have any experience in this kind of job.

I'm very interested in the results though! I'm sure many others are too, who do have some guidance.

AJ ONeal

unread,
Jul 26, 2010, 4:48:56 PM7/26/10
to nod...@googlegroups.com
Here's my journey so far:

I go the long way around by introducing every possible error that you could get (or at least the ones I managed to get) and what the fixes are.

Here's the concise version:

    opkg install python python-modules python-distutils python-misc 
    opkg install task-sdk-native
    opkg openssl openssl-dev
    tar xf node-v0.1.102.tar.gz
    cd node-v0.1.102
    ./configure
    CC='gcc -march=armv7-a'
    CXX='g++ -march=armv7-a'
    make
    make test && make install

If I perchance missed anything and you get an error, you'll find the solution in the blog.

AJ ONeal

Tom

unread,
Jul 26, 2010, 5:19:44 PM7/26/10
to nod...@googlegroups.com
Nice progess.

Would be awesome if this would end in a node binary for Android 2.x

AJ ONeal

unread,
Jul 26, 2010, 5:57:47 PM7/26/10
to nod...@googlegroups.com
Correction: I forgot the export
 
    opkg install python python-modules python-distutils python-misc 
    opkg install task-sdk-native
    opkg openssl openssl-dev
    tar xf node-v0.1.102.tar.gz
    cd node-v0.1.102
    ./configure
    export CC='gcc -march=armv7-a'
    export CXX='g++ -march=armv7-a'
    make
    make test && make install

AJ ONeal

unread,
Jul 26, 2010, 6:00:06 PM7/26/10
to nod...@googlegroups.com
If you tell me the -march and -mtune you're looking for, I can build you a binary and you can test if it works for you or not.

I haven't built anything with andriod yet (a pity, because google gave me the phone and I use it every day and love it), but if my binary will run on your system and you can give me the howto of installing it, that will motivate me a bit further.

AJ ONeal

Tom

unread,
Jul 26, 2010, 7:15:32 PM7/26/10
to nod...@googlegroups.com
To be honest I'm not the right person to help you.

I have no knowledge about hardware, no idea how to find out what "march" or "mtune" I need. It's for the Samsung Galaxy i9000 S (android 2.1) if that helps.

My phone is not "rooted" or "jailbroken" either. Not sure if that's necessary though.

But like I said, probably need someone with more experience to help you out here.

- Tom

2010/7/27 AJ ONeal <cool...@gmail.com>

AJ ONeal

unread,
Jul 27, 2010, 1:00:12 AM7/27/10
to nod...@googlegroups.com
It looks like the only way to get node on the android will be to statically link it, but I don't know how to do that yet either.


I'm not understanding the point of WAF. I keep banging my head against it again and again because it keeps being a wall in my way.

It took me quite a while to figure out which python modules belonged to which OpenEmbedded packages to get that installed.

Then it took more time to figure out how to pass -march.

I haven't had much help figuring out how to cross-compile with WAF.

I tried static linking by adding the FULLSTATIC variable in the wscript, but that failed.



But if I manage to get a cross compile or static setup working through WAF I have some guidance from there:


And that has been my side-track for the evening.

BTW, your phone is an arm7v-a cortex a8 - just like the gumstix overo.

AJ ONeal
Reply all
Reply to author
Forward
0 new messages