Node: Torque is built 32bit for arm cross compile

Created on 23 May 2019  路  10Comments  路  Source: nodejs/node

I am building NodeJS for ARMv7 on a x86_64 linux machine. I noticed that torque is compiled for x86, though running a 64bit system. It is no problem for my desktop system where I can install a multilib libstc++, however this is a bit ugly for our build environment.

So I wondered in general whether there is actual any requirement to build torque in 32bit, since it is a host tool anyway. Is this really required (maybe because I am cross compiling for 32bit ARM) or is it just a build system limitation?

V8 Engine build question

All 10 comments

@nodejs/v8

As this has little to do with Node.js itself, https://groups.google.com/forum/?nomobile=true#!forum/v8-dev or https://groups.google.com/forum/?nomobile=true#!forum/v8-users may be better places for this question.

I did some digging it leads to:

deps/v8/gypfiles/toolchain.gypi:

'conditions': [
    ['host_arch=="ia32" or host_arch=="x64" or \
      host_arch=="ppc" or host_arch=="ppc64" or \
      host_arch=="s390" or host_arch=="s390x" or \
      clang==1', {
      'variables': {
        'host_cxx_is_biarch%': 1,
       },
     }, {
      'variables': {
        'host_cxx_is_biarch%': 0,
      },
    }],
    ['target_arch=="ia32" or target_arch=="x64" or \
      target_arch=="ppc" or target_arch=="ppc64" or target_arch=="s390" or \
      target_arch=="s390x" or clang==1', {
      'variables': {
        'target_cxx_is_biarch%': 1,
       },
     }, {
      'variables': {
        'target_cxx_is_biarch%': 0,
      },
    }],
  ],

deps/v8/src/base/build_config.h:

#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
#error Target architecture arm is only supported on arm and ia32 host
#endif

Just as a starting point if someone else is looking into it.

Will do some asking in the v8 related groups though.

You may have better luck looking at the original GN build files now (we port those into GYP for Node.js):

# We reuse the snapshot toolchain for building torque and other generators to
# avoid building v8_libbase on the host more than once. On mips with big endian,
# the snapshot toolchain is the target toolchain and, hence, can't be used.

https://github.com/v8/v8/blob/e588ff10e5d63e33758960cbd66f5950930b9266/BUILD.gn#L196-L199

@joyeecheung yeah I noticed that. However since it seems be written in the build_config.h it definetly is prevented by their config via defines wether it is in the GN build too probably does not matter. Unless maybe they would set V8_HOST_ARCH_IA32 in the GN build files on a x64 system, which seems very unlikely to me.

I will try to just compile it by fixing the mentioned places above and will see what comes out. Maybe sb. will respond on their google group too.

The reason is that you are building for arm32. V8's startup snapshot contains V8 objects. To create the snapshot, we actually run V8 as a build step on the cross compile host.

The layout of these objects depend on the pointer size of the platform, because the C++ code in V8 make implicit assumptions about the objects on V8's heap. That's why even when cross compiling we choose to use ia32 on the host platform.

The reason is that you are building for arm32.

Is that necessarily true for for torque and/or bytecode_builtins_list_generator? (IIUC mksnapshot needs to be similar to the target platform, but it's an optional step).

@refack look into the Google group thread I linked above. There it is explained that is only due to mksnapshot. Didn't knew that is an optional step though

Not necessary for torque, but also not supported. I'm sure you can make it work somehow, but you probably would also run into some assumptions that would be invalidated.

Also, the no-snapshot build is going away soon. So you will need to run mksnapshot.

Thank you for both for answering my follow up question 馃帺

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfahlander picture dfahlander  路  3Comments

seishun picture seishun  路  3Comments

danielstaleiny picture danielstaleiny  路  3Comments

cong88 picture cong88  路  3Comments

willnwhite picture willnwhite  路  3Comments