{"id":2426,"date":"2024-02-02T18:54:00","date_gmt":"2024-02-02T18:54:00","guid":{"rendered":"https:\/\/i.refvalue.org\/?p=2426"},"modified":"2025-12-01T09:30:54","modified_gmt":"2025-12-01T01:30:54","slug":"compiling-the-latest-gcc-on-linux","status":"publish","type":"post","link":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/","title":{"rendered":"Compiling the Latest GCC on Linux"},"content":{"rendered":"\n<p>If the installed host GCC by default on common Linux distributions has a version not fitting to your requirements, you can build from the source by yourself and make it coexist with the installed one.<\/p>\n\n\n\n<p>The list of released GNU source packages can be checked on the <a href=\"https:\/\/ftp.gnu.org\/gnu\/gcc\/\">GNU FTP Site<\/a>. You can see several directories named <code>gcc-x.x.x<\/code> refering to specific versions of GCC source packages.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&#91;DIR&#93;\tgcc-12.2.0\/\t2022-08-19 04:50\t-\t \n&#91;DIR&#93;\tgcc-12.3.0\/\t2023-05-08 08:51\t-\t \n&#91;DIR&#93;\tgcc-12.4.0\/\t2024-06-24 17:37\t-\t \n&#91;DIR&#93;\tgcc-13.1.0\/\t2023-04-26 04:01\t-\t \n&#91;DIR&#93;\tgcc-13.2.0\/\t2023-07-27 04:53\t-\t \n&#91;DIR&#93;\tgcc-13.3.0\/\t2024-05-21 04:54\t-\t \n&#91;DIR&#93;\tgcc-14.1.0\/\t2024-05-07 04:13\t-\t \n&#91;DIR&#93;\tgcc-14.2.0\/ 2024-08-01 05:00\t-\t <\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-12.2.0\/\t2022-08-19 04:50\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-12.3.0\/\t2023-05-08 08:51\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-12.4.0\/\t2024-06-24 17:37\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-13.1.0\/\t2023-04-26 04:01\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-13.2.0\/\t2023-07-27 04:53\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-13.3.0\/\t2024-05-21 04:54\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-14.1.0\/\t2024-05-07 04:13\t-\t <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">&#91;DIR&#93;\tgcc-14.2.0\/ 2024-08-01 05:00\t-\t <\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p><code>wget<\/code> or <code>curl<\/code> are recommended commands on Linux to download the package from the website. For example, you can type the following command to retrieve the GCC 14.2.0 package and decompress it to the current directory.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>export GUNC='gcc-14.2.0'\nwget https:\/\/ftp.gnu.org\/gnu\/gcc\/$GUNC\/$GUNC.tar.gz\ntar -zxf $GUNC.tar.gz<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">export<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">GUNC<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;gcc-14.2.0&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">wget<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">https:\/\/ftp.gnu.org\/gnu\/gcc\/<\/span><span style=\"color: #9CDCFE\">$GUNC<\/span><span style=\"color: #CE9178\">\/<\/span><span style=\"color: #9CDCFE\">$GUNC<\/span><span style=\"color: #CE9178\">.tar.gz<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">tar<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-zxf<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$GUNC<\/span><span style=\"color: #CE9178\">.tar.gz<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>The compilation of the newer version of GCC depends on the installed GCC on the host operating system, so it is necessary to ensure the whole build system has been equipped correctly. For instance, just use <code>apt<\/code> on Ubuntu to install the dependencies.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo apt install -y gcc g++ make build-essential flex bison bzip2<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">apt<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-y<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">gcc<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">g++<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">make<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">build-essential<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">flex<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">bison<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">bzip2<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>There are a few prerequisites e.g. <code>GMP<\/code>, <code>MPFR<\/code>, <code>MPC<\/code> and <code>ISL<\/code> needed to be installed    before compiling the GCC. Just <code>cd<\/code> into the source directory and run the script below to download and get them all geared up. The <code>http_proxy<\/code> and <code>https_proxy<\/code> environment variables are mandatory if the machine&#8217;s internet connection is restricted for some reason.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>export http_proxy='xxx'\nexport https_proxy='xxx'\ncd $GNUC &amp;&amp; .\/contrib\/download_prerequisites<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">export<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">http_proxy<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;xxx&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">export<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">https_proxy<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;xxx&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">cd<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$GNUC<\/span><span style=\"color: #D4D4D4\"> &amp;&amp; <\/span><span style=\"color: #DCDCAA\">.\/contrib\/download_prerequisites<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>The next step is to <code>configure<\/code> the project to generate <code>Makefile<\/code> and the build tree. Then run <code>make<\/code> in the build directory and finally <code>make install<\/code>. The target folder of the installation is able to be set by the <code>--prefix<\/code> option. The <code>-j$(nproc)<\/code> option of the <code>make<\/code> command means building the project with N threads in parallel where N equals the number of processor cores.  <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mkdir build &amp;&amp; cd build\n..\/configure -enable-checking=release -enable-languages=c,c++ -disable-multilib --prefix=\/opt\/$GNUC\nmake -j$(nproc)\nsudo make install<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">mkdir<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">build<\/span><span style=\"color: #D4D4D4\"> &amp;&amp; <\/span><span style=\"color: #DCDCAA\">cd<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">build<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">.<\/span><span style=\"color: #D4D4D4\">.\/configure <\/span><span style=\"color: #569CD6\">-enable-checking=release<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-enable-languages=c,c++<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-disable-multilib<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--prefix=\/opt\/<\/span><span style=\"color: #9CDCFE\">$GNUC<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">make<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-j<\/span><span style=\"color: #CE9178\">$(<\/span><span style=\"color: #DCDCAA\">nproc<\/span><span style=\"color: #CE9178\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">make<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">install<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>After a success installation, the GCC binaries may be located at <code>bin<\/code> that is relative to your designated directory by the <code>--prefix<\/code> option such as <code>\/opt\/$GUNC<\/code> above. A user may create a symbolic link to the GCC binaries in the <code>\/usr\/local\/bin<\/code> directory as follows:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo ln -sf \/usr\/local\/bin\/gcc-14 \/opt\/$GUNC\/bin\/gcc\nsudo ln -sf \/usr\/local\/bin\/g++-14 \/opt\/$GUNC\/bin\/g++\ng++-14 --version\n\nexport CC=gcc-14\nexport CXX=g++-14<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">ln<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-sf<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/usr\/local\/bin\/gcc-14<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/opt\/<\/span><span style=\"color: #9CDCFE\">$GUNC<\/span><span style=\"color: #CE9178\">\/bin\/gcc<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">ln<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">-sf<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/usr\/local\/bin\/g++-14<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">\/opt\/<\/span><span style=\"color: #9CDCFE\">$GUNC<\/span><span style=\"color: #CE9178\">\/bin\/g++<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">g++-14<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">--version<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">export<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">CC<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">gcc-14<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">export<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">CXX<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">g++-14<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If the installed host GCC by default on common Linux distributions has a version not fitting to your requirements, you can build from the source by yourself and make it coexist with the installed one. The list of released GNU source packages can be checked on the GNU FTP Site. You can see several directories [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2426","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods\" \/>\n<meta property=\"og:description\" content=\"If the installed host GCC by default on common Linux distributions has a version not fitting to your requirements, you can build from the source by yourself and make it coexist with the installed one. The list of released GNU source packages can be checked on the GNU FTP Site. You can see several directories [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"Refvalue&#039;s Whispering Woods\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-02T18:54:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-01T01:30:54+00:00\" \/>\n<meta name=\"author\" content=\"refvalue\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"refvalue\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/\"},\"author\":{\"name\":\"refvalue\",\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#\\\/schema\\\/person\\\/968c7dfefa7e2b45a131a884adbbf387\"},\"headline\":\"Compiling the Latest GCC on Linux\",\"datePublished\":\"2024-02-02T18:54:00+00:00\",\"dateModified\":\"2025-12-01T01:30:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/\"},\"wordCount\":293,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#\\\/schema\\\/person\\\/968c7dfefa7e2b45a131a884adbbf387\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/\",\"url\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/\",\"name\":\"Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#website\"},\"datePublished\":\"2024-02-02T18:54:00+00:00\",\"dateModified\":\"2025-12-01T01:30:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/2024\\\/02\\\/02\\\/compiling-the-latest-gcc-on-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/i.refvalue.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Compiling the Latest GCC on Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#website\",\"url\":\"https:\\\/\\\/i.refvalue.org\\\/\",\"name\":\"Refvalue's Whispering Woods\",\"description\":\"Email: cosmicbytecode@gmail.com\",\"publisher\":{\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#\\\/schema\\\/person\\\/968c7dfefa7e2b45a131a884adbbf387\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/i.refvalue.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/i.refvalue.org\\\/#\\\/schema\\\/person\\\/968c7dfefa7e2b45a131a884adbbf387\",\"name\":\"refvalue\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g\",\"caption\":\"refvalue\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/i.refvalue.org\"],\"url\":\"https:\\\/\\\/i.refvalue.org\\\/index.php\\\/author\\\/refvalue\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/","og_locale":"en_US","og_type":"article","og_title":"Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods","og_description":"If the installed host GCC by default on common Linux distributions has a version not fitting to your requirements, you can build from the source by yourself and make it coexist with the installed one. The list of released GNU source packages can be checked on the GNU FTP Site. You can see several directories [&hellip;]","og_url":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/","og_site_name":"Refvalue&#039;s Whispering Woods","article_published_time":"2024-02-02T18:54:00+00:00","article_modified_time":"2025-12-01T01:30:54+00:00","author":"refvalue","twitter_card":"summary_large_image","twitter_misc":{"Written by":"refvalue","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/#article","isPartOf":{"@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/"},"author":{"name":"refvalue","@id":"https:\/\/i.refvalue.org\/#\/schema\/person\/968c7dfefa7e2b45a131a884adbbf387"},"headline":"Compiling the Latest GCC on Linux","datePublished":"2024-02-02T18:54:00+00:00","dateModified":"2025-12-01T01:30:54+00:00","mainEntityOfPage":{"@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/"},"wordCount":293,"commentCount":2,"publisher":{"@id":"https:\/\/i.refvalue.org\/#\/schema\/person\/968c7dfefa7e2b45a131a884adbbf387"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/","url":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/","name":"Compiling the Latest GCC on Linux - Refvalue&#039;s Whispering Woods","isPartOf":{"@id":"https:\/\/i.refvalue.org\/#website"},"datePublished":"2024-02-02T18:54:00+00:00","dateModified":"2025-12-01T01:30:54+00:00","breadcrumb":{"@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/i.refvalue.org\/index.php\/2024\/02\/02\/compiling-the-latest-gcc-on-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/i.refvalue.org\/"},{"@type":"ListItem","position":2,"name":"Compiling the Latest GCC on Linux"}]},{"@type":"WebSite","@id":"https:\/\/i.refvalue.org\/#website","url":"https:\/\/i.refvalue.org\/","name":"Refvalue's Whispering Woods","description":"Email: cosmicbytecode@gmail.com","publisher":{"@id":"https:\/\/i.refvalue.org\/#\/schema\/person\/968c7dfefa7e2b45a131a884adbbf387"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/i.refvalue.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/i.refvalue.org\/#\/schema\/person\/968c7dfefa7e2b45a131a884adbbf387","name":"refvalue","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g","caption":"refvalue"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/b380a5ef2d3d8de84eae26847c2dcd82df59b6f96ccc5c521a74795525566720?s=96&d=mm&r=g"},"sameAs":["https:\/\/i.refvalue.org"],"url":"https:\/\/i.refvalue.org\/index.php\/author\/refvalue\/"}]}},"_links":{"self":[{"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/posts\/2426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/comments?post=2426"}],"version-history":[{"count":13,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/posts\/2426\/revisions"}],"predecessor-version":[{"id":2640,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/posts\/2426\/revisions\/2640"}],"wp:attachment":[{"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/media?parent=2426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/categories?post=2426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i.refvalue.org\/index.php\/wp-json\/wp\/v2\/tags?post=2426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}