Using GCC with new glibc and binutils to build software for system with older sysroot












1















I have a question since some months and I can't come to an answer with Google for a long time.



Background:
I am cross compiling software for arm based controllers which are running the linux distribution ptxdist. The complete linux image is built with a cross gcc (4.5.2) that was built against glibc-2.13 and binutils-2.21.
The c++ standard is quite old so I built a new toolchain which supports c++11 (gcc 4.8.5). It now is built against glibc-2.20 and binutils-2.24. I want to use that new compiler for my application software on the controller (not the complete image, just this one "main" binary) which is updated through a package management system.



The software seems to run. I just need to set LD_LIBRARY_PATH pointing to libstdc++.so.0.19 instead of libstdc++.so.14 for the binary. It does not accept the new libc, which is libc-2.20 instead of libc-2.13, though.



So binary uses libstdc++.so.0.19 and the rest of the system is unchanged.



Question:
Why is this working?
What risks could I expect running this software and should I anyway?
For example will the binary miss some functions of glibc-2.20 in future because it just gets glibc-2.13 on the target machine? Building gcc-4.8.5 against glibc-2.13 is not possible.



I have read so far that it depends on changes inside the ABI:
Impact on upgrade gcc or binutils



Here it is said that C Code is compatible if build by GCC4.1 to GCC 4.8.



Thank you!










share|improve this question























  • It will work until something requires a newer symbol than the ones provided by glibc-2.13.

    – Matthieu Brucher
    Nov 28 '18 at 11:34











  • I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

    – Andy
    Nov 28 '18 at 11:47











  • "It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

    – n.m.
    Nov 30 '18 at 6:18


















1















I have a question since some months and I can't come to an answer with Google for a long time.



Background:
I am cross compiling software for arm based controllers which are running the linux distribution ptxdist. The complete linux image is built with a cross gcc (4.5.2) that was built against glibc-2.13 and binutils-2.21.
The c++ standard is quite old so I built a new toolchain which supports c++11 (gcc 4.8.5). It now is built against glibc-2.20 and binutils-2.24. I want to use that new compiler for my application software on the controller (not the complete image, just this one "main" binary) which is updated through a package management system.



The software seems to run. I just need to set LD_LIBRARY_PATH pointing to libstdc++.so.0.19 instead of libstdc++.so.14 for the binary. It does not accept the new libc, which is libc-2.20 instead of libc-2.13, though.



So binary uses libstdc++.so.0.19 and the rest of the system is unchanged.



Question:
Why is this working?
What risks could I expect running this software and should I anyway?
For example will the binary miss some functions of glibc-2.20 in future because it just gets glibc-2.13 on the target machine? Building gcc-4.8.5 against glibc-2.13 is not possible.



I have read so far that it depends on changes inside the ABI:
Impact on upgrade gcc or binutils



Here it is said that C Code is compatible if build by GCC4.1 to GCC 4.8.



Thank you!










share|improve this question























  • It will work until something requires a newer symbol than the ones provided by glibc-2.13.

    – Matthieu Brucher
    Nov 28 '18 at 11:34











  • I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

    – Andy
    Nov 28 '18 at 11:47











  • "It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

    – n.m.
    Nov 30 '18 at 6:18
















1












1








1








I have a question since some months and I can't come to an answer with Google for a long time.



Background:
I am cross compiling software for arm based controllers which are running the linux distribution ptxdist. The complete linux image is built with a cross gcc (4.5.2) that was built against glibc-2.13 and binutils-2.21.
The c++ standard is quite old so I built a new toolchain which supports c++11 (gcc 4.8.5). It now is built against glibc-2.20 and binutils-2.24. I want to use that new compiler for my application software on the controller (not the complete image, just this one "main" binary) which is updated through a package management system.



The software seems to run. I just need to set LD_LIBRARY_PATH pointing to libstdc++.so.0.19 instead of libstdc++.so.14 for the binary. It does not accept the new libc, which is libc-2.20 instead of libc-2.13, though.



So binary uses libstdc++.so.0.19 and the rest of the system is unchanged.



Question:
Why is this working?
What risks could I expect running this software and should I anyway?
For example will the binary miss some functions of glibc-2.20 in future because it just gets glibc-2.13 on the target machine? Building gcc-4.8.5 against glibc-2.13 is not possible.



I have read so far that it depends on changes inside the ABI:
Impact on upgrade gcc or binutils



Here it is said that C Code is compatible if build by GCC4.1 to GCC 4.8.



Thank you!










share|improve this question














I have a question since some months and I can't come to an answer with Google for a long time.



Background:
I am cross compiling software for arm based controllers which are running the linux distribution ptxdist. The complete linux image is built with a cross gcc (4.5.2) that was built against glibc-2.13 and binutils-2.21.
The c++ standard is quite old so I built a new toolchain which supports c++11 (gcc 4.8.5). It now is built against glibc-2.20 and binutils-2.24. I want to use that new compiler for my application software on the controller (not the complete image, just this one "main" binary) which is updated through a package management system.



The software seems to run. I just need to set LD_LIBRARY_PATH pointing to libstdc++.so.0.19 instead of libstdc++.so.14 for the binary. It does not accept the new libc, which is libc-2.20 instead of libc-2.13, though.



So binary uses libstdc++.so.0.19 and the rest of the system is unchanged.



Question:
Why is this working?
What risks could I expect running this software and should I anyway?
For example will the binary miss some functions of glibc-2.20 in future because it just gets glibc-2.13 on the target machine? Building gcc-4.8.5 against glibc-2.13 is not possible.



I have read so far that it depends on changes inside the ABI:
Impact on upgrade gcc or binutils



Here it is said that C Code is compatible if build by GCC4.1 to GCC 4.8.



Thank you!







