Skip to content

Commit 085f3c3

Browse files
committed
fix(build-backend): resolve OpenMP library conflict on macOS
- Updated the run function to set the KMP_DUPLICATE_LIB_OK environment variable, addressing an issue with PyInstaller and OpenMP library initialization on macOS.
1 parent 33cef77 commit 085f3c3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

desktop/scripts/build-backend.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ const entryFile = path.join(backendDir, 'main.py');
4242
const isWin = process.platform === 'win32';
4343

4444
function run(cmd) {
45-
execSync(cmd, { stdio: 'inherit', cwd: projectRoot });
45+
execSync(cmd, {
46+
stdio: 'inherit',
47+
cwd: projectRoot,
48+
env: {
49+
...process.env,
50+
// 解决 macOS 上 PyInstaller 分析 torch 时 OpenMP 库冲突问题
51+
// OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized.
52+
KMP_DUPLICATE_LIB_OK: 'TRUE',
53+
},
54+
});
4655
}
4756

4857
function ensureDirs() {

0 commit comments

Comments
 (0)