Sitelet https://web.archive.org/web/20240903232312/https://github.com/ziglang/zig/pull/10362
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

haiku add missing compilation include #10362

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

hoanga
Copy link

@hoanga hoanga commented Dec 19, 2021

Hello again,

The following patch adds an extra include directory when compiling on Haiku that is needed for Haiku to handle cImports. Without this extra include trying to compile a file that uses cImports such as the following:

const c = @cImport({
    @cDefine("_NO_CRT_STDIO_INLINE", "1");
    @cInclude("stdio.h");
    @cInclude("string.h");
});

const msg = "Hello, world!\n";

pub export fn main(argc: c_int, argv: **u8) c_int {
    _ = argv;
    _ = argc;
    if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;
    return 0;
}

will result in errors such as:

./src/main.zig:1:11: error: C import failed
const c = @cImport({
          ^
/boot/system/develop/headers/posix/sys/types.h:11:10: note: 'BeBuild.h' file not found
#include <BeBuild.h>
         ^
./src/main.zig:13:9: note: referenced here
    if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;

@Vexu Vexu merged commit 04f3d93 into ziglang:master Feb 14, 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

Successfully merging this pull request may close these issues.

None yet

2 participants