小编Jos*_*hez的帖子

如何用cgo从linux/amd64交叉编译到darwin/arm64?

darwin/arm64我正在尝试在 上进行交叉编译linux/amd64,当我使用 构建代码时出现以下错误CGO_ENABLED=1,我理解该错误,但我不知道如何解决。

我的代码必须启用CGO_ENABLED功能才能编译。

错误信息:

GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CC=gcc go build -o dist/darwin-arm64 cmd/main.go
# runtime/cgo
gcc: error: arm64: No such file or directory
gcc: error: unrecognized command line option '-arch'
make: *** [makefile:6: darwin] Error 2
Run Code Online (Sandbox Code Playgroud)

主机系统:

Linux 83433d127edb 5.13.0-28-generic #31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

运行环境:

GO111MODULE=""                                                                                                                       
GOARCH="amd64"                                                                                                                       
GOBIN=""                                                                                                                             
GOCACHE="/root/.cache/go-build"                                                                                                      
GOENV="/root/.config/go/env"                                                                                                         
GOEXE=""                                                                                                                             
GOEXPERIMENT=""                                                                                                                      
GOFLAGS=""                                                                                                                           
GOHOSTARCH="amd64"                                                                                                                   
GOHOSTOS="linux"                                                                                                                     
GOINSECURE=""                                                                                                                        
GOMODCACHE="/root/go/pkg/mod"                                                                                                        
GONOPROXY=""                                                                                                                         
GONOSUMDB=""                                                                                                                         
GOOS="linux"                                                                                                                         
GOPATH="/root/go"                                                                                                                    
GOPRIVATE=""                                                                                                                         
GOPROXY="https://proxy.golang.org,direct"                                                                                            
GOROOT="/usr/lib/go-1.18" …
Run Code Online (Sandbox Code Playgroud)

linux macos cross-compiling go

13
推荐指数
1
解决办法
5554
查看次数

在 docker 内安装套接字 php 扩展时出错

里面的dockerfile:

docker-php-ext-install sockets

在 docker build 上给出这些错误(我使用相同的 dockerfile 好几天了,但今天出现了这个新错误):

/usr/src/php/ext/sockets/sendrecvmsg.c: In function 'init_ancillary_registry':
/usr/src/php/ext/sockets/sendrecvmsg.c:128:19: error: invalid application of 'sizeof' to incomplete type 'struct cmsgcred'
  128 |  PUT_ENTRY(sizeof(struct cmsgcred), 0, 0, from_zval_write_ucred,
      |                   ^~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:99:17: note: in definition of macro 'PUT_ENTRY'
   99 |  entry.size   = sizev; \
      |                 ^~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:129:36: error: 'SCM_CREDS' undeclared (first use in this function)
  129 |    to_zval_read_ucred, SOL_SOCKET, SCM_CREDS);
      |                                    ^~~~~~~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:105:19: note: in definition of macro 'PUT_ENTRY'
  105 |  key.cmsg_type  = type; \
      |                   ^~~~
/usr/src/php/ext/sockets/sendrecvmsg.c:129:36: …
Run Code Online (Sandbox Code Playgroud)

php sockets docker

11
推荐指数
2
解决办法
4150
查看次数

当我使用 EMACS 编辑文件时,出现一个奇怪的错误。我该如何解决?

这就是我正在做的:

  1. 创建文件或使用现有文件。
  2. Emacs 文件名.txt。
  3. 在文件中输入一些新文本。
  4. 保存存档。

步骤 2 后,emacs 编辑器窗口弹出后,我收到一条错误消息。

这是错误:

2022-01-19 22:11:53.935 Emacs-x86_64-10_14[33893:994906] 在已经布局的视图上调用 -layoutSubtreeIfNeeded 是不合法的。如果您正在实现视图的 -layout 方法,则可以调用 -[superlayout] 来代替。在 void _NSDetectedLayoutRecursion(void) 上中断进行调试。这只会被记录一次。这可能会在未来被打破。

我已经尝试过更新 emacs 但没有帮助,谷歌搜索也没有给我答案。目前,我有 GNU Emacs 27.1 版本。

我该如何修复这个错误?

emacs command-line command-line-interface

6
推荐指数
1
解决办法
779
查看次数

收到无效的 JSON 负载。“有效负载”处的未知名称“行”:无法在 google automl api 上找到字段

我正在尝试实现 google automl api: https: //cloud.google.com/automl-tables/docs/predict

api 文档说我需要以以下格式发布数据:

{
  "payload": {
    "row": {
     "values": [value1, value2,...]
         }
      }
}
Run Code Online (Sandbox Code Playgroud)

但是当我以相同格式发布数据时,出现以下错误:

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"row\" at 'payload': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "field": "payload",
        "description": "Invalid JSON payload received. Unknown name \"row\" at 'payload': Cannot find field."
      }
    ]
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的卷曲请求:

curl --location --request POST 'https://automl.googleapis.com/v1/projects/project-id/locations/us-central1/models/TBLID:predict' \
--header 'Content-Type: application/json; charset=utf-8;' …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-cloud-automl

5
推荐指数
1
解决办法
7055
查看次数