Skip to content

Go link failure on Ubuntu 18.04 #94

@jeremywiebe

Description

@jeremywiebe

After updating to v0.26.1 of wasmtime-go, a project I work on started failing when running Go tests on Linux (Ubuntu 18.04).

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/root/go/pkg/mod/github.com/bytecodealliance/[email protected]/build/linux-x86_64/libwasmtime.a(rand-c9e73dea03c33dfe.rand.7g47d74v-cgu.8.rcgu.o): In function `_ZN3std4sync4once4Once9call_once28_$u7b$$u7b$closure$u7d$$u7d$17hd38fe0856a08c7c8E.llvm.16281869784479911949':
rand.7g47d74v-cgu.8:(.text._ZN3std4sync4once4Once9call_once28_$u7b$$u7b$closure$u7d$$u7d$17hd38fe0856a08c7c8E.llvm.16281869784479911949+0x1a): undefined reference to `pthread_atfork'
/root/go/pkg/mod/github.com/bytecodealliance/[email protected]/build/linux-x86_64/libwasmtime.a(rand-c9e73dea03c33dfe.rand.7g47d74v-cgu.8.rcgu.o): In function `_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h5210ace1770a56e9E.llvm.16281869784479911949':
rand.7g47d74v-cgu.8:(.text._ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h5210ace1770a56e9E.llvm.16281869784479911949+0x1a): undefined reference to `pthread_atfork'
collect2: error: ld returned 1 exit status

Based on some research (here, here, and here), it looks like it might be fixed simply by adding -pthread to the LDFLAGS line in ffi.go (that solves the issue for me, but I'm unsure if it's 100% correct).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions