gozstd icon indicating copy to clipboard operation
gozstd copied to clipboard

gozstd fails during linking if the standard lib "plugin" module is imported

Open gordallott opened this issue 4 years ago • 2 comments

you can reproduce this simply by importing both gozstd and plugin at the same time, for example

package main

import (
    _ "github.com/valyala/gozstd"
    _ "plugin"
)

as an example I forked the gozstd repo to add a test to fail this, thus

go get github.com/gordallott/gozstd
go test -v github.com/gordallott/gozstd

should result in something like

# github.com/gordallott/gozstd.test
/home/mhr3/.axiom-dev/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /home/mhr3/.axiom-dev/gopath/src/github.com/gordallott/gozstd/libzstd_linux_amd64.a(zdict.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a PDE object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

tested on multiple machines with go version go version go1.15.2 linux/amd64

does not appear to be a CGO problem as using other CGO based modules work fine with the plugin module

gordallott avatar Jan 28 '21 14:01 gordallott

I have the same problem,and how to solve this problem please,thanks.

jamesqddd avatar May 11 '22 03:05 jamesqddd

maybe this pull request can help you, detail: https://github.com/pingcap/tiflow/pull/834

SimFG avatar Sep 21 '22 08:09 SimFG