Have you been told to «clone the repo and build it» and don’t know what to do next? We will show you how to run this program on GitHub on Linux, even if you are a beginner.
The instructions that make up a computer program are written, edited, and stored in text files. Then a program called a compiler processes these files. This produces an executable version of the program. The text files of instructions are called source code. The version of a program that can run on a computer is called a binary or executable file.
This is a simplified version of events, but it paints a correct — if generalized — picture. In practice, you will find all kinds of variations of this model. Sometimes other programs generate text files. In other cases, the source code is executed inside the interpreter and doesn’t need to be compiled, etc.
However, one universal truth in all software projects is this: source code files are crown jewels and must be taken care of just as carefully.
Version control programs
All source code files in a project are called a code base. Large projects often have many developers working on the code base. Every code change should be tracked and identified. If necessary, the changes must be reversible. If different developers make changes to the same source code file, their changes should be merged.
So it’s not surprising that there are programs called version control systems to make it easier to manage changes to a codebase. Version control systems store all previous versions of each file in the code base, and each change is recorded, commented, and tracked.
Little thing called Git
Linus Torvalds, the creator of the Linux kernel, developed a version control program called Git to administer the code base of the Linux kernel. It is now the world’s most widely used version control software. Millions of people use it literally.
With Git, a project’s codebase is stored in repositories . In addition to local repositories, which are located on the developers’ computers and possibly on a central server on the network, it is good practice to have a remote or remote repository.
And this is where GitHub comes in.
GitHub was created as a result of success
git . The founders saw an emerging need to securely host remote
git repositories. They launched a business that provides a cloud platform that allows development teams to host remote repositories. As of April 2019, there are over 100 million repositories hosted on GitHub.
If the application is an open source project, there is a very high chance that it will be hosted on GitHub. There are other repository platforms available such as BitBucket and GitLab, but GitHub has the lion’s share of open source repositories.
Anatomy of a repository
A GitHub repository consists of folders containing files such as all important source code files. There are usually many other types of files in the repository. These can be documentation files, man pages, software license files, build instructions, and shell script files. There are no rules as to what a repository should or should contain, but there are conventions.
If you know how to navigate one kitchen, you can navigate any kitchen. It’s the same with repositories. Once you understand the conventions, you will know where to go to find what you need.
So how do you get a copy of the repository on your computer, and how do you compile the program into a binary executable?
It is traditional to include a readme file in the repository. This may be called readme, Readme or README. May have a «.md» extension or no extension at all.
Let’s take a look at the GitHub repository for the Atom editor. You see a long list of folders and files. Scroll down and you will see the contents of the README.md file.
GitHub automatically places the content of the readme file on the first page of the repository. If the readme file has a «.md» extension, it will contain Markdown markup language. This allows developers to use style elements such as fonts, bullets, and images.
Typically, the readme file has sections that explain what a project is, what a model license is, who supports the project, how to get involved, and how to build and run the application.
If it doesn’t list actual assembly instructions, it will tell you where to find that information. Other information useful for building the application, such as required build tools and other dependencies, may be listed here, or a link may lead you to that information.
Our mission is to clone the boxes repository and then build the app
The repository follows the same pattern as Atom. There is a list of folders and files, and below is the contents of the readme file. It follows the standard vault layout, but it’s a smaller project so there are fewer folders and files.
The readme file is also shorter. It has a Development section. There is a link in this section titled «Creating from Source». If we follow this link, we should find the information we need.
Usually light navigation is required to navigate the repository and find the information you need, but it’s not difficult. Read everything on the repository page carefully. Sometimes the information is there, but may not be displayed in a conspicuous place.
The Build from Source page has a Build on Linux section, which is exactly what we need. It says that we must have the C , Bison and Flex compiler installed.
The build instructions say to run the command
make so we also need
Tools needed to build this application: C compiler, Bison, Flex,
make and Git (for cloning the repository to your computer).
This article was researched on computers with Ubuntu, Fedora and Manjaro Linux distributions. No distribution had all of these tools installed—something had to be installed on each of them.
Installing the Toolkit
Ubuntu should have installed Git, Flex, Bison and
make . Here are the commands:
sudo apt-get установить git
sudo apt-get install flex