Merge branch 'fix-ld-library-path-duplicate' into 'main'

fix: LD_PRELOAD_LIBRARY env not being adjusted after profile duplication

See merge request gabmus/envision!32
This commit is contained in:
GabMus 2024-01-14 18:31:22 +00:00
commit a161f0a24b
8 changed files with 33 additions and 34 deletions

View file

@ -359,6 +359,12 @@ impl Profile {
dup.features.openhmd.branch = self.features.openhmd.branch.clone();
dup.features.mercury_enabled = self.features.mercury_enabled;
dup.environment = self.environment.clone();
if dup.environment.contains_key("LD_LIBRARY_PATH".into()) {
dup.environment.insert(
"LD_LIBRARY_PATH".into(),
prepare_ld_library_path(&dup.prefix),
);
}
dup.pull_on_build = self.pull_on_build;
dup.opencomposite_repo = self.opencomposite_repo.clone();
dup.opencomposite_branch = self.opencomposite_branch.clone();
@ -509,3 +515,7 @@ mod tests {
);
}
}
pub fn prepare_ld_library_path(prefix: &str) -> String {
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix)
}

View file

@ -1,7 +1,7 @@
use crate::{
constants::APP_NAME,
paths::{data_monado_path, data_opencomposite_path, get_data_dir},
profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType},
profile::{prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeatures, XRServiceType},
};
use std::collections::HashMap;
@ -15,10 +15,7 @@ pub fn lighthouse_profile() -> Profile {
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix));
Profile {
uuid: "lighthouse-default".into(),
name: format!("Lighthouse Driver - {name} Default", name = APP_NAME),

View file

@ -2,8 +2,8 @@ use crate::{
constants::APP_NAME,
paths::{data_monado_path, data_opencomposite_path, data_openhmd_path, get_data_dir},
profile::{
LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures,
XRServiceType,
prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType,
ProfileFeatures, XRServiceType,
},
};
use std::collections::HashMap;
@ -18,10 +18,7 @@ pub fn openhmd_profile() -> Profile {
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix));
Profile {
uuid: "openhmd-default".into(),
name: format!("OpenHMD - {name} Default", name = APP_NAME),

View file

@ -2,8 +2,8 @@ use crate::{
constants::APP_NAME,
paths::{data_libsurvive_path, data_monado_path, data_opencomposite_path, get_data_dir},
profile::{
LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures,
XRServiceType,
prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType,
ProfileFeatures, XRServiceType,
},
};
use std::collections::HashMap;
@ -20,10 +20,7 @@ pub fn survive_profile() -> Profile {
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix));
Profile {
uuid: "survive-default".into(),
name: format!("Survive - {name} Default", name = APP_NAME),

View file

@ -1,7 +1,7 @@
use crate::{
constants::APP_NAME,
paths::{data_opencomposite_path, data_wivrn_path, get_data_dir},
profile::{Profile, ProfileFeatures, XRServiceType},
profile::{prepare_ld_library_path, Profile, ProfileFeatures, XRServiceType},
};
use std::collections::HashMap;
@ -9,10 +9,7 @@ pub fn wivrn_profile() -> Profile {
let data_dir = get_data_dir();
let prefix = format!("{data}/prefixes/wivrn_default", data = data_dir);
let mut environment: HashMap<String, String> = HashMap::new();
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix));
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());

View file

@ -2,8 +2,8 @@ use crate::{
constants::APP_NAME,
paths::{data_basalt_path, data_monado_path, data_opencomposite_path, get_data_dir},
profile::{
LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures,
XRServiceType,
prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType,
ProfileFeatures, XRServiceType,
},
};
use std::collections::HashMap;
@ -18,10 +18,7 @@ pub fn wmr_profile() -> Profile {
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
environment.insert(
"LD_LIBRARY_PATH".into(),
format!("{pfx}/lib:{pfx}/lib64", pfx = prefix),
);
environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix));
Profile {
uuid: "wmr-default".into(),
name: format!("WMR - {name} Default", name = APP_NAME),

View file

@ -1,11 +1,14 @@
use crate::{cmd_runner::CmdRunner, profile::Profile, runner::Runner};
use super::alert::alert;
use crate::{
cmd_runner::CmdRunner,
profile::{prepare_ld_library_path, Profile},
runner::Runner,
};
use adw::prelude::*;
use gtk::glib;
use relm4::prelude::*;
use std::{cell::Cell, collections::HashMap, path::Path, rc::Rc, time::Duration};
use super::alert::alert;
const NO_FILE_MSG: &str = "(No file selected)";
const CALIBRATION_RUN_TIME_SECONDS: f64 = 30.0;
@ -57,9 +60,10 @@ impl LibsurviveSetupWindow {
fn create_calibration_runner(&mut self, survive_cli_path: String) -> CmdRunner {
let lh_path = self.steam_lighthouse_path.clone();
let mut env = HashMap::new();
let profile_prefix = &self.profile.as_ref().unwrap().prefix;
env.insert(
"LD_LIBRARY_PATH".to_string(),
format!("{pfx}/lib", pfx = self.profile.as_ref().unwrap().prefix),
"LD_LIBRARY_PATH".into(),
prepare_ld_library_path(&profile_prefix),
);
CmdRunner::new(
Some(env),

View file

@ -180,7 +180,7 @@ impl SimpleComponent for MainView {
},
},
gtk::Button {
set_label: "Start with GDB",
set_label: "Start with gdbserver",
#[track = "model.changed(Self::xrservice_active()) || model.changed(Self::enable_debug_view())"]
set_visible: model.enable_debug_view && !model.xrservice_active,
connect_clicked[sender] => move |_| {