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

Build zig language error #4682

Open
1637664504 opened this issue Feb 21, 2025 · 2 comments
Open

Build zig language error #4682

1637664504 opened this issue Feb 21, 2025 · 2 comments

Comments

@1637664504
Copy link

1637664504 commented Feb 21, 2025

issue

1.scons rule

SConstruct

# zig build command
zig_build='zig build-exe -O Debug --name $TARGET $SOURCES'
# zig_build='zig build-exe $SOURCES' --> also error
Command("1_hello.out",'1_hello.zig', zig_build)

try build zig
scons

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
zig build-exe -O Debug --name 1_hello.out 1_hello.zig
error: AppDataDirUnavailable
scons: *** [1_hello.out] Error 1
scons: building terminated because of errors.

2.manual run build command

zig build-exe -O Debug --name 1_hello.out 1_hello.zig

successful

@mwichmann
Copy link
Collaborator

mwichmann commented Feb 21, 2025

Invariably, "works from the shell, fails in SCons" means you're depending on something in PATH, or some environment variable. SCons by default ignores the PATH from the external environment, and environment variable settings.

@bdbaddog
Copy link
Contributor

This is a FAQ question even...
https://scons.org/faq.html#Why_doesn.27t_SCons_find_my_compiler.2BAC8-linker.2BAC8-etc..3F_I_can_execute_it_just_fine_from_the_command_line.

I don't know anything about zig, but based on error: AppDataDirUnavailable, I'd guess SCons is finding the zig binary, but some other shell environment variables the zig compiler needs aren't being set in SCons or propagated from your shell to SCons.

Likely you need something like

env['ENV']['SOME_ZIP_SHELL_VARIABLE'] = os.environ('SOME_ZIP_SHELL_VARIABLE')

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

3 participants