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

LLVM error: "Global is external, but doesn't have external or weak linkage" #1277

hryx opened this Issue Jul 22, 2018 · 0 comments


None yet
2 participants

hryx commented Jul 22, 2018

I ran into an LLVM error which kills the compiler. Here's the smallest example I could make which reproduces it. The error only happens when f is an optional function; when there's no ?, it builds.

const S = struct {
    f: ?fn () void,

const s = S {
    .f = f,

fn f() void {}

test "struct containing optional fn" {
    _ = s;

Output of zig test example.zig:

Global is external, but doesn't have external or weak linkage!
void ()** @37
LLVM ERROR: Broken module found, compilation aborted!

Zig version: 0.2.0+fd3a41d
Platform: Linux 4.13.0 64-bit, Ubuntu 16.04.1, Intel i7-8550U

@andrewrk andrewrk added this to the 0.3.0 milestone Jul 22, 2018

@andrewrk andrewrk added the bug label Jul 22, 2018

@andrewrk andrewrk closed this in 4b68ef4 Aug 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment