Skip to content

Commit 775be21

Browse files
authored
fix(launchdoctor): fix launch doctor (#4387)
New webkit build, generated by 19f21b1, changed webkit build layout: now there are subfolders that contain libraries and executables, and some of the dependencies are no longer bundled. This patch: - teaches launch doctor new directories structure: subfolders are now inspected for missing dependencies, and they are also used in the `LD_LIBRARY_PATH`. - adds `libevent` and `libicudata` libs to the mapping for ubuntu 18.04
1 parent 488b256 commit 775be21

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/server/validateDependencies.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async function validateDependenciesLinux(browserPath: string, browser: BrowserDe
109109
const lddPaths: string[] = [];
110110
for (const directoryPath of directoryPaths)
111111
lddPaths.push(...(await executablesOrSharedLibraries(directoryPath)));
112-
const allMissingDeps = await Promise.all(lddPaths.map(lddPath => missingFileDependencies(lddPath)));
112+
const allMissingDeps = await Promise.all(lddPaths.map(lddPath => missingFileDependencies(lddPath, directoryPaths)));
113113
const missingDeps: Set<string> = new Set();
114114
for (const deps of allMissingDeps) {
115115
for (const dep of deps)
@@ -210,18 +210,21 @@ async function missingFileDependenciesWindows(filePath: string): Promise<Array<s
210210
return missingDeps;
211211
}
212212

213-
async function missingFileDependencies(filePath: string): Promise<Array<string>> {
213+
async function missingFileDependencies(filePath: string, extraLDPaths: string[]): Promise<Array<string>> {
214214
const dirname = path.dirname(filePath);
215+
let LD_LIBRARY_PATH = extraLDPaths.join(':');
216+
if (process.env.LD_LIBRARY_PATH)
217+
LD_LIBRARY_PATH = `${process.env.LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}`;
215218
const {stdout, code} = await spawnAsync('ldd', [filePath], {
216219
cwd: dirname,
217220
env: {
218221
...process.env,
219-
LD_LIBRARY_PATH: process.env.LD_LIBRARY_PATH ? `${process.env.LD_LIBRARY_PATH}:${dirname}` : dirname,
222+
LD_LIBRARY_PATH,
220223
},
221224
});
222225
if (code !== 0)
223226
return [];
224-
const missingDeps = stdout.split('\n').map(line => line.trim()).filter(line => line.endsWith('not found') && line.includes('=>')).map(line => line.split('=>')[0].trim().toLowerCase());
227+
const missingDeps = stdout.split('\n').map(line => line.trim()).filter(line => line.endsWith('not found') && line.includes('=>')).map(line => line.split('=>')[0].trim());
225228
return missingDeps;
226229
}
227230

@@ -269,6 +272,7 @@ const LIBRARY_TO_PACKAGE_NAME_UBUNTU_18_04: { [s: string]: string} = {
269272
'libEGL.so.1': 'libegl1',
270273
'libenchant.so.1': 'libenchant1c2a',
271274
'libepoxy.so.0': 'libepoxy0',
275+
'libevent-2.1.so.6': 'libevent-2.1-6',
272276
'libfontconfig.so.1': 'libfontconfig1',
273277
'libfreetype.so.6': 'libfreetype6',
274278
'libgbm.so.1': 'libgbm1',
@@ -297,6 +301,7 @@ const LIBRARY_TO_PACKAGE_NAME_UBUNTU_18_04: { [s: string]: string} = {
297301
'libharfbuzz-icu.so.0': 'libharfbuzz-icu0',
298302
'libharfbuzz.so.0': 'libharfbuzz0b',
299303
'libhyphen.so.0': 'libhyphen0',
304+
'libicudata.so.60': 'libicu60',
300305
'libicui18n.so.60': 'libicu60',
301306
'libicuuc.so.60': 'libicu60',
302307
'libjpeg.so.8': 'libjpeg-turbo8',

src/utils/browserPaths.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ export function linuxLddDirectories(browserPath: string, browser: BrowserDescrip
5656
if (browser.name === 'webkit') {
5757
return [
5858
path.join(browserPath, 'minibrowser-gtk'),
59+
path.join(browserPath, 'minibrowser-gtk', 'bin'),
60+
path.join(browserPath, 'minibrowser-gtk', 'lib'),
5961
path.join(browserPath, 'minibrowser-wpe'),
62+
path.join(browserPath, 'minibrowser-wpe', 'bin'),
63+
path.join(browserPath, 'minibrowser-wpe', 'lib'),
6064
];
6165
}
6266
return [];

0 commit comments

Comments
 (0)