I try to setup a gnu arm toochain on my Ubuntu Linux computer. I already downloaded
tar -xvf gcc-4.8.2.tar.bz2
tar -xvf binutils-2.24.tar.bz2
tar -xvf newlib-2.1.0.tar.gz
tar -xvf insight-6.8.tar.bz2
and extracted them. I started with installing the binutils succeccfully OK.
In my second step I intended to biuld up the first gcc bootstrap installation to compile newlib in turn (in the next step). But anyway I could not succeed the gcc installation:
sudo ../gcc-4.8.2/configure --target=arm-elf --prefix=/opt/gnuarm --enable-interwork --enable-multilib --enable-languages="c,c++" --enable-target-optspace --with-float=soft --with-newlib --with-headers=../newlib-2.1.0/newlib/libc/include/ --disable-nls
It runs until I got following error message:
//... a lot of checkings...
checking for clock_t... yes
checking for F_SETLKW... yes
checking if mkdir takes one argument... no
*** Configuration arm-unknown-elf not supported
make: *** [configure-gcc] Fehler 1
I appreciate any hints . Thanks in advance.
Sincerly Murat
Ok I solved it by selecting another target. The issue is that in gcc 4.7 arm-elf was obsolete and in 4.8 dropped. So you have to build your toolchain with an older gcc (4.6 or older) or you should select another target.
I decided to compile my toolchain for -target=arm-none-eabi (embedded application binary interface), which should fit my target. Thank you very much.
Related
Working with embedded C-projects. There are libraries, include files and so on - for micro controllers. No need for me to use GCC for a host machine and OS (Linux Mint 64 bit). As a rule...
But now I'm trying to compile mspdebug project from a Github - with a GCC of course. And I get an error at the very begin of make:
mspdebug$ make
cc -DUSE_READLINE -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Itransport -Idrivers -Iutil -Iui -DLIB_DIR=\"/usr/local/lib/\" -o util/btree.o -c util/btree.c
util/btree.c:19:20: fatal error: assert.h: No such file or directory
#include <assert.h>
^
compilation terminated.
I search for the includes in all possible paths (I've got the list of them via gcc -v command) - there are no assert.h file, as well, as stdio.h and so on. Except virtual box directories there is only one place (where GCC does not search includes): /usr/lib/syslinux/com32/include
AFAIK, all standard libs and includes are installed with the GCC. So I try to reinstall GCC (4.8.4) - nothing changes.
What is the normal way to give GCC all standard environment it needs?
Thanks to the right direction set by Sam Varshavchik I found the info in the stackoverflow. So I did the following:
1) installed build-essential:
sudo apt-get install build-essential
2) installed libusb (since my try to build the package revealed the absence of usb.h):
sudo apt-get install libusb-dev
And it is OK! The mspdebug (v.023) is compiled and successfully tested!
So, Linux Mint 17.2 (at least) requires installing some libs to a GCC, the most basic is build-essential.
assert.h is not part of gcc, it's a part of glibc.
Most likely, your Linux distribution puts the system headers into a separate package that you need to install.
Fedora, for examples, puts the header files in the glibc-headers package. However, you can't be using Fedora, because Fedora's gcc package has a dependency on glibc-headers, to make sure that it gets pulled in.
Whatever Linux distribution you're using, you need to research which distribution package will install the system header files you need to build stuff with.
Last days I've been trying to compile a STM32F4xx project with Ubuntu 14.04LTS, Eclipse and GNU ARM plugin for Eclipse. Now it says that nano.specs is missing.
Here is my build log:
14:39:35 **** Incremental Build of configuration Release for project F4Test ****
make all
Building target: F4Test.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -Wextra -g -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"F4Test.map" --specs=nano.specs -o "F4Test.elf" ./system/src/stm32f4-hal/stm32f4xx_hal.o ./system/src/stm32f4-hal/stm32f4xx_hal_cortex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_flash_ramfunc.o ./system/src/stm32f4-hal/stm32f4xx_hal_gpio.o ./system/src/stm32f4-hal/stm32f4xx_hal_iwdg.o ./system/src/stm32f4-hal/stm32f4xx_hal_pcd_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr.o ./system/src/stm32f4-hal/stm32f4xx_hal_pwr_ex.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc.o ./system/src/stm32f4-hal/stm32f4xx_hal_rcc_ex.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/_write.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32f4xx.o ./system/src/cmsis/vectors_stm32f4xx.o ./src/BlinkLed.o ./src/Timer.o ./src/_initialize_hardware.o ./src/main.o
arm-none-eabi-g++: error: nano.specs: No such file or directory
make: *** [F4Test.elf] Error 1
14:39:35 Build Finished (took 65ms)
I found some nano.specs files on my computer. What should I do? Just remove linker flag (I can't actually do that, because I can't figure out how to do that in Eclipse) or something else?
Thanks for your help!
I solved the problem. I was just using arm-none-eabi-xxx packages provided by Ubuntu, not original ones - that was the problem. All you need to do is simply download packages from toolchain's website and install them. They work just fine!
Optional step
If you have installed the bundled toolchain from Ubuntu's repositories - get rid of them:
$ sudo apt-get remove gcc-arm-none-eabi
Recommended way to install
This is described on the plugin's page:
http://gnuarmeclipse.github.io/toolchain/install/
-> with an exact description what packages are needed for your specific edition (14.04 LTS, x64 in this case).
First, install 32-bit dependency libraries:
$ sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0
(15.04 - and later? - need just lib32ncurses5, while older Ubuntus - 12.04 e.a. - have ia32-libs).
Then download a pre-compiled toolchain package from here:
https://launchpad.net/gcc-arm-embedded/+download
(they recommend gcc 4.9 at the time of writing, but it should be OK to take the newest, gcc 5.3 version).
Recommended install location
Finally untar the package into /usr/local - this way the Eclipse plugin should find it, without configuring toolchains in Eclipse preferences or modifying $PATH variable.
$ cd /usr/local
$ sudo tar xf ~/Downloads/gcc-arm-none-eabi-*-linux.tar.bz2
If you are compiling for ARM Cortex-M or Cortex-R, try installing the package gcc-arm-embedded with apt-get instead of gcc-arm-none-eabi. This worked for me, and the suggestion came from the documentation for Arm's "Yotta" build tool: http://yottadocs.mbed.com/#linux-cross-compile.
While building gcc, I get this error:
In file included from /usr/include/bits/errno.h:25,
from /usr/include/errno.h:36,
from ../.././gcc/tsystem.h:96,
from ../.././gcc/crtstuff.c:68:
/usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory `/opt/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc'
I am building gcc 4.1 from source. I think I have to install build-essential. However installing that package in ubuntu 12.04 will automatically download and install gcc 4.6 and I don't want that.
Is there any other way?
I think the package you want is linux-libc-dev . I encountered this when building 32-on-64; so I needed linux-libc-dev:i386 .
This worked for me:
ln -s /usr/include/asm-generic /usr/include/asm
This worked for me:
sudo ln -s /usr/include/asm-generic /usr/include/asm
The reason being that what GCC expects to be called /usr/include/asm is renamed to /usr/include/asm-generic in some distros.
This fixed it for me.
sudo apt-get install linux-libc-dev:i386
This solved it for me on Debian 10, even though I was compiling with an LLVM-based compiler:
sudo apt install gcc-multilib
/usr/include/asm/errno.h is part of the linux headers. I can't speak directly to Ubuntu 12.04, but in general you can download the linux sources as a package for your distro and it shouldn't require you to download/install gcc. Failing that, you can manually download the linux headers for the version of your kernel (uname -a) and use an include directive to CFLAGS to specify the directory to look for those.
Edit: sudo apt-get install linux-headers-generic may work for you.
You are missing part of the development packages. I don't know Ubuntu, but you should be able to ask it's package management system to install the package containing /usr/include/asm/errno.h.
Do not copy some file with a similar name from somewhere on your system (or, even worse, from somewhere else). Missing files might mean that some package is damaged; again, ask your package manager to check everything and (re)install missing/broken pieces.
Unless you are running some LTS release, upgrade. Your Ubuntu is some 2 years old, i.e., ancient.
While we are at this, why on this beautiful planet are you building such an ancient compiler? Current GCC is just released 4.9.0, anything before 4.7 is ancient history, not longer supported.
On Ubuntu 16.04 x86_64 you could try this:
ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm
This works on my server.
If you want to use errno.h that is in the asm file, simply go to /usr/(ctrl + l, type /usr/) and then search for errno.h and errno-base.h. Once you did find them, copy the code in these two files, and place them in your include folder. And be careful, in "errno.h" the file includes "errno-base.h" as:
#include <asm-generic/errno-base.h>
Either create a directory with the same name above or change the code above to something different which is suitable for you to use.
If you can find:
usr/include/asm-generic/errno.h
by executing:
find /usr/include -name errno.h
then try to execute:
cp --archive /usr/include/asm-generic /usr/include/asm
It may fix that problem.
I had this issue while compiling Asterisk 1.8.24.0 and solved it with:
mkdir /usr/include/asm-generic
cp /usr/include/asm/errno-base.h /usr/include/asm-generic/
Don't know if it is the "right way" but i've read the comments above and that gave me the idea... and it worked :)
I'm trying to build prerequisites for gcc-4.7.2.
Both ppl-0.11 and gmp-4.3.2 are the recommended versions in <gcc_src>/gcc-4.7.2/gcc/doc/HTML/prerequisites.html
I have built and installed gmp-4.3.2 (with --enable-cxx set)
Attempting to configure ppl-0.11 fails.
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
This is my configure line:
./configure \
--prefix=$PREFIX \
--with-gmp=$PREFIX \
--with-gmp-prefix=$PREFIX \
If I look in the directory where I specified with-gmp, here is the installed gmp:
$ grep MP_VERSION $PREFIX/include/gmp*
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION 4
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION_MINOR 3
$PREFIX/include/gmp.h:#define __GNU_MP_VERSION_PATCHLEVEL 2
.
$ l $PREFIX/include/gmp*
$PREFIX/include/gmp.h
$PREFIX/include/gmpxx.h
.
$ l /$PREFIX/lib/libgmp*
$PREFIX/lib/libgmp.a
$PREFIX/lib/libgmp.la
$PREFIX/lib/libgmp.so -> libgmp.so.3.5.2
$PREFIX/lib/libgmp.so.3 -> libgmp.so.3.5.2
$PREFIX/lib/libgmp.so.3.5.2
$PREFIX/lib/libgmpxx.a
$PREFIX/lib/libgmpxx.la
$PREFIX/lib/libgmpxx.so -> libgmpxx.so.4.1.2
$PREFIX/lib/libgmpxx.so.4 -> libgmpxx.so.4.1.2
$PREFIX/lib/libgmpxx.so.4.1.2
Am I missing something?
As far as I can tell, GMP is available and of the requisite version
Depending on what distro you are running, have you tried to install the gmp-devel package (i.e. yum install gmp-devel on Fedora/RedHat etc)?
PPL will by default try to use default locations for GMP. If you use crosstool-ng, you must do either a cross-native or canadian-cross build. If you are doing this manually, specify CXXFLAGS to PPL's ./configure, with a -I<path-to-gmp-header> and a -Wl,-L<path-to-gmp-libs>. This allows the PPL ./configure to find the correct version of GMP.
Apparently a PPL configure with,
--prefix=$PREFIX \
--with-gmp=$PREFIX \
--with-gmp-prefix=$PREFIX \
Is not enough. I sleuthed through the ./configure script and was hacking up crosstool-ng before I realized that I was no longer building a cross-compiler, but a canadian-cross when I wasn't using my distro gcc, but another host compiler with a lower glibc shared library. This is useful if you want your compiler to run on a larger class of machines. It is unlikely that the glibc version of the build compiler will effect much.
I still had to patch 120-ppl.sh in crosstool-ng,
do_ppl_for_build() {
...
ppl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
+ ppl_cxxflags+=" -I${CT_BUILDTOOLS_PREFIX_DIR}/include "
+ ppl_cxxflags+=" -Wl,-L${CT_BUILDTOOLS_PREFIX_DIR}/lib "
if [ "${CT_PPL_NEEDS_FPERMISSIVE}" = "y" ]; then
ppl_cxxflags+=" -fpermissive"
fi
So I also faced the same issue and what I did was:
1) Went inside gmp-4.3.2 folder
2) make distclean
3) ./configure --prefix=/home/sen/Documents/mingw/downloads/gmp_build --enable-cxx
4) make && make install
5) Went inside ppl-0.11 folder
6) ./configure --prefix=/home/sen/Documents/mingw/downloads/ppl_build --with-gmp-prefix=/home/sen/Documents/mingw/downloads/gmp_build --enable-cxx
7) make & make install
Took some 10-20 mins to compile and things were fine.
Thanks,
Sen
After years, the issue has been run into. The solution is firstly to download last version of gmp. Then, copy the path as in like the picture. Don't forget to ./configure with --enable-cxx, which is really important point. ./configure --enable-cxx. Now time is to ppl installation, ./configure -help indicates that --with-gmp=DIR search for libgmp/libgmpxx in DIR/include and DIR/lib. So write ./configure --with-gmp=<<dir of gmp as shown in first picture, you may have a different path>>
I wrote, respectively, ./configure --with-gmp=/usr/local/include, make, sudo make install then it works like a charm!
I am trying to compile a library using android-ndk-r5 standalone toolchain and autotools. When doing a ./configure, it fails with:
$ ./configure --host=arm-linux-androideabi
...snip...
checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/sh ./config.sub arm-linux-androideabi failed
Explicitly setting CC and CXX does not work either (configure says to use --host).
The NDK docs and various materials online seems to indicate that using the standalone toolchain in this manner should be possible. What is wrong here? and how can I resolve it? (besides simply ditching autoconf and going back to Android.mk)
You might need a newer config.sub and config.guess, 2010-05-20 or later.
You can get the newer config.sub and config.guess from here
I took the newest from both, but that lead to errors, so I took the mentioned ones of Peter Eisentraut's date.
You can also grab config.sub and config.guess from the Ubuntu autotools-dev package:
sudo apt-get install autotools-dev
cp /usr/share/misc/config.{sub,guess} .