-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed as not planned
Labels
arch-wasm32-bit and 64-bit WebAssembly32-bit and 64-bit WebAssemblyenhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.libcIssues related to libzigc and Zig's vendored libc code.Issues related to libzigc and Zig's vendored libc code.use caseDescribes a real use case that is difficult or impossible, but does not propose a solution.Describes a real use case that is difficult or impossible, but does not propose a solution.
Description
Zig Version
0.11.0-dev.4406+d370005d3
Steps to Reproduce and Observed Behavior
I tried to compile this simple C program with zig cc:
#include <stdlib.h>
int main(){
void *buf = malloc(1024);
}This is the output I get:
$ zig cc --target=wasm32-freestanding-musl -g main.c
main.c:3:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
^~~~~~~~~~
1 error generated.
Expected Behavior
This is a good question, I admit I didn't know what to expect and I was mostly experimenting.
My gut feeling is that some of the libc functions are impossible to provide in a wasm32-freestanding environment, because they need imports, e.g. for I/O.
But other functions such as malloc, free, strcpy, etc., they should probably work?
I have the impression that wasm32-freestanding-musl is a valid target for zig but not for zig cc?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arch-wasm32-bit and 64-bit WebAssembly32-bit and 64-bit WebAssemblyenhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.libcIssues related to libzigc and Zig's vendored libc code.Issues related to libzigc and Zig's vendored libc code.use caseDescribes a real use case that is difficult or impossible, but does not propose a solution.Describes a real use case that is difficult or impossible, but does not propose a solution.