[cfe-users] Migrating to clang from GCC

Jean-Daniel Dupas mailing at xenonium.com
Fri Jul 24 03:12:54 PDT 2015


You would have the same problem than using both C++ libraries and compiling all modules with GCC.

As long as you don’t expose C++ API between your static libraries, you should be mostly fine, as libc++ uses namespace versioning and libc++ symbols should not conflict with libstdc++ symbols.

In the final linking step, you will have to link you executable on both GCC libstdc++ and libc++, which may be tricky depending your OS and how both libraries are compiled.

The only symbols that could conflict at link time are the C++ runtime symbols, so your 2 c++ libraries must be using the same C++ runtime library (libsupc++ or libc++abi).


> Le 24 juil. 2015 à 11:32, Ankit Garg <Ankit_Garg at mentor.com> a écrit :
> 
> Hi John,
>          So you mean to say even if GCC compiled libraries are not using C++11, but migrated components compiled with clang has C++11, when final executable is created linking all these libraries via clang (GCC compiled libraries + clang compiled code having C++11)  can lead to troubles ?
> 
> Regards
> Ankit
> 
> 
> On 07/24/2015 02:53 PM, Dallman, John wrote:
>> Well, if you do this, you should not use C++11, or the new run-time library, libc++.
>> 
>> I don't know if it will always work, because my GCC to Clang conversion process was done one shared library at a time, but if you use C++11 or libc++ before you have everything building with Clang, you're definitely making life harder for yourself.
>> 
>> --
>> John Dallman
>> 
>> 
>> -----Original Message-----
>> From: cfe-users-bounces at cs.uiuc.edu [mailto:cfe-users-bounces at cs.uiuc.edu] On Behalf Of Ankit Garg
>> Sent: Friday, July 24, 2015 8:37 AM
>> To: cfe-users at cs.uiuc.edu
>> Subject: [cfe-users] Migrating to clang from GCC
>> 
>> Hi All,
>>           I am not sure whether its the right forum to ask this question.  I am trying to move to clang compiler from GCC, but our software has tons of components independently developed provding different static archive libraries. All these libraries are finally linked into executable.  Now rather than compiling every component with clang from scratch, I was thinking to pick one component at time to compile with clang and use GCC compiled static archives for other components to link into executable using clang compiler.  Would this always work ?
>> 
>> So my question is whether GCC compiled object/archives involving C/C++ code would always be compatible with clang generated object files and can be mixed together during link step using clang compiler.  Would this always work if I can make sure that our libraries are not using any features of C++11 .
>> 
>> 
>> Regards
>> Ankit
>> 
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>> -----------------
>> Siemens Industry Software Limited is a limited company registered in England and Wales.
>> Registered number: 3476850.
>> Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.
> 
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users





More information about the cfe-users mailing list