c++ gcc glibc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 28 '18 at 11:25









AndyAndy

61




61













  • It will work until something requires a newer symbol than the ones provided by glibc-2.13.

    – Matthieu Brucher
    Nov 28 '18 at 11:34











  • I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

    – Andy
    Nov 28 '18 at 11:47











  • "It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

    – n.m.
    Nov 30 '18 at 6:18





















  • It will work until something requires a newer symbol than the ones provided by glibc-2.13.

    – Matthieu Brucher
    Nov 28 '18 at 11:34











  • I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

    – Andy
    Nov 28 '18 at 11:47











  • "It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

    – n.m.
    Nov 30 '18 at 6:18



















It will work until something requires a newer symbol than the ones provided by glibc-2.13.

– Matthieu Brucher
Nov 28 '18 at 11:34





It will work until something requires a newer symbol than the ones provided by glibc-2.13.

– Matthieu Brucher
Nov 28 '18 at 11:34













I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

– Andy
Nov 28 '18 at 11:47





I tested some "newer" C++11 features as std::thread which could not be understood by the old compiler and that runs fine. I have no clue how to stress the binary with new symbols ...

– Andy
Nov 28 '18 at 11:47













"It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

– n.m.
Nov 30 '18 at 6:18







"It does not accept the new libc" how do you know that? Anyway it doesn't matter how your gcc was built. What matters is how you compile your binaries.

– n.m.
Nov 30 '18 at 6:18














1 Answer
1






active

oldest

votes


















0














glibc 2.14 introduced the memcpy@GLIBC_2.14 symbol, so pretty much all software compiled against glibc 2.20 will not work on glibc 2.13 because that symbol is missing there. Ideally, you would build your new GCC against glibc 2.13, not glibc 2.20. You claim that building GCC 4.8.5 against glibc 2.13 is not possible, but this is clearly not true in general.



Some newer C++ features will work with the old system libstdc++ because they depend exclusively on templates (from header files) and none of the new code in libstdc++.



You could also investigate how the hybrid linkage model works in Red Hat Developer Toolset. It links the newer parts of libstdc++ statically, while relying on the system libstdc++ for the common, older parts. This way, you get proper interoperability for things like exceptions and you do not have to install a newer libstdc++ on the target.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53518353%2fusing-gcc-with-new-glibc-and-binutils-to-build-software-for-system-with-older-sy%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    glibc 2.14 introduced the memcpy@GLIBC_2.14 symbol, so pretty much all software compiled against glibc 2.20 will not work on glibc 2.13 because that symbol is missing there. Ideally, you would build your new GCC against glibc 2.13, not glibc 2.20. You claim that building GCC 4.8.5 against glibc 2.13 is not possible, but this is clearly not true in general.



    Some newer C++ features will work with the old system libstdc++ because they depend exclusively on templates (from header files) and none of the new code in libstdc++.



    You could also investigate how the hybrid linkage model works in Red Hat Developer Toolset. It links the newer parts of libstdc++ statically, while relying on the system libstdc++ for the common, older parts. This way, you get proper interoperability for things like exceptions and you do not have to install a newer libstdc++ on the target.






    share|improve this answer




























      0














      glibc 2.14 introduced the memcpy@GLIBC_2.14 symbol, so pretty much all software compiled against glibc 2.20 will not work on glibc 2.13 because that symbol is missing there. Ideally, you would build your new GCC against glibc 2.13, not glibc 2.20. You claim that building GCC 4.8.5 against glibc 2.13 is not possible, but this is clearly not true in general.



      Some newer C++ features will work with the old system libstdc++ because they depend exclusively on templates (from header files) and none of the new code in libstdc++.



      You could also investigate how the hybrid linkage model works in Red Hat Developer Toolset. It links the newer parts of libstdc++ statically, while relying on the system libstdc++ for the common, older parts. This way, you get proper interoperability for things like exceptions and you do not have to install a newer libstdc++ on the target.






      share|improve this answer


























        0












        0








        0







        glibc 2.14 introduced the memcpy@GLIBC_2.14 symbol, so pretty much all software compiled against glibc 2.20 will not work on glibc 2.13 because that symbol is missing there. Ideally, you would build your new GCC against glibc 2.13, not glibc 2.20. You claim that building GCC 4.8.5 against glibc 2.13 is not possible, but this is clearly not true in general.



        Some newer C++ features will work with the old system libstdc++ because they depend exclusively on templates (from header files) and none of the new code in libstdc++.



        You could also investigate how the hybrid linkage model works in Red Hat Developer Toolset. It links the newer parts of libstdc++ statically, while relying on the system libstdc++ for the common, older parts. This way, you get proper interoperability for things like exceptions and you do not have to install a newer libstdc++ on the target.






        share|improve this answer













        glibc 2.14 introduced the memcpy@GLIBC_2.14 symbol, so pretty much all software compiled against glibc 2.20 will not work on glibc 2.13 because that symbol is missing there. Ideally, you would build your new GCC against glibc 2.13, not glibc 2.20. You claim that building GCC 4.8.5 against glibc 2.13 is not possible, but this is clearly not true in general.



        Some newer C++ features will work with the old system libstdc++ because they depend exclusively on templates (from header files) and none of the new code in libstdc++.



        You could also investigate how the hybrid linkage model works in Red Hat Developer Toolset. It links the newer parts of libstdc++ statically, while relying on the system libstdc++ for the common, older parts. This way, you get proper interoperability for things like exceptions and you do not have to install a newer libstdc++ on the target.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 30 '18 at 6:05









        Florian WeimerFlorian Weimer

        17.7k31148




        17.7k31148
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53518353%2fusing-gcc-with-new-glibc-and-binutils-to-build-software-for-system-with-older-sy%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks