Open SkywardSky opened 5 months ago
macOS:14.4 Linux的C/C++交叉编译工具:FiloSottile/musl-cross/musl-cross taos-client:TDengine-client-3.2.1.0-macOS-x64
编译指令:CGO_ENABLED=1 CC="x86_64-linux-musl-gcc" CGO_CFLAGS=-I/usr/local/include GOOS=linux GOARCH=amd64 go build
结果报错: /usr/local/go/pkg/tool/darwin_amd64/link: running x86_64-linux-musl-gcc failed: exit status 1 /usr/local/Cellar/musl-cross/0.9.9_2/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: cannot find -ltaos collect2: error: ld returned 1 exit status
/usr/local/go/pkg/tool/darwin_amd64/link: running x86_64-linux-musl-gcc failed: exit status 1 /usr/local/Cellar/musl-cross/0.9.9_2/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: cannot find -ltaos collect2: error: ld returned 1 exit status
请问应该怎么操作才可以在macOS上交叉编译出linux的可执行文件
涉及到了 C 库,不要在 Mac 上交叉编译。
macOS:14.4 Linux的C/C++交叉编译工具:FiloSottile/musl-cross/musl-cross taos-client:TDengine-client-3.2.1.0-macOS-x64
编译指令:CGO_ENABLED=1 CC="x86_64-linux-musl-gcc" CGO_CFLAGS=-I/usr/local/include GOOS=linux GOARCH=amd64 go build
结果报错:
/usr/local/go/pkg/tool/darwin_amd64/link: running x86_64-linux-musl-gcc failed: exit status 1 /usr/local/Cellar/musl-cross/0.9.9_2/libexec/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: cannot find -ltaos collect2: error: ld returned 1 exit status
请问应该怎么操作才可以在macOS上交叉编译出linux的可执行文件