Skip to content

Can not build with GOARCH=arm64 #26

Open
@Harikesh00

Description

@Harikesh00

We are building the go binary using MakeFile which runs the below command present in the .Dockerfile
I want to build on GOARCH=arm64

RUN GOARCH=arm64 GOOS=linux go build -mod vendor -tags "static netgo" -ldflags '-s -extldflags "-static"' -o bin/upgrade ./cmd/upgrade && \
        GOARCH=arm64 GOOS=linux go build -mod vendor -tags "static netgo" -ldflags '-s -extldflags "-static"' -o bin/onboard ./cmd/onboarding && \
        GOARCH=arm64 GOOS=linux go build -mod vendor -tags "static netgo" -ldflags '-s -extldflags "-static"' -o bin/restserver ./cmd/restserver/main.go && \
        GOARCH=arm64 GOOS=linux go build -mod vendor -tags "static netgo" -ldflags '-s -extldflags "-static"' -o bin/restlambda ./cmd/restlambda/main.go && \
  cd cmd/upgrade && rice append --exec ../../bin/upgrade

but I getting the error

pkg/saml/sign_static.go:31:23: undefined: xmlsec.Sign
pkg/saml/sign_static.go:31:112: undefined: xmlsec.SignatureOptions
pkg/saml/sign_static.go:32:19: undefined: xmlsec.XMLIDOption

sign_static.go file contains the below code

func sign(xml string, privateKeyPath string, id string) (string, error) {

	var (
		output, key []byte
		err         error
	)
	key, err = ioutil.ReadFile(privateKeyPath)
	if err != nil {
		return "", errors.New(err.Error())
	}
	output, err = xmlsec.Sign(key, []byte(fmt.Sprintf("<?xml version='1.0' encoding='UTF-8'?>\n%s", xml)), xmlsec.SignatureOptions{
		XMLID: []xmlsec.XMLIDOption{
			{
				ElementName:      "Response",
				ElementNamespace: "urn:oasis:names:tc:SAML:2.0:protocol",
				AttributeName:    "ID",
			},
		},
	})

	if err != nil {
		return "", errors.New(err.Error() + " : " + string(output))
	}

	return string(output), nil
}

It works with the GOARCH=amd64 but with GOARCH=arm64 it gave an error. I want help here, is this really an issue with the library or am I doing something wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Harikesh00

        Issue actions

          Can not build with GOARCH=arm64 · Issue #26 · crewjam/go-xmlsec