Comaptibility with older gcc

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Comaptibility with older gcc

Michele Portolan
I have a project that build correctly using gcc 4.9.3, generating a
dynamic library that I can later link to obtain my executables. So,
nothing special.

My problem is that on one of my target systems, I only have a gcc 4.1.2
and I am forced to use it for at least  linking the last executable. My
project uses extensively C++14,so I cannot build it with the older gcc.

Is there a way to have Cmake generate a library that is compatible with
gcc 4.1.2?

Regards,


Michele
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Konstantin Tokarev


27.01.2017, 20:04, "Michele Portolan" <[hidden email]>:

> I have a project that build correctly using gcc 4.9.3, generating a
> dynamic library that I can later link to obtain my executables. So,
> nothing special.
>
> My problem is that on one of my target systems, I only have a gcc 4.1.2
> and I am forced to use it for at least linking the last executable. My
> project uses extensively C++14,so I cannot build it with the older gcc.
>
> Is there a way to have Cmake generate a library that is compatible with
> gcc 4.1.2?

Your issue has nothing to do with cmake, but with used compilers / runtimes.

Your library will be possibly compatible with gcc 4.1 if it is not linked to libstdc++. To achieve this you have to elemeinate all std:: usages or only carefully chosen subset which does npot require linking. You also should not use any std:: types in public API of your library.

>
> Regards,
>
> Michele
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

--
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Elizabeth A. Fischer
In reply to this post by Michele Portolan

Get spack, then use it to build GCC 4.9.3  takes a couple hours of wall time, five minutes of your time.

Github.com/llnl/spack

On Jan 27, 2017 12:04 PM, "Michele Portolan" <[hidden email]> wrote:
I have a project that build correctly using gcc 4.9.3, generating a dynamic library that I can later link to obtain my executables. So, nothing special.

My problem is that on one of my target systems, I only have a gcc 4.1.2 and I am forced to use it for at least  linking the last executable. My project uses extensively C++14,so I cannot build it with the older gcc.

Is there a way to have Cmake generate a library that is compatible with gcc 4.1.2?

Regards,


Michele
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Hendrik Sattler
Your answer is totally unrelated to the question.

Am 27. Januar 2017 18:23:39 MEZ schrieb "Elizabeth A. Fischer" <[hidden email]>:

>Get spack, then use it to build GCC 4.9.3  takes a couple hours of wall
>time, five minutes of your time.
>
>Github.com/llnl/spack
>On Jan 27, 2017 12:04 PM, "Michele Portolan" <
>[hidden email]> wrote:
>
>> I have a project that build correctly using gcc 4.9.3, generating a
>> dynamic library that I can later link to obtain my executables. So,
>nothing
>> special.
>>
>> My problem is that on one of my target systems, I only have a gcc
>4.1.2
>> and I am forced to use it for at least  linking the last executable.
>My
>> project uses extensively C++14,so I cannot build it with the older
>gcc.
>>
>> Is there a way to have Cmake generate a library that is compatible
>with
>> gcc 4.1.2?
>>
>> Regards,
>>
>>
>> Michele
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For
>more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>http://www.kitware.com/opensou
>> rce/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Konstantin Tokarev
In reply to this post by Michele Portolan


27.01.2017, 20:04, "Michele Portolan" <[hidden email]>:
> I have a project that build correctly using gcc 4.9.3, generating a
> dynamic library that I can later link to obtain my executables. So,
> nothing special.
>
> My problem is that on one of my target systems, I only have a gcc 4.1.2
> and I am forced to use it for at least linking the last executable.

Do you have to use libstdc++ from gcc 4.1.2? If no, using gcc for linking does not differ much from using ld directly, and does not create any issues, provided that you compile your other code with gcc 4.9 and you don't link any other libraries depending on gcc 4.1 libraries

>My project uses extensively C++14,so I cannot build it with the older gcc.
>
> Is there a way to have Cmake generate a library that is compatible with
> gcc 4.1.2?

>
> Regards,
>
> Michele
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

--
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Elizabeth A. Fischer
In reply to this post by Hendrik Sattler
C++ code is not compatible between different compilers.  You cannot link C++ code built with GCC 4.9.3 with GCC 4.2.1.  Maybe if you hack around and find the GNU C++ libraries from your GCC 4.9.3 installation... just maybe, with enough hacking, it will work.  But in general, this is a rabbit hole that will offer you very little in the end.

