Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-34924

Cannot build pure static Go binaries when using no_openssl build tag [rhel-9.5]

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Blocker Blocker
    • rhel-9.5
    • CentOS Stream 9
    • golang
    • golang-1.22.3-1.el9
    • None
    • None
    • ZStream
    • 1
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 2
    • Dev ack
    • False
    • Yes
    • CentOS Stream
    • Sprint 4
    • Approved Blocker
    • Unspecified Release Note Type - Unknown
    • x86_64
    • None

      What were you trying to do that didn't work?

      I need to build a pure static  binary called `snapctl` which is a part of the `snapd` package available in EPEL. For this I need to disable the FIPS compliance support which loads openssl through dlopen at runtime. This isn't a problem, as snapctl only even communicates with snapd over a local UNIX socket, but it does however use HTTP to do so, which pulls in Go's net/http (and crypto/* as a dependency). The binary needs to be a pure static binary as it will be executed in a mount namspace of a snap, which may not carry compatible libraries (or any libraries at all for that matter too).

      Please provide the package NVR for which bug is seen:

      golang-1.22.2-1.el9.x86_64

      How reproducible:

      always

      Steps to reproduce

      1. use a minimal sample:
      2. `go build -ldflags=-extldflags=-static -tags no_openssl -v mini.go
      3.  

      the minimal sample:
      ```
      package main

      import "net/http"

      func main() {
      _, err := http.Get("http://google.com")
      if err != nil

      { panic(err) }

      }
      ```

      Expected results

      a pure static binary

      Actual results

      build error

      ```
      google:centos-9-64 .../mini/hello# go build -ldflags=-extldflags=-static -tags no_openssl -v mini.go
      crypto/internal/boring
      crypto/internal/backend
      crypto/rand
      crypto/aes
      crypto/ecdh
      crypto/sha512
      crypto/ecdsa
      crypto/ed25519
      crypto/hmac
      crypto/rsa
      crypto/sha1
      crypto/sha256
      crypto/x509
      vendor/golang.org/x/crypto/hkdf
      crypto/tls

      1. crypto/tls
        /usr/lib/golang/src/crypto/tls/handshake_client_tls13.go:44:20: undefined: supportsHKDF
        mime/multipart
        ```

              rh-ee-deparker Derek Parker
              maciek.borzecki@gmail.com Maciej Borzęcki (Inactive)
              David Benoit David Benoit
              Edjunior Machado Edjunior Machado
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

                Created:
                Updated:
                Resolved: