-
Notifications
You must be signed in to change notification settings - Fork 2k
Not loading environment variables when building via launch.json #17331
Copy link
Copy link
Closed
Labels
Description
If I build my project from scratch by starting a debug session (using the default autogenerated launch.json), DYLD_FALLBACK_LIBRARY_PATH is not defined so the build fails (opencv requires that it is set in order to find libclang.dylib on macOS).
I have defined DYLD_FALLBACK_LIBRARY_PATH in my VSCode settings.json like this:
{
"rust-analyzer.cargo.extraEnv": {
"DYLD_FALLBACK_LIBRARY_PATH": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
"PKG_CONFIG_PATH": "/opt/homebrew/opt/opencv/lib/pkgconfig"
},
"rust-analyzer.server.extraEnv": {
"DYLD_FALLBACK_LIBRARY_PATH": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib",
"PKG_CONFIG_PATH": "/opt/homebrew/opt/opencv/lib/pkgconfig"
}
}
And I have also defined it in my ~/.zshenv file, to allow the project to build outside of VSCode. Neither of these approaches fix the issue.
Note that I can run cargo build in the VSCode terminal just fine. The issue is I can't build from scratch via the launch.json.
Thank you for your time.
rust-analyzer version: 0.3.1975-standalone (5bf2f85 2024-05-09)
rustc 1.78.0 (9b00956e5 2024-04-29)
editor: VSCode 1.89.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.