The standard way to build on systems that don't have the compilers you need is... to get the compilers you need.  My point was that getting these compilers is actually not very hard.  In the end, that will almost certainly be the easiest solution to your problem.


On Fri, Jan 27, 2017 at 12:58 PM, Hendrik Sattler <[hidden email]> wrote:
Your answer is totally unrelated to the question.

Am 27. Januar 2017 18:23:39 MEZ schrieb "Elizabeth A. Fischer" <[hidden email]>:
>Get spack, then use it to build GCC 4.9.3  takes a couple hours of wall
>time, five minutes of your time.
>
>Github.com/llnl/spack
>On Jan 27, 2017 12:04 PM, "Michele Portolan" <
>[hidden email]> wrote:
>
>> I have a project that build correctly using gcc 4.9.3, generating a
>> dynamic library that I can later link to obtain my executables. So,
>nothing
>> special.
>>
>> My problem is that on one of my target systems, I only have a gcc
>4.1.2
>> and I am forced to use it for at least  linking the last executable.
>My
>> project uses extensively C++14,so I cannot build it with the older
>gcc.
>>
>> Is there a way to have Cmake generate a library that is compatible
>with
>> gcc 4.1.2?
>>
>> Regards,
>>
>>
>> Michele
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For
>more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>http://www.kitware.com/opensou
>> rce/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Hendrik Sattler
In reply to this post by Michele Portolan
It depends very much on your target system. The C++-ABI between 4.9 and 4.1 may be compatible but that is not guaranteed. C++14 is also a bit unspecific:   language features or library features? Does your library expose any C++11/14 features in its interface?

It may just not be possible after all...

Am 27. Januar 2017 18:04:17 MEZ schrieb Michele Portolan <[hidden email]>:

>I have a project that build correctly using gcc 4.9.3, generating a
>dynamic library that I can later link to obtain my executables. So,
>nothing special.
>
>My problem is that on one of my target systems, I only have a gcc 4.1.2
>
>and I am forced to use it for at least  linking the last executable. My
>
>project uses extensively C++14,so I cannot build it with the older gcc.
>
>Is there a way to have Cmake generate a library that is compatible with
>
>gcc 4.1.2?
>
>Regards,
>
>
>Michele

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Zan Lynx
In reply to this post by Michele Portolan
On 1/27/2017 10:04 AM, Michele Portolan wrote:

> I have a project that build correctly using gcc 4.9.3, generating a
> dynamic library that I can later link to obtain my executables. So,
> nothing special.
>
> My problem is that on one of my target systems, I only have a gcc 4.1.2
> and I am forced to use it for at least  linking the last executable. My
> project uses extensively C++14,so I cannot build it with the older gcc.
>
> Is there a way to have Cmake generate a library that is compatible with
> gcc 4.1.2?

I think your choices are to rewrite without C++14 or to include all of
the static C++ support libraries into your library.

You will need to make all your symbols hidden and then explicitly mark
what you want exported. You should be doing that anyway of course. And
when linking in the static libraries you will want to be sure that ld in
the link step is using -exclude-libs ALL option. Because if any C++14
symbols escape from your .so it will screw up the C++03 link.

Also, you won't be able to pass any complex objects or exceptions
between libraries because the internal implementation of std::list and
std::string has changed from 2003 to 2014.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Konstantin Tokarev
In reply to this post by Elizabeth A. Fischer


27.01.2017, 21:05, "Elizabeth A. Fischer" <[hidden email]>:
> C++ code is not compatible between different compilers. 

This is not true for compilers implementing Itanium C++ ABI, including GCC.

The only possible source of incompatibility comes from different standard library versions.

