Mac:was built for newer OSX version (10.15) than being linked (10.14)
作者:互联网
目录
问题
Golang链接过程中提示如下警告信息:
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000007.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000008.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000009.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000010.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000011.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000014.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000015.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000016.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000017.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000018.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000019.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000020.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000021.o) was built for newer OSX version (10.15) than being linked (10.14)
ld: warning: object file (/var/folders/r5/7b3lfd015v53ddp05qpjwcdh0000gn/T/go-link-507589565/000022.o) was built for newer OSX version (10.15) than being linked (10.14)
解决
首先,我们知道一个程序如果想要编译成可执行文件需要四个步骤:预处理、编译、汇编和链接。
一个编译器的工作流程一般会包括以下几个步骤,请看图:
接下来,我们开始分析上述问题的原因。根据系统提示的信息,我们知道中间文件 *.o 文件编译时是为 mac OS 10.15 系统编译的,但是链接的时候却是为 mac OS 10.14 系统链接的,前后存在不一致的情况,因此发出警告。 所以,这就给了我们解决该问题的思路。
思路一、指定或者降低编译器的版本,支持OSX 10.14;
思路二、指定或者提升链接器的版本,支持OSX 10.15。
注意:ld(windows上是ld.exe)是链接器,全称是链接编译器(Link eDitor)。
标签:OSX,ld,built,being,than,10.15,10.14 来源: https://blog.csdn.net/liuzehn/article/details/111216685