#error: Global is external, but doesn't have external or weak linkage!

1 messages · Page 1 of 1 (latest)

balmy dragon
#

this is useless without nowing the code, both source, the translation from cimport and build.zig

next sinew
#

very likely due to using incremental + llvm backend

graceful bluff
#

@balmy dragon how do I get the translation from cImport? if you can share with me what is the minimal code I should share so it is useful

balmy dragon
#

if your editor supports got definition and you have zls, you can just do that on the offending symbol and send that.
to get the whole thing you can just zig translate-c, you'd have to replicate what you do with cimport, alternatively you can use build system api if its more complicated. the result should be deterministic.

as @next sinew said, it could be caused by incremental if youre using that. Also could be the new aro backend for translate-c but thats only on master atm.

graceful bluff
#

@next sinew Thank you - I tried disabling incremental ( -fno-incremental) same stage2 error
@balmy dragon I am on master... zig-aarch64-macos-0.16.0-dev.1366+4ea472808, when I do translate-c:
zig translate-c /tmp/a.c --verbose-cc, The generated Zig file begins with:

  pub const __VERSION__ = "Aro aro-zig";
  pub const __ARO_EMULATE__ = __ARO_EMULATE_CLANG__;
  pub const __ARO_EMULATE_CLANG__ = @as(c_int, 1);
graceful bluff
#

Here's the IR of that part:

    %builtin.TestFn {
        { ptr, i64 } { ptr getelementptr inbounds (i8, ptr @__anon_35147, i64 0), i64 53 },
        ptr getelementptr inbounds (i8, ptr @"stage2_collect_min.test.stage2 collectDatagrams repro", i64 0)
    }
], align 8
@__anon_35147 = internal unnamed_addr constant [53 x i8]
    c"stage2_collect_min.test.stage2 collectDatagrams repro", align 1

I can also attach the translate-c if it's helpful