>You cannot link C++ code built with GCC 4.9.3 with GCC 4.2.1.  Maybe if you hack around and find the GNU C++ libraries from your GCC 4.9.3 installation... just maybe, with enough hacking, it will work.  But in general, this is a rabbit hole that will offer you very little in the end.
>
> The standard way to build on systems that don't have the compilers you need is... to get the compilers you need.  My point was that getting these compilers is actually not very hard.  In the end, that will almost certainly be the easiest solution to your problem.
>
> On Fri, Jan 27, 2017 at 12:58 PM, Hendrik Sattler <[hidden email]> wrote:
>> Your answer is totally unrelated to the question.
>>
>> Am 27. Januar 2017 18:23:39 MEZ schrieb "Elizabeth A. Fischer" <[hidden email]>:
>>>Get spack, then use it to build GCC 4.9.3  takes a couple hours of wall
>>>time, five minutes of your time.
>>>
>>>Github.com/llnl/spack
>>>On Jan 27, 2017 12:04 PM, "Michele Portolan" <
>>>[hidden email]> wrote:
>>>
>>>> I have a project that build correctly using gcc 4.9.3, generating a
>>>> dynamic library that I can later link to obtain my executables. So,
>>>nothing
>>>> special.
>>>>
>>>> My problem is that on one of my target systems, I only have a gcc
>>>4.1.2
>>>> and I am forced to use it for at least  linking the last executable.
>>>My
>>>> project uses extensively C++14,so I cannot build it with the older
>>>gcc.
>>>>
>>>> Is there a way to have Cmake generate a library that is compatible
>>>with
>>>> gcc 4.1.2?
>>>>
>>>> Regards,
>>>>
>>>>
>>>> Michele
>>>> --
>>>>
>>>> Powered by www.kitware.com
>>>>
>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>
>>>> Kitware offers various services to support the CMake community. For
>>>more
>>>> information on each offering, please visit:
>>>>
>>>> CMake Support: http://cmake.org/cmake/help/support.html
>>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>>
>>>> Visit other Kitware open-source projects at
>>>http://www.kitware.com/opensou
>>>> rce/opensource.html
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/cmake
>>>>
>>
>> --
>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
> ,--
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


-- 
Regards,
Konstantin
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Hendrik Sattler
In reply to this post by Elizabeth A. Fischer
If the target platform has an adapted gcc  that does not match upstream gcc, or may not be possible to just compile a newer version. Or it is a discontinued arch.


Am 27. Januar 2017 19:05:09 MEZ schrieb "Elizabeth A. Fischer" <[hidden email]>:

>C++ code is not compatible between different compilers.  You cannot
>link
>C++ code built with GCC 4.9.3 with GCC 4.2.1.  Maybe if you hack around
>and
>find the GNU C++ libraries from your GCC 4.9.3 installation... just
>maybe,
>with enough hacking, it will work.  But in general, this is a rabbit
>hole
>that will offer you very little in the end.
>
>The standard way to build on systems that don't have the compilers you
>need
>is... to get the compilers you need.  My point was that getting these
>compilers is actually not very hard.  In the end, that will almost
>certainly be the easiest solution to your problem.
>
>
>On Fri, Jan 27, 2017 at 12:58 PM, Hendrik Sattler
><[hidden email]>
>wrote:
>
>> Your answer is totally unrelated to the question.
>>
>> Am 27. Januar 2017 18:23:39 MEZ schrieb "Elizabeth A. Fischer" <
>> [hidden email]>:
>> >Get spack, then use it to build GCC 4.9.3  takes a couple hours of
>wall
>> >time, five minutes of your time.
>> >
>> >Github.com/llnl/spack
>> >On Jan 27, 2017 12:04 PM, "Michele Portolan" <
>> >[hidden email]> wrote:
>> >
>> >> I have a project that build correctly using gcc 4.9.3, generating
>a
>> >> dynamic library that I can later link to obtain my executables.
>So,
>> >nothing
>> >> special.
>> >>
>> >> My problem is that on one of my target systems, I only have a gcc
>> >4.1.2
>> >> and I am forced to use it for at least  linking the last
>executable.
>> >My
>> >> project uses extensively C++14,so I cannot build it with the older
>> >gcc.
>> >>
>> >> Is there a way to have Cmake generate a library that is compatible
>> >with
>> >> gcc 4.1.2?
>> >>
>> >> Regards,
>> >>
>> >>
>> >> Michele
>> >> --
>> >>
>> >> Powered by www.kitware.com
>> >>
>> >> Please keep messages on-topic and check the CMake FAQ at:
>> >> http://www.cmake.org/Wiki/CMake_FAQ
>> >>
>> >> Kitware offers various services to support the CMake community.
>For
>> >more
>> >> information on each offering, please visit:
>> >>
>> >> CMake Support: http://cmake.org/cmake/help/support.html
>> >> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> >> CMake Training Courses: http://cmake.org/cmake/help/training.html
>> >>
>> >> Visit other Kitware open-source projects at
>> >http://www.kitware.com/opensou
>> >> rce/opensource.html
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://public.kitware.com/mailman/listinfo/cmake
>> >>
>>
>> --
>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>> gesendet.
>>

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Robert J. Hansen
In reply to this post by Elizabeth A. Fischer
> C++ code is not compatible between different compilers.

This is only kinda-sorta true.  Clang and G++ interoperate quite nicely
on Linux, for instance, since they both implement the Itanium-style ABI.
 I believe Intel's C++ compiler on Windows implements the same ABI as
MSVC++.

There are no guarantees of compatibility between different compilers,
but it's a little much to say there is no compatibility.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Michele Portolan
In reply to this post by Hendrik Sattler
Thanks for all the feedback.

I cannot go into the details, but the deployment target is a production
machine for which I have no installation privileges, and where
"stability is king", so asking for updates is out of the question. I am
offered an Eclispe environment and have to work on it, hence my idea of
importing the cmake-built library (static or dynamic, whichever works
better) into the Eclipse projet and include it.

I was also doubting about libstdc++ versions, is there maybe a way of
asking Cmake to statistically include it in the built library?

Regards,


Michele


Le 27/01/2017 à 19:08, Hendrik Sattler a écrit :

> If the target platform has an adapted gcc  that does not match upstream gcc, or may not be possible to just compile a newer version. Or it is a discontinued arch.
>
>
> Am 27. Januar 2017 19:05:09 MEZ schrieb "Elizabeth A. Fischer" <[hidden email]>:
>> C++ code is not compatible between different compilers.  You cannot
>> link
>> C++ code built with GCC 4.9.3 with GCC 4.2.1.  Maybe if you hack around
>> and
>> find the GNU C++ libraries from your GCC 4.9.3 installation... just
>> maybe,
>> with enough hacking, it will work.  But in general, this is a rabbit
>> hole
>> that will offer you very little in the end.
>>
>> The standard way to build on systems that don't have the compilers you
>> need
>> is... to get the compilers you need.  My point was that getting these
>> compilers is actually not very hard.  In the end, that will almost
>> certainly be the easiest solution to your problem.
>>
>>
>> On Fri, Jan 27, 2017 at 12:58 PM, Hendrik Sattler
>> <[hidden email]>
>> wrote:
>>
>>> Your answer is totally unrelated to the question.
>>>
>>> Am 27. Januar 2017 18:23:39 MEZ schrieb "Elizabeth A. Fischer" <
>>> [hidden email]>:
>>>> Get spack, then use it to build GCC 4.9.3  takes a couple hours of
>> wall
>>>> time, five minutes of your time.
>>>>
>>>> Github.com/llnl/spack
>>>> On Jan 27, 2017 12:04 PM, "Michele Portolan" <
>>>> [hidden email]> wrote:
>>>>
>>>>> I have a project that build correctly using gcc 4.9.3, generating
>> a
>>>>> dynamic library that I can later link to obtain my executables.
>> So,
>>>> nothing
>>>>> special.
>>>>>
>>>>> My problem is that on one of my target systems, I only have a gcc
>>>> 4.1.2
>>>>> and I am forced to use it for at least  linking the last
>> executable.
>>>> My
>>>>> project uses extensively C++14,so I cannot build it with the older
>>>> gcc.
>>>>> Is there a way to have Cmake generate a library that is compatible
>>>> with
>>>>> gcc 4.1.2?
>>>>>
>>>>> Regards,
>>>>>
>>>>>
>>>>> Michele
>>>>> --
>>>>>
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>
>>>>> Kitware offers various services to support the CMake community.
>> For
>>>> more
>>>>> information on each offering, please visit:
>>>>>
>>>>> CMake Support: http://cmake.org/cmake/help/support.html
>>>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensou
>>>>> rce/opensource.html
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://public.kitware.com/mailman/listinfo/cmake
>>>>>
>>> --
>>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>>> gesendet.
>>>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Dan Liew
> I was also doubting about libstdc++ versions, is there maybe a way of asking
> Cmake to statistically include it in the built library?

