Skip to content

error: unable to create compilation: LibCRuntimeNotFound when cross-compiling #19790

@leleliu008

Description

@leleliu008

Zig Version

0.13.0-dev.46+3648d7df1

Steps to Reproduce and Observed Behavior

step1. export CC environment variable to cross compile

export CC="$HOME/android-ndk-r26d/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"

step2. create a simple C source file test.c

#include <stdio.h>

int main() {
    puts("Hello zig!");
    return 0;
}

step3. build test.c for build machine

./zig cc test.c

my build machine target triple is x86_64-unknown-linux-gnu

this will report error: unable to create compilation: LibCRuntimeNotFound

Note: this is a common case that we need two compilers, one for native build, another one for target build, to distinguish
these two, we usually use BUILD_CC or CC_FOR_BUILD to point to compiler for native build, use CC for target build, but zig doesn't distinguish these two.

Expected Behavior

zig could find it's own C runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionNo questions on the issue tracker, please.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions