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

LIBRARY_PATH is not considered by the build system on Windows #20295

Open
Guigui220D opened this issue Jun 14, 2024 · 3 comments
Open

LIBRARY_PATH is not considered by the build system on Windows #20295

Guigui220D opened this issue Jun 14, 2024 · 3 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Guigui220D
Copy link

Zig Version

0.14.0-dev.27+0cef727e5

Steps to Reproduce and Observed Behavior

As far as I understand, the LIBRARY_PATH environment variable is what GCC uses and is supposed to work on Windows, but it doesn't. Apart from that there is really no standard environment variable for libraries for linkers, am I wrong?

My workaround was parsing the environment variable from my build.zig but absolute paths are discouraged.

Expected Behavior

The linker should use the absolute paths present in the LIBRARY_PATH environment variable.

@Guigui220D Guigui220D added the bug Observed behavior contradicts documented or intended behavior label Jun 14, 2024
@Guigui220D Guigui220D changed the title LIBRARY_PATH is not considered on Windows by the build system LIBRARY_PATH is not considered by the build system on Windows Jun 14, 2024
@rohlem
Copy link
Contributor

rohlem commented Jun 14, 2024

I don't know whether Zig plans to support automatically reading library search paths from a LIBRARY_PATH environment variable. I think this would make the build process more difficult to isolate and keep reproducible, because as it becomes easier for some unexpected interaction to happen.

Note that you can already specify library search paths using the -L/--library-directory CLI options (see zig <command> --help for whatever command you're using in your build process).
With this it should already be possible to manually specify the value of any environment variable to the CLI.

@Guigui220D
Copy link
Author

Some environment variables are already taken in account like C_INCLUDE_PATH, though

@Guigui220D
Copy link
Author

@rohlem also that is already the case on linux:

if (std.posix.getenv("LIBRARY_PATH")) |library_path| {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants