{"id":839,"date":"2014-07-28T19:03:24","date_gmt":"2014-07-29T02:03:24","guid":{"rendered":"http:\/\/somethingk.com\/main\/?p=839"},"modified":"2014-07-28T19:03:24","modified_gmt":"2014-07-29T02:03:24","slug":"linux-compiling-downloaded-source-code-with-makes-101","status":"publish","type":"post","link":"https:\/\/somethingk.com\/main\/linux-compiling-downloaded-source-code-with-makes-101\/","title":{"rendered":"Linux &#8211; Compiling Downloaded Source Code with Make\u2019s 101"},"content":{"rendered":"<p>I\u2019ve been doing quite a bit of source code compiling using the \u201cmake\u201d command and figured I provide a brief primer on how to compile.<\/p>\n<p>DISCLAIMER \u2013 Not all source codes are the same, some may\/may not follow this structure.<\/p>\n<p>First step, download the source code you wish to compile. For this example, I will download <a title=\"CMake 3.0\" href=\"http:\/\/www.cmake.org\/cmake\/resources\/software.html\" target=\"_blank\">cmake 3.0<\/a>. The tool can be downloaded from:\u00a0<a href=\"http:\/\/www.cmake.org\/files\/v3.0\/cmake-3.0.0.tar.gz\">http:\/\/www.cmake.org\/files\/v3.0\/cmake-3.0.0.tar.gz<\/a>.<\/p>\n<p>Untar the file, the following command will work when executed from t<span style=\"text-decoration: underline;\">he same directory the tar file is located<\/span>.<\/p>\n<pre>tar -xvf cmake-3.0.0.tar.gz\r\n<img decoding=\"async\" class=\"aligncenter size-medium wp-image-844\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.50.37-PM-300x53.png\" alt=\"Screen Shot 2014-07-28 at 9.50.37 PM\" width=\"300\" height=\"53\" srcset=\"https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.50.37-PM-300x53.png 300w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.50.37-PM.png 422w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/pre>\n<p>Next, change directories into the newly tar-ed folder (the source code directory).<\/p>\n<pre>cd\u00a0cmake-3.0.0<\/pre>\n<p>The following commands need to be executed within the source directory. Some source codes have and autogen.sh file. If this exists, run it to auto generate the correct configure.<\/p>\n<pre>.\/autogen.sh<\/pre>\n<p>However, if there is already a configure file (note this is not configure.&lt;EXTENSION&gt;), run that to check and setup your environment.<\/p>\n<pre>.\/configure<\/pre>\n<p>The command<\/p>\n<pre style=\"color: #000000;\"><code>.\/configure --help<\/code><\/pre>\n<p>will show you the manner different setup variables you can assign values. For example, if you do not want the source code to be compiled in default directories, add the \u2013prefix flag to specify another directory.<\/p>\n<pre>.\/configure \u2013prefix=&lt;DIRECTORY FOR INSTALL&gt;\r\n<a href=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.52.33-PM.png\"><img decoding=\"async\" class=\"aligncenter size-medium wp-image-843\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.52.33-PM-300x153.png\" alt=\"Screen Shot 2014-07-28 at 9.52.33 PM\" width=\"300\" height=\"153\" srcset=\"https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.52.33-PM-300x153.png 300w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.52.33-PM.png 397w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/pre>\n<p>Some sources require you to run<\/p>\n<pre>make<\/pre>\n<p>first to run\/setup default variables. However, I normal just run<\/p>\n<pre>make install\r\n<a href=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.58.47-PM.png\"><img decoding=\"async\" class=\"aligncenter size-medium wp-image-842\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.58.47-PM-300x122.png\" alt=\"Screen Shot 2014-07-28 at 9.58.47 PM\" width=\"300\" height=\"122\" srcset=\"https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.58.47-PM-300x122.png 300w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2014\/07\/Screen-Shot-2014-07-28-at-9.58.47-PM.png 573w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/pre>\n<p>in most instances, after configuring.<\/p>\n<p>That\u2019s pretty much it! It is compiled and ready to go. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve been doing quite a bit of source code compiling using the \u201cmake\u201d command and figured I provide a brief primer on how to compile. DISCLAIMER \u2013 Not all source codes are the same, some may\/may not follow this structure. First step, download the source code you wish to compile. For this example, I will download cmake 3.0. The tool [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[177,6],"tags":[250,254,248,255,63,331,252,251,253,249],"class_list":["post-839","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","tag-250","tag-cmake","tag-compiling","tag-configure","tag-install","tag-linux","tag-make","tag-make-command","tag-primer","tag-source-code"],"_links":{"self":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/comments?post=839"}],"version-history":[{"count":3,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/839\/revisions"}],"predecessor-version":[{"id":845,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/839\/revisions\/845"}],"wp:attachment":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/media?parent=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/categories?post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/tags?post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}