Surely you have come across situations where you have had to compile a program, even if you are not a developer. Even today, there will be some other programmer who has just develop in interpreted langa\uages and has problemes every time he has to compile... If you are a developer and you develop in C, C++, ASM or simply, you have been interested in how the things work, this post will be trivial.
(I do not include people who have studied computer engineering; I remember subjects in my career even dedicated to this, e.g. "Compiladores, traductores e interpretes")
There are many situations where you have surely found in the situation of having to compile a program, most of open source tools developed in C/C++ will come without being compiled, and also, there will include a section in the README/INSTALL about how to build the program(although it depends of the operating system you are using)
An example, currently the is fashion, and some of the crypto coins works using PoW (Proof of Work), so it allows the "mining" of these crypto coins, therefore if we want to get the most out of our hardware, we should have the binary compile for our system (and hw). For people who do not have much idea, it is normal to download binaries already compiled for their architecture, which has two inherent problems (and more), at least one of them is very dangerous:
By security I mean that when you use a binary downloaded from the Internet you do not really know what the source code has been compiled (closed-software problems) and you have to confidence in provided binary. Thus, we can think that this software could contain malware. Particularly in the world of the cryptocurrency, I would not trust much...
E.g Searching by command lines that include mining tools we can found easily malware that use it...
Another advantage of compile the code ourselves is that we can modify as we want; e.g. we can remove the function of the mining software that are dedicated to making donations (maybe it is not most ethical stuff, it is an example)
In this example we will compile ccminer which uses our GPU (nvidia-drivers and libcuda)
Asumimos que tenemos instalados tanto los drivers de nvidia, como la libreria de cuda;
If you have not, install it is very easy:
apt install -t buster-backports nvidia-driver nvidia-cuda-dev nvidia-cuda-gdb libcuda1
In my case, I am using the backports kernel, I had to install the latest driver, since the nvidia driver that comes with stable does not work for kernels higher than 5.9. More info
If everything is ok, running the following command you should see your driver version and the cuda version:
Since I have to deal with different architectures at work, and therefore I am practically compiling different programs everyday for multiple architectures.
In the following example we will compile binutils for different architectures; and below I'll leave a few compiled binaries (in case someone wants them, and trust...)
It is just an example, for other programs perhaps and surely you have to use other commands, e.g:
export CC=aarch64-linux-gnu-gcc export SUID_CFLAGS=-static export LDFLAGS=--static export CPPFLAGS=-static export SUID_LDFLAGS=-static export SUID_LDFLAGS=-static ./configure --host=aarch64-linux-gnu --disable-shared --disable-multilib --without-tinfo --without-ncursesw --disable-ipv6 --disable-pylibmount make
export CC=aarch64-linux-gnu-gcc export SUID_CFLAGS=-static export LDFLAGS=--static export CPPFLAGS=-static export SUID_LDFLAGS=-static export SUID_LDFLAGS=-static ./configure --without-bash-malloc make