miekg / pkcs11

pkcs11 wrapper for Go
BSD 3-Clause "New" or "Revised" License
375 stars 133 forks source link

Static build binary contained the pkcs11 package dlopen #178

Open xuegege5290 opened 6 months ago

xuegege5290 commented 6 months ago

When I try to compile cri-o and podman as statically linked binaries, I get the following warnings. Is there a way to avoid using dlopen or disable it?


root@syx:~/go/cri-o# make BUILDTAGS="osusergo netgo exclude_graphdriver_devicemapper"
make -C pinns
make[1]: Entering directory '/root/go/cri-o/pinns'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/go/cri-o/pinns'
root@syx:~/go/cri-o# make clean
rm -f "/root/go/.gopathok"
rm -rf _output
rm -f docs/*.5 docs/*.8
rm -fr test/testdata/redis-image
find . -name \*~ -delete
find . -name \#\* -delete
rm -rf bin/
make -C pinns clean
make[1]: Entering directory '/root/go/cri-o/pinns'
rm -f src/sysctl.o src/pinns.o ../bin/pinns
make[1]: Leaving directory '/root/go/cri-o/pinns'
rm -f test/copyimg/copyimg
rm -f test/checkseccomp/checkseccomp
rm -f test/checkcriu/checkcriu
rm -rf /root/go/cri-o/build/bin
root@syx:~/go/cri-o# make BUILDTAGS="osusergo netgo exclude_graphdriver_devicemapper"
if [ ! -d "/root/go" ]; then mkdir -p /root/go; fi
touch "/root/go/.gopathok"
go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='2024-03-27T08:06:09Z'  -linkmode exte
rnal -extldflags -static' -tags "osusergo netgo exclude_graphdriver_devicemapper" -o bin/crio github.com/cri-o/cri-o/cmd/crio
# github.com/cri-o/cri-o/cmd/crio
/usr/bin/ld: /tmp/go-link-4099155275/000038.o: in function `New':
/_/github.com/miekg/pkcs11@v1.1.1/root/go/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='2024-03-27T08:06:17Z'  -linkmode exte
rnal -extldflags -static' -tags "osusergo netgo exclude_graphdriver_devicemapper" -o bin/crio-status github.com/cri-o/cri-o/cmd/crio-status
# github.com/cri-o/cri-o/cmd/crio-status
/usr/bin/ld: /tmp/go-link-158303994/000035.o: in function `New':
/_/github.com/miekg/pkcs11@v1.1.1/root/go/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
xuegege5290 commented 6 months ago

@miekg @mtharp

xuegege5290 commented 6 months ago

ound two related commits that introduce the use of dlopen: https://github.com/miekg/pkcs11/pull/102 https://github.com/miekg/pkcs11/pull/28