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

查看:286
本文介绍了使用铛无法交叉编译到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)

我已经试过这也:

I've tried this also:

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的x86-64的'。
我不知道在哪里与此进行。我使用的crosstool-ng了非常收效甚微,以及尝试。

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是缺少必要的code到能够生成目标文件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 此线程讨论了提交),但你可以在<一见href=\"http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_34/dot2-final/lib/Target/Sparc/MCTargetDesc/\"相对=nofollow> 3.4.2最终发行,文件和放大器;在 r198533 增加变化并不present。

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.

顺便说一句,目前铿锵不SPARC Solaris的功能(不知道一般的SPARC)。解析器似乎有麻烦解析模板;我得到核心转储和放大器;类似。我碰到一个线程左右以前在讨论SPARC / Solaris上铛对齐问题,这可能是原因铛尚不可用,在此平台上的。

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.

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

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