开发者

cross compilation from Solaris sparc to Solaris x86

开发者 https://www.devze.com 2023-03-08 16:10 出处:网络
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开发者_JAVA百科 to compile. I

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开发者_JAVA百科 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,


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.


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++ 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:

bash-3.2$ file /usr/bin/CC
/usr/bin/CC:    ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, stripped

Please, refer to CC manual for details: Sun Studio 11 C++ Man Page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号