Go build linking error

When I try building, go exits with the error:

/usr/bin/ld: $WORK/b001/pkg2.a(_x004.o): undefined reference to symbol ‘pthread_key_delete@@GLIBC_2.2.5
/usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line

In vsCode, the line package main shows an identical error.

I haven’t had any of these issues in the past and there hasn’t been a recent software update.

edit: all of this only happens when working with openGL go-gl libraries, could this have to do with the openGL code being written in C

The problem occurs with either compiler backend

Solved it, for gccgo backend, use go build -gccgoflags “-L /lib64 -l pthread”, fo gc backend use go build -ldflags “-L /lib64 -l pthread”

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.