Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should crate set PATH=lib_dir on Windows? #354

Closed
reznikmm opened this issue Apr 26, 2020 · 5 comments
Closed

Should crate set PATH=lib_dir on Windows? #354

reznikmm opened this issue Apr 26, 2020 · 5 comments

Comments

@reznikmm
Copy link
Contributor

I've tried to use Matreshka library with alire on msys2 Windows shell. It seems it works fine, but compiled test executable is unable to file matreshka *.DLL's.

So, my question is: Should matreshka crate export PATH environment on windows or we could invent something in alire to deal with this common Windows specific problem?

@mosteo
Copy link
Member

mosteo commented Apr 26, 2020

Hi Maxim, thanks for the report. There's a proposal about setting env vars in #345. I guess that would do for this case?

@reznikmm
Copy link
Contributor Author

It seems #345 talks about environment during crate building, while here we need an environment to be used after the build (if this difference matters). May be to be emitted with alr setenv. Also I don't know how to calculate the value of the PATH, in my case it's <current_dir>/alire/build/alire/cache/dependencies/matreshka_league_18.1.0_4fab6c03/.libs/.

@mosteo
Copy link
Member

mosteo commented Apr 26, 2020

Yup, that should be emitted by alr setenv and also be used by alr build/alr run. The paths should be specified as relative to the crate somehow, so in your case you would use (for example) `"$crate_root/.libs".

At present we don't distinguish building and running contexts; neither testing/releasing. I guess that's something that may be necessary eventually.

@reznikmm
Copy link
Contributor Author

So, each crate, that provides DLL-s on Windows should export PATH environment variable to point place where DLL-s are located, right?

@mosteo
Copy link
Member

mosteo commented Mar 28, 2022

Yes. You can set paths relative to your crate directory by using ${CRATE_ROOT} in the manifest, see the entry on environment.

Furthermore, in the master branch you can use alr exec -- your_command to run any script or executable within the same environment printed by alr printenv.

I'm closing this one now as #452 implemented the required functionality for this to work.

@mosteo mosteo closed this as completed Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants