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

Self hosted libc hello world #1266

Merged
merged 17 commits into from Jul 24, 2018
Merged

Self hosted libc hello world #1266

merged 17 commits into from Jul 24, 2018

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Jul 20, 2018

What's left before merging to master:

  • add test case for this to the test suite
  • add the windows support for finding libc
  • add the windows linking code
  • make sure finding libc works on macos
  • add the macos linking code

screenshot_2018-07-22_23-27-29

@andrewrk andrewrk merged commit 10bdf73 into master Jul 24, 2018
@andrewrk andrewrk deleted the self-hosted-libc-hello-world branch July 24, 2018 04:31
@ghost
Copy link

ghost commented Jul 24, 2018

Just read your tweet about copying Windows files into those libc paths.

I think an official zig docker image should be supplied for such cases, makes it so much easier.

At least until zig ships with those libraries included or something that solves this ... which I guess is planned? At least e.g. in golang we do not have to copy libraries ourself.

@andrewrk
Copy link
Member Author

golang creates static binaries that have no dependency on libc, which is why you don't need those libraries. This is true in Zig as well - if you grab the stage1 compiler and do zig build-exe example/hello_world.zig --target-os windows --target-arch x86_64 you end up with a static hello_world.exe for windows.

The difference is that golang doesn't support linking against libc when cross compiling for windows (as far as I'm aware) whereas zig does.

Once stage2 supports all the language features used by std/special/bootstrap.zig, then it can create binaries that don't depend on libc.

@ghost
Copy link

ghost commented Jul 25, 2018

okay

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

Successfully merging this pull request may close these issues.

None yet

3 participants