无法使用clang交叉编译到SPARC [英] Unable to cross-compile to SPARC using clang

查看:381
本文介绍了无法使用clang交叉编译到SPARC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这里的情况:我需要能够从一个Linux机器(在Ubuntu上,为它的价值)编译二进制文件,它们能够从SPARC服务器运行。我想编译的程序很简单:

So here's the situation: I need to be able to compile binaries from a Linux machine (on Ubuntu, for what it's worth) which are able to run from a SPARC server. The program I'm trying to compile is very simple:

#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("Testing the SPARC program...");
    return EXIT_SUCCESS;
}



我尝试了很多不同的编译行来使它工作,但不幸的是,似乎没有工作。

I've tried a number of different compile lines to get it to work, but unfortunately nothing appears to be working.

我尝试了传统的:

 clang -target sparc blah.c -o blahsparc

但这不工作,一堆汇编失败:

But this doesn't work, with a bunch of assembler failures:

 /tmp/blah-519e77.s: Assembler messages:
 /tmp/blah-519e77.s:7: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:8: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:9: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:10: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:11: Error: no such instruction: 'save %sp,-240,%sp'
 /tmp/blah-519e77.s:12: Error: no such instruction: 'st %g0, [%fp+2043]'
 ...
 clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)

我也尝试过:

clang -cc1 -triple "sparc-unknown-Linux" blah.c -o blahsparc

所以不使用-cc1,我使用-Xclang:

which complains about the missing headers, so instead of using -cc1, I use -Xclang:

clang -Xclang -triple -Xclang "sparc-unknown-Linux" blah.c -o blahsparc

但是,这也由于错误:未知目标CPU -64。
我不知道在哪里继续这个。

however, this also fails due to "error: unknown target CPU 'x86-64'". I'm not sure where to proceed with this. I've tried using crosstool-ng as well with very little success.

推荐答案

截至3.4.2版本(2014年6月) ),llvm缺少必要的代码,以便能够为sparc目标生成目标文件。旧版本(1.x& 2.x)支持它,但是当时发布对象文件的llvm框架不太成熟。当当前框架推出时,它看起来像没有迁移所有平台。

As of the 3.4.2 release (June 2014), llvm is missing code necessary to be able to generate object files for sparc targets. Older releases (1.x & 2.x) had support for it, but llvm's framework for emitting object files was less mature back then. When the current framework was rolled out it looks like they didn't migrate all platforms.

文档似乎意味着llvm / gcc的组合已知可以工作,但我认为该表基于更早版本的llvm列表,当他们有不太成熟的框架用于发布目标文件。

The documentation seems to imply that a combination of llvm/gcc is known to work, but I think that table was tabulated based on a much earlier version of llvm when they had a less mature framework for emitting object files.

支持发射目标文件被添加到他们的SVN中继版本 r198533 这个线程讨论了提交),但是你可以在 3.4.2最终版本,在 r198533 中添加的更改不存在。

Support for emitting object files was added to their SVN trunk in revision r198533 (this thread discusses the commit), but as you can see in the 3.4.2 final release, files & changes added in r198533 aren't present.

另外,clang目前在sparc solaris中不起作用(一般不能确定sparc)。解析器似乎有麻烦解析模板;我得到coredumps&类似。我在一周左右遇到了线程之前讨论了sparc / solaris clang中的对齐问题,这可能是clang在此平台上尚不可用的原因之一。

As an aside, clang currently isn't functional in sparc solaris (not sure about sparc in general). The parser seems to have trouble parsing templates; I get coredumps & the like. I ran across a thread a week or so ago discussing alignment problems in sparc/solaris clang, and this may be one of the reasons clang isn't yet usable on this platform.

这篇关于无法使用clang交叉编译到SPARC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