简体   繁体   English

使用SunStudio在Solaris上静态链接C库

[英]Static linking C library on Solaris using SunStudio

I know that in Solaris 10 Sun now Oracle don't provide static version of C library ie libC.a but I check that same thing is not possible using Sun Studio either, I was under impression that C library are provided by Compiler just like Visual Studio provides C runtime libraries. 我知道在Solaris 10 Sun中,Oracle现在不提供静态版本的C库,即libC.a,但是我检查是否也不能使用Sun Studio进行相同的操作,我印象是C像Visual Studio一样由Compiler提供Studio提供了C运行时库。

So is on Solaris C libray is provided by system only and there is no way to get static version of libC.a compatible on Solaris 10? 因此,在Solaris C上,libray仅由系统提供,并且无法获得与Solaris 10兼容的静态版本的libC.a吗? Thanks 谢谢

Not sure you can find one. 不确定您可以找到一个。 This is "by design" - while the stdlib API are stable, the internals change between releases of the OS, so they force everyone to link dynamically to avoid breakages. 这是“有意设计的”-尽管stdlib API稳定,但内部版本在OS版本之间会发生变化,因此它们迫使每个人都动态链接以避免损坏。

Using dynamic version in theory keeps your executables portable across different Solaris releases (but it is not guaranteed). 从理论上讲,使用动态版本可使您的可执行文件在不同的Solaris发行版之间可移植(但不能保证)。

If you really want to have a completely self-contained executable, you probably should use GCC with its own stdlib. 如果您真的想拥有一个完全独立的可执行文件,则可能应将GCC与它自己的stdlib一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM