Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torque is built 32bit for arm cross compile #27838

Closed
lal12 opened this issue May 23, 2019 · 10 comments
Closed

Torque is built 32bit for arm cross compile #27838

lal12 opened this issue May 23, 2019 · 10 comments
Labels
build Issues and PRs related to build files or the CI. question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency.

Comments

@lal12
Copy link
Contributor

lal12 commented May 23, 2019

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?

@lal12 lal12 changed the title Torque is built 32bit for cross compile Torque is built 32bit for arm cross compile May 23, 2019
@devsnek
Copy link
Member

devsnek commented May 23, 2019

@nodejs/v8

@devsnek devsnek added question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency. labels May 23, 2019
@joyeecheung
Copy link
Member

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.

@lal12
Copy link
Contributor Author

lal12 commented May 23, 2019

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.

@joyeecheung
Copy link
Member

joyeecheung commented May 23, 2019

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

@lal12
Copy link
Contributor Author

lal12 commented May 23, 2019

@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.

@hashseed
Copy link
Member

hashseed commented May 23, 2019

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.

@refack refack added the build Issues and PRs related to build files or the CI. label May 23, 2019
@refack
Copy link
Contributor

refack commented May 23, 2019

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).

@lal12
Copy link
Contributor Author

lal12 commented May 23, 2019

@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

@hashseed
Copy link
Member

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.

@refack
Copy link
Contributor

refack commented May 23, 2019

Thank you for both for answering my follow up question 🎩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. question Issues that look for answers. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants