{"id":1544,"date":"2021-12-16T12:16:52","date_gmt":"2021-12-16T09:16:52","guid":{"rendered":"https:\/\/files2.tojikon.net\/files-cloud\/2021\/05\/18\/how-to-install-clang-on-ubuntu\/https:\/\/files2.tojikon.net\/files-cloud\/2021\/05\/18\/how-to-install-clang-on-ubuntu\/"},"modified":"2021-12-16T12:16:52","modified_gmt":"2021-12-16T09:16:52","slug":"how-to-install-clang-on-ubuntu","status":"publish","type":"post","link":"https:\/\/tojikon.net\/en\/1544-how-to-install-clang-on-ubuntu\/","title":{"rendered":"How to install Clang on Ubuntu"},"content":{"rendered":"<section id=\"related_posts\">\n<div class=\"block-head\">\n<h3>Related Articles<\/h3>\n<\/div>\n<\/section>\n<p>The Clang compiler is an alternative to GCC. It can be used to compile code into runnable binary programs. If you\u2019re a developer on Ubuntu, you\u2019ve likely dealt with a compiler like this before.<\/p>\n<p>While most Ubuntu developers stick with GCC, they also make it possible to get going with the Clang compiler. If you\u2019re looking to get Clang working on Ubuntu, this guide is for you! Follow along as we show you how to get Clang 9, Clang 11, and Clang 12 working on Ubuntu.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-402139 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu.png\" alt=\"install Clang on Ubuntu\" width=\"1200\" height=\"817\" srcset=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu.png 1200w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-5.png 300w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-8.png 1024w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-9.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\"\/><\/p>\n<h2>How to install Clang 9 on Ubuntu<\/h2>\n<p>If you need to get Clang 9 working on Ubuntu, you\u2019ll be happy to know that most Ubuntu releases, even Ubuntu 21.04, the latest release, have it in its software repository. To get going with Clang 9, start by opening up a terminal window.\u00a0<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-402138 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-3.png\" alt=\"\" width=\"1200\" height=\"931\" srcset=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-3.png 1200w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-10.png 300w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-11.png 1024w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-12.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\"\/><\/p>\n<p>To open up a terminal window on the Ubuntu desktop, press\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard. Once it is open, use the\u00a0<strong>apt install\u00a0<\/strong>command below to install the Clang 9 package. Be sure to use the \u2013install-suggests command-line switch, as it will tell Ubuntu to grab everything you need to use Clang 9.<\/p>\n<pre>\nsudo apt install clang-9 --install-suggests\n<\/pre>\n<p>Following entering this command in a terminal window, Ubuntu will prompt you to enter a password. Do so. When you do, it will collect all suggested packages for you to install on your PC.\u00a0<\/p>\n<p>After Ubuntu collects all the packages for you to install, you\u2019ll be prompted to press the\u00a0<strong>Y\u00a0<\/strong>key on the keyboard. Press the\u00a0<strong>Y\u00a0<\/strong>key on the keyboard to confirm that you wish to proceed with the installation.\u00a0<\/p>\n<p>Upon pressing\u00a0<strong>Y<\/strong>, Ubuntu will install Clang 9 on your system. When done, close the terminal window, or begin using Clang 9 in the command line.<\/p>\n<h2>How to install Clang 11 on Ubuntu\u00a0<\/h2>\n<p>For one reason, Ubuntu doesn\u2019t have Clang 10, but it does have Clang 11, which is better due to its being a newer release. If you need Clang 11 on your Ubuntu system, start by opening up a terminal window.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-402139 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu.png\" alt=\"\" width=\"1200\" height=\"817\" srcset=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu.png 1200w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-5.png 300w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-8.png 1024w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-9.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\"\/><\/p>\n<p>To open up a terminal window on the Ubuntu desktop, press\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>on the keyboard. Or, search for \u201cTerminal\u201d in the app menu. Once it is open, use the <strong>apt install<\/strong> command and the \u2013install-suggests command-line switch to get Clang 11 set up, along with Ubuntu suggested packages.<\/p>\n<pre>\nsudo apt install clang-11 --install-suggests\n<\/pre>\n<p>Upon entering the command above, Ubuntu will prompt you to enter a password to continue. Using the keyboard, type out your user account password. Then, press the\u00a0<strong>Enter\u00a0<\/strong>key on the keyboard to proceed.<\/p>\n<p>After proceeding, Ubuntu will collect all suggested packages and get them ready for installation. Following that, you\u2019ll be asked to press the\u00a0<strong>Y\u00a0<\/strong>button to continue. Using the\u00a0<strong>Y\u00a0<\/strong>key on the keyboard, confirm you wish to continue with the installation, and Ubuntu will install Clang 11.<\/p>\n<p>When the installation is complete, Clang 11 will be on your Ubuntu PC. From here, you can close the terminal or begin using Clang 11.<\/p>\n<h2>How to install Clang 12 on Ubuntu\u00a0<\/h2>\n<p>In addition to Clang 9 and Clang 11, Clang 12 is also available on Ubuntu for users to install if they need it. If you\u2019d like to install Clang 12 on your Ubuntu PC, start by opening up a terminal window. To open up a terminal window on Ubuntu, press\u00a0<strong>Ctrl + Alt + T\u00a0<\/strong>or\u00a0<strong>Ctrl + Shift + T\u00a0<\/strong>on the keyboard.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-402140 size-full\" src=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-4.png\" alt=\"\" width=\"1200\" height=\"674\" srcset=\"https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-4.png 1200w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-14.png 300w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-16.png 1024w, https:\/\/files2.tojikon.net\/files-cloud\/wp-content\/uploads\/2021\/12\/how-to-install-clang-on-ubuntu-18.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\"\/><\/p>\n<p>Once the terminal window is open and ready to use, enter the\u00a0<strong>apt install\u00a0<\/strong>command and install the \u201cclang-12\u201d package, along with the <strong>\u2013install-suggests<\/strong> command-line switch, which grabs all suggested packages.<\/p>\n<pre>\nsudo apt install clang-12 --install-suggests\n<\/pre>\n<p>After entering the command above to install Clang 12, Ubuntu will prompt you to enter a password. Passwords are required for\u00a0<strong>sudo\u00a0<\/strong>commands. Using the keyboard, enter your user account\u2019s password, and press the\u00a0<strong>Enter\u00a0<\/strong>key.<\/p>\n<p>When you enter your password in the command-line prompt and press the\u00a0<strong>Enter\u00a0<\/strong>key, Ubuntu will collect all packages that Clang 12 needs. From there, it\u2019ll ask you to press the <strong>Y\u00a0<\/strong>key. Do so.<\/p>\n<p>Ubuntu will begin to download and install all Clang 12 packages on your computer upon pressing the Y key. This will only take a couple of seconds. When the process is complete, close the terminal window, or keep it open and use Clang 12.<\/p>\n<h2>Other Clang packages<\/h2>\n<p>If you require other Clang packages on Ubuntu not covered in this post, do yourself a favor and check out Pkgs.org. It indexes many mainstream Linux package repositories, including Ubuntu\u2019s, and you can use it to search for any Clang package you need.<\/p>\n<p>In addition, be sure also to check out the official Ubuntu package search. It\u2019s a website dedicated to all Ubuntu packages across all distributions. You\u2019ll be able to use it to search for any Clang package you need!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related Articles The Clang compiler is an alternative to GCC. It can be used to compile code into runnable binary programs. If you\u2019re a developer on Ubuntu, you\u2019ve likely dealt with a compiler like this before. While most Ubuntu developers stick with GCC, they also make it possible to get going with the Clang compiler. &hellip;<\/p>\n","protected":false},"author":1,"featured_media":1545,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[33],"_links":{"self":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1544"}],"collection":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/comments?post=1544"}],"version-history":[{"count":0,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/posts\/1544\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media\/1545"}],"wp:attachment":[{"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/media?parent=1544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/categories?post=1544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tojikon.net\/en\/wp-json\/wp\/v2\/tags?post=1544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}