{"id":169,"date":"2013-11-11T05:29:15","date_gmt":"2013-11-11T05:29:15","guid":{"rendered":"http:\/\/finaldie.com\/blog\/?p=169"},"modified":"2013-11-11T10:56:12","modified_gmt":"2013-11-11T10:56:12","slug":"compile-clang3-4","status":"publish","type":"post","link":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/","title":{"rendered":"Compile Clang3.4"},"content":{"rendered":"<p>As we know, llvm is a great project, and it also include the clang compiler. And for Clang 3.4, it support dumping the format configuration file, so that people can generate the self-style format for their own project. Detail: <a href=\"http:\/\/clang.llvm.org\/docs\/ClangFormat.html\" target=\"_blank\">ClangFormat<\/a> \u00a0and <a href=\"http:\/\/clang.llvm.org\/docs\/ClangFormatStyleOptions.html\" target=\"_blank\">ClangFormatStyleOptions<\/a><\/p>\n<p>And for now, Clang 3.4 has not been released, but we can pull its latest code and compile it.<br \/>\nFor RHEL6.x, I remind to compile it, and for ubuntu\/debian, there are already have the nightly building package(<a href=\"http:\/\/llvm\/apt\" target=\"_blank\">llvm apt source<\/a>) , people can install it directly.<\/p>\n<p>1. Ok, the compiling instructions as following, I tested it on a rhel6.x, it worked.<\/p>\n<pre>git clone http:\/\/llvm.org\/git\/llvm.git\r\ncd llvm\/tools\r\ngit clone http:\/\/llvm.org\/git\/clang.git\r\ncd ..\/projects\r\ngit clone http:\/\/llvm.org\/git\/compiler-rt.git\r\ncd ..\/..\/\r\nmkdir build\r\ncd build\r\n..\/llvm\/configure --prefix=~\/bin\/clang34 --enable-optimized --enable-targets=x86_64\r\nmake -j4\r\nmake install<\/pre>\n<p>2. now, add the clang3.4&#8217;s binaries into your PATH.<\/p>\n<pre>vim ~\/.bash_profile\r\nPATH=$HOME\/bin\/clang34\/bin:$PATH\r\nexport $PATH<\/pre>\n<p>3. If you are using vim, add the following line into your .vimrc (replace the <strong>$path-to-this-file<\/strong> with your real path)<\/p>\n<pre>map &lt;C-K&gt; :pyf $path-to-this-file\/clang-format.py&lt;CR&gt;\r\nimap &lt;C-K&gt; &lt;ESC&gt;:pyf $path-to-this-file\/clang-format.py&lt;CR&gt;i<\/pre>\n<p>4. Ok, finally, you can try it with clang-format or open a file with vim and using the <strong>Control+K<\/strong> to format your code.<\/p>\n<p>[Other References]:<br \/>\nhttp:\/\/llvm.org\/docs\/GettingStarted.html#compiling-the-llvm-suite-source-code<br \/>\nhttp:\/\/clang.llvm.org\/get_started.html<br \/>\nhttp:\/\/verboselogging.com\/2009\/06\/24\/compile-llvm-on-ubuntu<br \/>\nhttp:\/\/llvm.org\/apt\/<\/p>\n<p>&#8212;&#8212;&#8211;<br \/>\nFinal :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we know, llvm is a great project, and it also include the clang compiler. And for Clang 3.4, it support dumping the format configuration file, so that people can generate the self-style format for their own project. Detail: ClangFormat \u00a0and ClangFormatStyleOptions And for now, Clang 3.4 has not been released, but we can pull &#8230; <a title=\"Compile Clang3.4\" class=\"read-more\" href=\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/\" aria-label=\"More on Compile Clang3.4\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Compile Clang3.4 - Final Blog<\/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:\/\/finaldie.com\/blog\/compile-clang3-4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Compile Clang3.4 - Final Blog\" \/>\n<meta property=\"og:description\" content=\"As we know, llvm is a great project, and it also include the clang compiler. And for Clang 3.4, it support dumping the format configuration file, so that people can generate the self-style format for their own project. Detail: ClangFormat \u00a0and ClangFormatStyleOptions And for now, Clang 3.4 has not been released, but we can pull ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/\" \/>\n<meta property=\"og:site_name\" content=\"Final Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hu.yuzhang\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-11T05:29:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-11-11T10:56:12+00:00\" \/>\n<meta name=\"author\" content=\"final\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hyzwowtools\" \/>\n<meta name=\"twitter:site\" content=\"@hyzwowtools\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"final\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/\",\"url\":\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/\",\"name\":\"Compile Clang3.4 - Final Blog\",\"isPartOf\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#website\"},\"datePublished\":\"2013-11-11T05:29:15+00:00\",\"dateModified\":\"2013-11-11T10:56:12+00:00\",\"author\":{\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3\"},\"breadcrumb\":{\"@id\":\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/finaldie.com\/blog\/compile-clang3-4\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/finaldie.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Compile Clang3.4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/finaldie.com\/blog\/#website\",\"url\":\"https:\/\/finaldie.com\/blog\/\",\"name\":\"Final Blog\",\"description\":\"As simple as possible...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/finaldie.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3\",\"name\":\"final\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/finaldie.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g\",\"caption\":\"final\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Compile Clang3.4 - Final Blog","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:\/\/finaldie.com\/blog\/compile-clang3-4\/","og_locale":"en_US","og_type":"article","og_title":"Compile Clang3.4 - Final Blog","og_description":"As we know, llvm is a great project, and it also include the clang compiler. And for Clang 3.4, it support dumping the format configuration file, so that people can generate the self-style format for their own project. Detail: ClangFormat \u00a0and ClangFormatStyleOptions And for now, Clang 3.4 has not been released, but we can pull ... Read more","og_url":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/","og_site_name":"Final Blog","article_publisher":"https:\/\/www.facebook.com\/hu.yuzhang","article_published_time":"2013-11-11T05:29:15+00:00","article_modified_time":"2013-11-11T10:56:12+00:00","author":"final","twitter_card":"summary_large_image","twitter_creator":"@hyzwowtools","twitter_site":"@hyzwowtools","twitter_misc":{"Written by":"final","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/","url":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/","name":"Compile Clang3.4 - Final Blog","isPartOf":{"@id":"https:\/\/finaldie.com\/blog\/#website"},"datePublished":"2013-11-11T05:29:15+00:00","dateModified":"2013-11-11T10:56:12+00:00","author":{"@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3"},"breadcrumb":{"@id":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/finaldie.com\/blog\/compile-clang3-4\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/finaldie.com\/blog\/compile-clang3-4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/finaldie.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Compile Clang3.4"}]},{"@type":"WebSite","@id":"https:\/\/finaldie.com\/blog\/#website","url":"https:\/\/finaldie.com\/blog\/","name":"Final Blog","description":"As simple as possible...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/finaldie.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/2d4c840d6e8e197f8ade98af2bd2fab3","name":"final","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/finaldie.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4c720545b79ddb0f23b527e0bbcfd9bc?s=96&r=g","caption":"final"}}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/169"}],"collection":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":11,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":181,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions\/181"}],"wp:attachment":[{"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/finaldie.com\/blog\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}