How to update GCC for L4T R21.5 safely

hello,I am a novice.
I want to update GCC because I have to use the C++14 standard in my project( the C++14 standard is not supported by GCC 4.8.4,only GCC 6.0 or newer can support).But I do not know how to deal with that,can I just uninstall it and install a new one? Will it influence my OS or programs or other tools(such as TensorRT、cuDNN、CUDA、OpenCV4Tegra and so on)?
Thank U for Helping.

These are just some random thoughts on the topic to perhaps get started on the topic…I’m not sure which version of Linaro first supported C++14, though it might have been as early as the 5.x series of tools.

Cross compile using Linaro tools for the 5.x series tool chain has no problem on the TK1. The 5.x series seems to be binary compatible and mostly drop-in compatible with libc. I believe the 6.x series will also work as expected, though I don’t know if there may be libc updates required for some of its features (likely no libc update required). Updating libc itself might be a bit of a disaster, but I do believe this is probably not required under 5.x or 6.x.

Linaro gcc 7.x tools started out with some slight bug in a few situations where objects are passed by value. This was discovered and a fix added, but the fix also broke compatibility with some parts of the existing libc. Default options were set such that there would be a warning if the issue is found, so it isn’t like it would be a hidden surprise…but you would definitely need an update to libc for the current Linaro 7.x tools to fully function correctly. I believe this would be difficult and extensive.

So far as a simple compiler update goes I’d consider just building a 6.x version (or finding a binary) for aarch64/arm64 and setting it to be in “/usr/local” as the “./configure --prefix=/usr/local” setup. Then you could leave existing tools in place and not bother with consequences of removing it. You’d simply use the full path to the new gcc, or else add the “/usr/local” version in your PATH variable prior to the “/usr” path (typically “/usr/local/bin” and “/usr/bin”).

Here is an example of prebuilt binaries (you’d want the arm-linux-gnueabihf):
[url]https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/[/url]

Note that if you cd far enough up the directory tree in that Linaro URL you will also find sources. You’d probably stick to building just the tool chain and not sysroot or runtime.