从 Solaris sparc 到 Solaris x86 的交叉编译
我是否可以知道是否可以从 Solaris sparc 服务器交叉编译 Solaris x86 库?
源代码主要是C++(一些C)。我需要使用Solaris C++编译器CC来编译。我知道 sparc 和 x86 之间的一些编译或链接标志是不同的。我已经进行了检查以确保我使用的标志是通用的。
是否可以简单地将sparc中编译的库复制到x86?或者我需要在编译和链接期间应用特定标志?
谢谢,
May I know if I can cross compile the Solaris x86 library from Solaris sparc server?
The source code is mainly in C++ (some C). I need to use the Solaris C++ compiler CC to compile. I understand that some compile or link flags are different between sparc and x86. I have done a check to make sure that the flags I used are common.
Is it possible to simply copy the library compiled in sparc to x86? Or I need to apply specific flag during compiling and linking?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Sun/Oracle Studio C++ 编译器不支持交叉编译。您需要使用另一个可以执行此操作的编译器,例如专门构建的 gcc。
简单地复制库是行不通的 - SPARC 和 x86 是非常不同的指令集,两者之间没有二进制兼容性。
The Sun/Oracle Studio C++ compilers do not support cross-compilation. You would need to use another compiler that does, like a specially built gcc.
Simply copying the library can't work - SPARC and x86 are very different instruction sets, with no binary compatibility between the two.
即使您可以在 SPARC for x86 上交叉编译 Solaris 库,仅安装 x86 编译器和库似乎要简单得多。这些库的相互依赖性可能非常复杂,以至于这样的项目可能无法工作。
是什么阻止您在 x86 Solaris 上下载并安装 Studio 软件?
Even if you could cross compile the Solaris libraries on SPARC for x86, it would seem a lot simpler to just install the x86 compilers and libraries. The interdependencies of these libraries is probably so complex that such a project would probably not work.
What's preventing you from just downloading and installing the Studio software on x86 Solaris?
Oracle Sun Studio C++ 编译器 (CC) 具有支持多种体系结构的 --xarch 选项。有:sparc、amd64、pentium_pro 和各种扩展/修改。如果您在单独的步骤中进行编译和链接,则应为编译器和链接器提供此标志。
您可以使用file命令验证目标架构;例如:
详细请参考CC手册:
Sun Studio 11 C++ 手册页
Oracle Sun Studio C++ compiler (CC) has --xarch option with big variety of architectures. There are: sparc, amd64, pentium_pro and various extensions/modifications. This flag should be provided for both compiler and linker if you compile and link in separate steps.
You can verify target architecture with file command; e.g:
Please, refer to CC manual for details:
Sun Studio 11 C++ Man Page