在Solaris上,用gcc编译的库是否可用与用cc生成的库相同的方式? [英] On Solaris, are libraries compiled with gcc usable the same way as for libs generated with cc?

查看:136
本文介绍了在Solaris上,用gcc编译的库是否可用与用cc生成的库相同的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在尝试在Solaris上编译libxml2 .当我运行源提供的./configure脚本时,会自动使用gcc和g ++编译器.但是,我想使用cc和CC编译器.所以我跑了:

I am currently trying to compile libxml2 on Solaris. When I run the ./configure script provided with the sources, the gcc and g++ compilers are automatically used. However, I would like to use cc and CC compilers. So I run :

./configure CC=cc CXX=CC

它可以工作,但是随后,当我运行" make "时,出现一些错误,导致无法生成库.

It works but then, when I run "make", I get some errors which prevent the libraries to be generated.

使用gcc和g ++时,一切正常,没有错误,所以我想知道:我是否可以使用gcc/g ++生成的库,就像我先后使用它们生成库的方式一样? cc/CC?

When gcc and g++ are used, everything goes well with no errors, so I was wondering: can I use the librairies generated with gcc/g++ the same way I would have used them if I had successively generated them with cc/CC?

在cc上生成的cc和在Solaris上用gcc生成的同一个lib之间有什么区别?

What are the differences between a lib generated with cc and the same lib generated with gcc on Solaris?

推荐答案

您可以互换使用gcccc C编译器.

您可以按某些方式混合使用g++CC C ++编译器,但只能在x86 Solaris上,并且如果CC编译器足够新,可以使用-compat=g选项

You can mix the g++ and CC C++ compilers in certain ways, but only on x86 Solaris and if your CC compiler is new enough to have the -compat=g option available.

GNU g++和Solaris Studio CC C ++编译器默认使用完全不同的ABI和C ++运行时库.在x86 Solaris平台上,较新的版本(从版本12.开始,如果我没有记错的话)提供了-compat=g选项,以使用g ++ ABI和运行时库. Studio 12.4 CC编译器添加了-std=v选项选择不同版本的g ++或Sun C ++ ABI和运行时库:

The GNU g++ and the Solaris Studio CC C++ compilers default to completely different ABIs and C++ run-time libraries. On x86 Solaris platforms, newer versions (since version 12.?, if I remember correctly) provide a -compat=g option to use the g++ ABI and run-time libraries. The Studio 12.4 CC compiler adds a -std=v option to select different versions of the g++ or Sun C++ ABI and run-time libraries:

c ++ 03(零-3,不是oh-3)

等同于-compat=g选项.它选择C ++ 03方言和g ++ ABI;它与Solaris和Linux上的g ++二进制兼容. 将__SUNPRO_CC_COMPAT预处理程序宏设置为'G'.

Equivalent to the -compat=g option. It selects C++ 03 dialect and g++ ABI; it is binary compatible with g++ on Solaris and Linux It sets the __SUNPRO_CC_COMPAT preprocessor macro to 'G'.

c ++ 11

选择C ++ 11语言和g ++二进制兼容性.它将__SUNPRO_CC_COMPAT preprocessor宏设置为'G'.

Selects C++ 11 dialect and g++ binary compatibility. It sets the __SUNPRO_CC_COMPAT preprocessor macro to 'G'.

c ++ 0x(零-x,不是oh-x)

相当于c ++ 11.

Equivalent to c++11.

-std=c++03提供与gcc/g ++编译器的兼容性 所有Oracle Solaris和Linux平台.

The -std=c++03 provides compatibility with the gcc/g++ compiler on all Oracle Solaris and Linux platforms.

对于-std=c++03,二进制兼容性仅扩展到共享 (动态或.so)库,而不是单个.o文件或存档(.a) 库.使用的gcc标头和库 编译器,而不是系统上安装的gcc版本.

With -std=c++03, binary compatibility extends only to shared (dynamic or .so) libraries, not to individual .o files or archive (.a) libraries. The gcc headers and libraries used are those provided with the compiler, rather than the version of gcc installed on the system.

请注意,Studio 12.4 CC编译器使用g++头和库,这些头和库与CC编译器本身捆绑在一起. 12.3和更早版本使用g++标头和库,该标头和库安装在系统上的/usr/sfw下.

Note that the Studio 12.4 CC compiler uses the g++ headers and libraries supplied bundled with the CC compiler itself. 12.3 and earlier use the g++ headers and libraries installed on the system under /usr/sfw.

在SPARC Solaris上,整个应用程序必须使用g++CC.

On SPARC Solaris, you have to use either g++ or CC for the entire application.

这篇关于在Solaris上,用gcc编译的库是否可用与用cc生成的库相同的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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