Tutorial : how to create a new autotools c project using the buildroot toolchain ?
Clone this wiki locally
The purpose is to create a new Autotools C project that will use a toolchain generated by Buildroot. With Autotools project, it is up to the developer to write the
configure.ac file and the
Makefile.am, but it allows the project to be built outside of Eclipse, and to use standard Unix tools as your project build system. For more details about the Autotools, we recommend buying this book, or reading this tutorial.
Create Autotools C project in Eclipse
Create a new C Project:
Set the project name and select in the
GNU Autotools project type the Buildroot toolchain to use to build the project :
If you can't find the expected toolchain in the list check that you compiled your Buildroot toolchain with the option
Register the Eclipse toolchain activated (see How to activate and install the Buildroot Eclipse plugin ? for details).
When the user selects a toolchain for its project :
PATHenvironment variable is defined to add the location of the Buildroot toolchain, so that the build process can easily find the cross-compiler and related tools,
- A default value for the
--hostconfigure script option is set, to match the prefix of the cross-compilation toolchain. This will ensure that your project will be correctly cross-compiled with the Buildroot toolchain,
- The integration with the scanner information was done in order to allow CDT to find automatically the header files,
- The plugin provides the possibility to create Remote Launch configurations to execute the application on the target,
- And to create Remote Debug configurations which point automatically on the correct cross-debugger.
Create a new C file :
Create a new
configure.ac file :
Create a new
Makefile.am file. Of course, as your project extends, you may create additional
Makefile.am files in subdirectories of your project.
Autoreconf tool. Right-click on the project in the explorer view and select
Invoke Autoreconf. This operation will call the autotools to generate the
configure script from
configure.ac and the
Makefile.am. This operation only has to be done again if you make changes to
-i option to the autoreconf command, in the opened dialog. This tells
autoreconf to automatically install some additional scripts and files that are needed for the correct operation of the
We can see in the console that the autoreconf command finished successfully. The
Makefile.in files have properly been generated in the project.
Reconfigure the project. This calls the
configure script, passing the
--host option that has been set to a default value that ensures that your project will be cross-compiled with the Buildroot toolchain. You may define additional options by changing the properties of your project in Eclipse.
In the console, we can see that the operation finished succesfully and the Makefile was generated :
You can now build the project (