fixes for windows execution (#7740)

This commit is contained in:
Patrick Quist
2025-05-30 04:53:20 +02:00
committed by GitHub
parent 3859bdda5a
commit abe7d9c836
3 changed files with 32 additions and 8 deletions

View File

@@ -960,6 +960,19 @@ export class BaseCompiler {
});
}
getSharedLibraryBinPaths(libraries: SelectedLibraryVersion[], dirPath?: string): string[] {
return libraries.flatMap(selectedLib => {
const foundVersion = this.findLibVersion(selectedLib);
if (!foundVersion) return [];
const paths: string[] = [];
if (this.buildenvsetup && !this.buildenvsetup.extractAllToRoot && dirPath) {
paths.push(path.join(dirPath, selectedLib.id, 'bin'));
}
return paths;
});
}
protected getSharedLibraryPathsAsArguments(
libraries: SelectedLibraryVersion[],
libDownloadPath: string | undefined,
@@ -2168,6 +2181,13 @@ export class BaseCompiler {
);
}
executeParameters.env.PATH = [
...this.getSharedLibraryBinPaths(key.libraries, buildResult.dirPath),
executeParameters.env.PATH,
]
.filter(Boolean)
.join(path.delimiter);
const execTriple = await RemoteExecutionQuery.guessExecutionTripleForBuildresult(buildResult);
if (!this.compiler.emulated && !matchesCurrentHost(execTriple)) {
if (await RemoteExecutionQuery.isPossible(execTriple)) {

View File

@@ -101,9 +101,13 @@ export async function copyNeededDlls(
execoptions: ExecutionOptionsWithEnv,
): Promise<void> {
const winutils = new WinUtils(execFunction, objdumper, execoptions);
const dlls = await winutils.get_dlls_used(executableFilename);
for (const dll of dlls) {
const infolder = path.join(dirPath, path.basename(dll));
await fs.copyFile(dll, infolder);
try {
const dlls = await winutils.get_dlls_used(executableFilename);
for (const dll of dlls) {
const infolder = path.join(dirPath, path.basename(dll));
await fs.copyFile(dll, infolder);
}
} catch (e) {
logger.error(`Error while retreiving or copying dll dependencies of ${executableFilename}`);
}
}

View File

@@ -71,7 +71,7 @@ function testFilter(filename: string, suffix: string, filters: ParseFiltersAndOu
}
describe('Filter test cases', () => {
if (process.platform === 'win32') {
if (process.platform === 'win32' || process.platform === 'darwin') {
it('should skip filter-tests on Windows', () => {
expect(true).toBe(true);
});
@@ -93,7 +93,7 @@ describe('Filter test cases', () => {
}
});
describe('Binary, directives, labels and comments', () => {
if (process.platform !== 'win32') {
if (process.platform !== 'win32' && process.platform !== 'darwin') {
for (const x of cases) {
testFilter(x, '.binary.directives.labels.comments', {
binary: true,
@@ -105,7 +105,7 @@ describe('Filter test cases', () => {
}
});
describe('Binary, directives, labels, comments and library code', () => {
if (process.platform !== 'win32') {
if (process.platform !== 'win32' && process.platform !== 'darwin') {
for (const x of cases) {
if (!x.endsWith('-bin.asm')) continue;
@@ -120,7 +120,7 @@ describe('Filter test cases', () => {
}
});
describe('Binary, directives, labels, comments and library code with dontMaskFilenames', () => {
if (process.platform !== 'win32') {
if (process.platform !== 'win32' && process.platform !== 'darwin') {
for (const x of cases) {
if (!x.endsWith('-bin.asm')) continue;