"expected pseudo-register; found R13" error

Viewed 3983

I just run a go project with goland and got error as blow:

# github.com/choleraehyq/pid
../../../.go/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s:28: expected pseudo-register; found R13
../../../.go/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s:29: expected pseudo-register; found R14
asm: assembly of ../../../.go/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s failed

I'm confused about this error and I don't know what todo. I can't do some debug work by this error message and didn't get any useful informations from google. github.com/choleraehyq/pid is referred by under framework.

I just want to know what happened and how to fix it. Please help me, thank you every much.

4 Answers

My go version is 1.17.6, also with this problem.

I solve the problem by updating the package version:

go get -u github.com/choleraehyq/pid
go get: upgraded github.com/choleraehyq/pid v0.0.10 => v0.0.13

It happened when I update go version from 1.13 -> 1.19 and I solve the problem by updating the package version:

go get -u github.com/choleraehyq/pid
go: downloading github.com/choleraehyq/pid v0.0.15
go: upgraded github.com/choleraehyq/pid v0.0.13 => v0.0.15

I just want to know what happened and how to fix it.


  1. Read the instructions.

Stack Overflow: Help: How to create a Minimal, Reproducible Example

  1. Follow the instructions.

For example,

package goid
github.com/choleraehyq/pid@v0.0.10
Programatically retrieve the current goroutine's ID.

.

$ cat pid.go
package main

import (
    "fmt"

    goid "github.com/choleraehyq/pid"
)

func main() {
    pid := goid.GetPid()
    fmt.Println(pid)
}
$

.

$ cat go.mod
module example/pid

go 1.17

require github.com/choleraehyq/pid v0.0.10
$ 

.

$ go version
go version go1.17.5 linux/amd64
$ 

.

$ go build pid.go && ./pid
# github.com/choleraehyq/pid
../../gopath/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s:28: expected pseudo-register; found R13
../../gopath/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s:29: expected pseudo-register; found R14
asm: assembly of ../../gopath/pkg/mod/github.com/choleraehyq/pid@v0.0.10/pid_go1.5_amd64.s failed
$ 

Upgrade to the latest version.

.

$ go get -u github.com/choleraehyq/pid
go: downloading github.com/choleraehyq/pid v0.0.13
go: upgraded github.com/choleraehyq/pid v0.0.10 => v0.0.13
$

.

$ cat go.mod
module example/pid

go 1.17

require github.com/choleraehyq/pid v0.0.13
$ 

.

$ go build pid.go && ./pid
1
$ 

Avoid using old, obsolete, and unsupported versions of software.



UPDATE:

Comment from OP:

Thanks. The original project is a big project and has deep dependencies. I find that I need to add github.com/choleraehyq/pid v0.0.13 // indirect to the project's go.mod. – sh1yu

It happened to me too. It maybe related to your golang's version;
I changed my golang's version from 1.17 to 1.14, which solved the problem.

Related