From 0c61e3bbd80bbde2e442d554c0a626a40ce3ef6c Mon Sep 17 00:00:00 2001 From: zecktos Date: Thu, 17 Nov 2022 19:44:09 +0100 Subject: [PATCH] fix for linux not finding miniQt adding miniQt to the LD_LIBRARY_PATH environment variable fixes the problem with linux not using miniQT when bundled with webpack like in the nodegui-starter template. this fixes https://github.com/nodegui/nodegui-starter/issues/229 fixes https://github.com/nodegui/nodegui/issues/972 --- scripts/qode.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/qode.js b/scripts/qode.js index 689190696..ea9ef9718 100755 --- a/scripts/qode.js +++ b/scripts/qode.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +var os = require('os'); var path = require('path'); var qodeConfig = require('@nodegui/qode'); var managePath = require('manage-path'); @@ -11,6 +12,12 @@ var proc = require('child_process'); var alterPath = managePath(process.env); alterPath.unshift(path.join(qtConfig.qtHome, 'bin')); +// Add Qt's lib to LD_LIBRARY_PATH so linux can find the libs when bundled with webpack +if(os.platform == 'linux') { + var oldLD_PATH = process.env.LD_LIBRARY_PATH ?? ""; + process.env.LD_LIBRARY_PATH = oldLD_PATH + ":" + path.join(qtConfig.qtHome, 'lib'); +} + var child = proc.spawn(qodeConfig.qodePath, process.argv.slice(2), { stdio: 'inherit', windowsHide: false,