Compiling / building Feathercoin code - Makefiles
-
What are Makefiles?
Makefiles are used to build software binaries from source code. They are a recipe for combining the different files and only compiling or linking the files that are necessary. e.g. when writing software it is quicker only only to compile the ones that have changed.
Makefiles are used to compile the Bitcoin / Feathercoin code and there are guides and instructions to build the software which use these build scripts.
it is interesting and informative to “debug build problems” to understand some back ground in how Makefiles work.
This video by MyGeekAdventures explains Makefiles very simply, read about it afterwards
https://www.youtube.com/watch?v=ygoRdBBOdYU
Quick Introduction to Makefiles
A makefile is basically a set of instructions for performing a certain task (typically compiling and linking a set of files to create an executable program). Unlike a simple script that lists a set of commands to perform, a makefile lets one describe dependencies of parts of the process on other parts.
For example, building a main program might involve compiling several (or several hundred!) C programs, linking them together, and copying the final executable program to a shared area. If only one program is changed, it may not be necessary to re-compile all the C programs. A makefile can record this fact, and by using the single command “make” the necessary (and only the necessary) steps will be performed.
Makefiles can have a very simple format, consisting of pairs of lines as follows:
Target: dependancy1, dep2, dep3 …
(TAB) command(s)“Target” is the name of something, to do or a file you want to build, followed by a colon (:) and a list of 0 or more files that need to exist and be up-to-date.
If those dependencies are satisfied, then the command(s) on the next line (which must begin with a TAB, not just spaces) will be executed.
The entire process pays attention to timestamps on targets and dependencies, and will re-make required targets if their dependencies have a newer timestamp than the target itself
https://www.youtube.com/watch?v=ygoRdBBOdYU
Ref: MyGeekAdventures
-
Using the makefile to diagnose Feathercoin source code build problems
As part of testing the builds and build instructions, sometimes there are problems with different GNU/Linux distributions or other OS compiles. Even where it worked fine before, the OS can suddenly require a special version of some software and change a dependency.
With FTC problems can happen with, QR code / zxing and SSL or encryption libraries.
The other problem is just errors in copying and pasting where, say, you home directory or the position of a specially compiled binary needs to be specified.
Following the guide to compile Feathercoin, untill ./configure.
The “makefile” is then created and can be examined, in particular, directory pointers :
LRELEASE = /home/wrapper/anaconda2/bin/lrelease
LTLIBOBJS =
LUPDATE = /home/wrapper/anaconda2/bin/lupdate
MAINT =
MAKEINFO = ${SHELL} /home/wrapper/Feathercoin/src/build-aux/missing makeinfo
MAKENSIS =As can be seen in this case, lupdate was pointing to the wrong directory, due to a previous anaconda install. That value can be temporary corrected before running the “make” command to do the actual compile to produce a binary.