Allow cross compiling (#150)

This commit is contained in:
Jesse Chan 2021-04-02 19:05:18 +08:00 committed by GitHub
parent 19d8d077e0
commit d7f74907ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import path from 'path';
import { spawnSync } from 'child_process';
import uniqueTempDir from 'unique-temp-dir';
import { hostPlatform } from './system';
import { hostArch, hostPlatform } from './system';
import { log } from './log';
import patchesJson from '../patches/patches.json';
@ -108,6 +108,12 @@ async function compileOnUnix(nodeVersion: string, targetArch: string) {
args.push('--dest-cpu', cpu);
}
if (hostArch !== targetArch) {
log.warn('Cross compiling!');
log.warn('You are responsible for appropriate env like CC, CC_host, etc.');
args.push('--cross-compiling');
}
// first of all v8_inspector introduces the use
// of `prime_rehash_policy` symbol that requires
// GLIBCXX_3.4.18 on some systems

View File

@ -3,7 +3,6 @@ import path from 'path';
import semver from 'semver';
import {
abiToNodeRange,
hostArch,
hostPlatform, // eslint-disable-line no-duplicate-imports
isValidNodeRange,
knownArchs,
@ -148,12 +147,6 @@ export async function need(opts: NeedOptions) {
);
}
if (hostArch !== arch) {
throw wasReported(
`Not able to build for '${opts.arch}' here, only for '${hostArch}'`
);
}
if (knownArchs.indexOf(arch) < 0) {
throw wasReported(
`Unknown arch '${opts.arch}'. Specify ${knownArchs.join(', ')}`