I assume you mean statically. If so then you could try invoking cmake
like this on the command line.

```
mkdir new_build_dir
cd new_build_dir
CXXFLAGS="-static-libstdc++ " CFLAGS="-static-libstdc++" cmake
/path/to/source/tree
make -j$(nproc)
```

Note that `new_build_dir` must be empty every time you invoke the
`cmake` command
because it will only try to detect your compiler once. Subsequent
invocations of cmake
in an existing build directory does not change the compiler and
setting CXXFLAGS and
CFLAGS to different values has no effect.

However I don't think this is the best approach. I think you would be
much better of recreating
the production environment on your development machine. This makes it
much easier to reproduce
issues you may hit in production.

There are many ways about doing this but my suggestion would be to use
Docker or a virtual machine for that purpose.

You mention you want to use Eclipse so what you could do is develop
your application on your local machine (i.e. outside of Docker or the
virtual machine)
but have your source files mounted into your Docker container (these
are called volume mounts) or the virtual machine.

That way you can use Eclipse for your development locally but when you
want to, you can do a build inside the container/vm using the same
source files
to test the build still works and also produce binaries that will
"just work" on your production system.

HTH,
Dan.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comaptibility with older gcc

Craig Scott-3
It's probably outside of the set of possible solutions to your particular problem, but I'll mention this one in case it interests others following the topic. For potentially the broadest compatibility, one could consider using the LSB (Linux Standards Base) to build binaries that are guaranteed to run across a lot of different distributions and versions. Unfortunately, the LSB tends to trail quite a long way behind the latest capabilities and it seems to have lost momentum in recent years, but I've used it in the past to build one binary package which can then be deployed to many systems (this included a full GUI Qt application). If you want to use C++11 or later though, from what I understand I think you're out of luck (but do your own research, I could be wrong on that).

One place to start with the LSB is the LSB Navigator. It contains links to the official parts of the standard so you can get a formal reference to what it covers.


Something potentially more useful for your particular case is the application checker included in the LSB tools. It can analyse a whole package or just an application and provide a report listing any symbols that will be missing on a variety of different linux distributions.


I've found that app checker to be particularly useful in the past, but it has been some years since I've used it, so I can't comment on how good it is these days.

Don't worry so much about the certification aspects of the LSB, it's useful just to build/test portable applications and packages and you don't have to go the certification route just to use the LSB tools. Many linux distributions don't seek to certify themselves but offer pretty good compliance anyway (or at least they used to).




On Sat, Jan 28, 2017 at 8:45 PM, Dan Liew <[hidden email]> wrote:
> I was also doubting about libstdc++ versions, is there maybe a way of asking
> Cmake to statistically include it in the built library?

I assume you mean statically. If so then you could try invoking cmake
like this on the command line.

```
mkdir new_build_dir
cd new_build_dir
CXXFLAGS="-static-libstdc++ " CFLAGS="-static-libstdc++" cmake
/path/to/source/tree
make -j$(nproc)
```

Note that `new_build_dir` must be empty every time you invoke the
`cmake` command
because it will only try to detect your compiler once. Subsequent
invocations of cmake
in an existing build directory does not change the compiler and
setting CXXFLAGS and
CFLAGS to different values has no effect.

However I don't think this is the best approach. I think you would be
much better of recreating
the production environment on your development machine. This makes it
much easier to reproduce
issues you may hit in production.

There are many ways about doing this but my suggestion would be to use
Docker or a virtual machine for that purpose.

You mention you want to use Eclipse so what you could do is develop
your application on your local machine (i.e. outside of Docker or the
virtual machine)
but have your source files mounted into your Docker container (these
are called volume mounts) or the virtual machine.

That way you can use Eclipse for your development locally but when you
want to, you can do a build inside the container/vm using the same
source files
to test the build still works and also produce binaries that will
"just work" on your production system.

HTH,
Dan.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Craig Scott
Melbourne, Australia

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...