I got a C project to compile and run in Linux. It is a very big project with many subdirectories. Inside the parent directory there are files Makefile.am and Makefile.in.
I tried running make -f Makefile.am, and got the following error:
make: Nothing to be done for `Makefile.am'.
What does it mean? How do I accomplish my task?
These files are used with the Autotools suite. Makefile.am files are compiled to Makefiles using automake.
Have a look to see if there is a configure script in the directory. If there is, then type:
./configure
If not, then run:
autoreconf
in the directory, which should create the configure script (you will need to have the Autotools suite installed to run this).
After that, you should have a configure script that you can run.
After the configure is complete, you should have a normal Makefile in the directory, and will be able to run
make
What has been left out:
Makefile.am are transformed to Makefile.in using automake.
Makefile.in are transformed to Makefile by running configure.
Neither of these (Makefile.{am,in}) are supposed to be used with make -f.
If the tarball already ships with configure, just run that and make. If it does not, run ./autogen.sh or bootstrap(*). If that does not exist, use autoreconf instead.
(*) autogen/bootstrap: A convenience script added by developers that should just call autoreconf. Unfortunately there are some people that eschew autoreconf and unnecessarily call all the lowlevel commands themselves.
To supplement what has already been said:
Search for a script called configure in the project directory. If it is there, building the project will be:
./configure
make
and optionally, to install:
sudo make install
or su -c "make install"
Even if there is no configure script. there might be one autogen.sh. Run this script to generate the configure script and do as above.
Makefile.am is probably to be used with automake.
try:
automake
you might also just want to try
make -f Makefile.in
Since this is the product of running automake
Related
This question already has answers here:
Confused about configure script and Makefile.in
(2 answers)
Closed 4 years ago.
I saw a common pattern when installing a c/c++ package from source on Linux (Ubuntu 16.04):
./autogen.sh
./configure
make
make install
I understand make and make install, and I guess configure creates a Makefile based on user preferences, but I don't see why autogen.sh is necessary.
Does anyone know what it is there for?
The steps:
The autogen.sh script generates the configure script (from configure.ac, using autoconf) and any files it needs (like creating Makefile.in from Makefile.am using automake). This requires autotools to be installed on your system, and it must be run when checking out the project from source control (if configure isn’t checked in). People who download source tarballs can usually skip this step, because output of this step is included in source tarballs.
Note This is usually equivalent to autoreconf --install. If there is not autogen.sh file, then just run autoreconf --install instead. If you have inherited a project with an autogen.sh, consider deleting it if you can use autoreconf --install.
The configure script generates Makefile and other files needed to build. Typically Makefile.in is used as a template to generate Makefile (and config.h.in to generate config.h). This process happens using only standard tools installed on your system, like sed and awk, and doesn't require autotools to be installed.
The make command builds the software.
The make install command installs it.
These are broken into different steps because they are often run at different times. The autogen.sh step is traditionally run by people who are developing the software, since they are expected to install autoconf on their systems and they make changes to configure.ac. End-users are not expected to have autotools installed.
These expectations have been changed a bit now that end-users are more likely to check a project out of source control instead of downloading source releases.
This applies only to programs / libraries, which are built using the autotools build chain. It generates the files, which are configured by the configure script. The configure script then populates .in files and generates Makefiles from Makefile.am templates. Which can finally be used to compile, link and install the program / library.
It's becoming slowly obsolete with the move to multi platform packages. CMake and more modern tool chains are state of the art.
I'm trying to build a version of code I got from github (link) according to the instructions there.
I ran the following:
mkdir build
cd build
cmake ..
which seems to work fine. However, when I get to the last bit and try to run:
make
I'm getting a message that it is not recognized.
I have installed and double checked the paths of bison, gawk and cmake, and they all seem to be included in the system PATH.
Does anyone have any suggestion what might be the issue?
From my experience the command make only works when there is a file named "makefile" in the current directory. Using makefile -f "filename" will let make know the file is a makefile, and treat it as such. Or you can change the makefile name to "makefile".
I take a look inside the asio folder there are
asio.manifest
autogen.sh
boost_asio.manifest
boostify.pl
configure.ac
include/
INSTALL
src/ (there are asio_ssl.cpp and asio.cpp)
I didn't see any configure script where I can execute. How do I build this asio?
I read asio is a header only library.
So, what I can make out of those files in the asio folder?
If you got it from a tarball, you should already have a configure script ready to be executed. If you checked from the repository, you probably need to run ./autogen.sh to generate the configure script for you, using configure.ac as input.
The convention is:
./bootstrap: it invokes autoconf to process configure.ac and spit out configure. Often it also invokes automake to process all Makefile.am files and turn them into Makefile.in. Many moons ago, the name autogen.sh was used instead of bootstrap. And configure.in was used instead of configure.ac.
./configure: detects everything on the system and creates config.status, then executes it.
./config.status: processes all *.in files into versions without the .in suffix. That includes Makefile.in -> Makefile. You don't have to run this script by hand.
INSTALL: this SHOULD contain build instructions, such as "run ./autogen.sh if you checked out a copy from the repository". Shame on the ASIO developers, they just point the user to look for a non-existing "doc" directory.
You need autoconf (and friends) installed to transform configure.ac into configure. Once that is done, the build system becomes self-contained. That is, you can do a make dist-gzip to pack all the sources (and the configure script), transfer the tar.gz it to another system, and follow from the ./configure step, even if autoconf is not installed there.
So, Here are the steps I've followed just now.
I went to http://think-async.com, which is the website that hosts the non-boost asio.
Their download link led me to sourceforge, and version 1.4.8 of the software.
I then extracted the folder, and looking inside, I see the usual layout.
So the following steps include ./configure, make, and probably sudo make install.
I got the source code of a project (which I can't reach the author any more), that uses automake. I'm not familiar with system and all I want to do is rebuild the project.
I have the following files in the project:
Makefile.am
Makefile.in
Makefile
I've modified the Makefile.am file to fit the paths on my system, but how should I run it regenerate the Makefile.
Note: I'm not currently interested in learning automake, just recompiling this project.
to bootstrap an autoconf build-system, you might use
$ autoreconf -fiv
which will call automake, aclocal, autoheaders as needed, and generate the configure script. after that ou can do the usual
$ ./configure && make && make install
as proposed by milos_ladni
but you will definitely need configure.ac (or configure.in if it's an older project), else the project is simply missing some core parts.
if those are missing, you could go and try to modify Makefile directly (good luck), but it might be easier to just recreate a configure.ac from scratch (and hope that the project doesn't have too many dependencies)
$ ./configure --prefix=some_directory
$ make
$ make install
http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html#AP05
I just download poppler to Linux system,and I want to incorporate it in my app to parse pdf file.
(My goal is to convert pdf file to plain text.)
How can I do this?
Poppler's git tree includes a useless INSTALL doc that just tells you to run ./configure, but they don't include automake/autoconf auto-generated files (including configure) in git. (Probably they do include them in tarball source releases.)
I just built poppler from git source (on Ubuntu 15.04) like so:
git clone --depth 50 --no-single-branch git://git.freedesktop.org/git/poppler/poppler
cmake -G 'Unix Makefiles' # other -G options are to generate project files for various IDEs
# look at the output. If it didn't find some libraries,
# install them with your package manager and re-run cmake
make -j4
# optionally:
sudo make install
It appears that they maintain an autoconf/automake build setup, so you can use that OR cmake to create a Makefile.
If you just want to see if the latest git poppler works better than the distro package, you don't need to sudo make install, you can just run utils/pdftotext or whatever right from the source directory. It apparently tells the linker to embed the build path into the binary, as a library search path, so running /usr/local/src/poppler/utils/pdftotext works, and finds /usr/local/src/poppler/libpoppler.so.52.
If the latest poppler does work better than the distro-packaged poppler, you should install it to /usr/local/bin with sudo make install. When you upgrade to the next version of your distro, check your /usr/local. Often the new distro version will be newer than when you built it from source, so you should just remove your version from /usr/local/{bin,share,lib,man,include}. (Or make uninstall in the source dir, if supported).
Their website explains it very clearly :
Poppler is available from git. To clone the repository use the following command:
git clone git://git.freedesktop.org/git/poppler/poppler
Once you download the source code, read the INSTALL file where it says :
cd to the directory containing the package's source code and type
./configure to configure the package for your system.
Type `make' to compile the package.
Type `make install' to install the programs and any data files and
documentation.
Since some time has passed and it seems there was some uncertainty, I also took a look.
At the end of 2021, their homepage says
We run continuous integration via the gitlab CI
I checked out their .gitlab-ci.yml which has many build tasks. It would seem these days we build libpoppler like this:
git clone git://git.freedesktop.org/git/poppler/test test.repo
mkdir -p build && cd build
cmake -DTESTDATADIR=`pwd`/../test.repo -G Ninja ..
ninja