Building GCC make: *** [all] Error 2 - c

I am trying to set up a cross-compiler for i686-elf on Ubuntu following the OSDev GCC Cross-Compiler Tutuorial. However, the code to set up GCC fails to build every time. I know my sources are not out of date because I sudo apt-get update'd before doing anything.
In order to get the packages I needed, I did:
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install libgmp3-dev
sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg
sudo apt-get install mpc
sudo apt-get install texinfo
sudo apt-get install libcloog-isl-dev
I think there is no problem with that method?
Then, with gcc-5.2.0 and binutils-2.25.1 (in ubuntu, bintuils appears to not work with anything above that old version) I installed binutils just fine. I went to build gcc but when I typed in make, I got the following error:
Unfortunately, I can't copy+paste 30 pages in, but this all the code near the end:
checking command to parse nm output from gcc -m32 object... failed
checking how to run the C preprocessor... /lib/cpp
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc -m32 supports -fno-rtti -fno-exceptions... no
checking for gcc -m32 option to produce PIC... -fPIC -DPIC
checking if gcc -m32 PIC flag -fPIC -DPIC works... yes
checking if gcc -m32 static flag -static works... no
checking if gcc -m32 supports -c -o file.o... yes
checking if gcc -m32 supports -c -o file.o... (cached) yes
checking whether the gcc -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:9590: recipe for target 'configure-zlib' failed
make[1]: *** [configure-zlib] Error 1
make[1]: Leaving directory '/home/david/scr'
Makefile:876: recipe for target 'all' failed
make: *** [all] Error 2
And this is the part (right after that) where something really bad happens:
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:9590: recipe for target 'configure-zlib' failed
make[1]: *** [configure-zlib] Error 1
make[1]: Leaving directory '/home/david/scr'
Makefile:876: recipe for target 'all' failed
make: *** [all] Error 2
Can anyone tell me what I am doing wrong and how I would fix it?
Thanks!

The problem was that I wasn't installing mpc from source.
Here is the finished file (setup-gcc.sh):
####################################
echo Stage 1 - Building Dependencies
####################################
# make a working directory
cd $HOME/Documents
rm -rf Cross
mkdir Cross
cd Cross
# install or update all apt-get dependencies
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install gcc -y # not cross
sudo apt-get install g++ -y
sudo apt-get install make -y
sudo apt-get install bison -y
sudo apt-get install flex -y
sudo apt-get install gawk -y
sudo apt-get install libgmp3-dev -y
sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg -y
sudo apt-get install mpc -y
sudo apt-get install texinfo -y # optional
sudo apt-get install libcloog-isl-dev -y # optional
sudo apt-get install build-essential -y
sudo apt-get install glibc-devel -y
sudo apt-get -y install gcc-multilib libc6-i386 -y
# download and unpack necessary files
wget http://ftpmirror.gnu.org/binutils/binutils-2.25.1.tar.gz
wget http://ftpmirror.gnu.org/gcc/gcc-5.3.0/gcc-5.3.0.tar.gz
wget http://ftpmirror.gnu.org/mpc/mpc-1.0.3.tar.gz
for f in *.tar*; do tar zvxf $f; done
# create installation directory
mkdir Install
export PREFIX="$HOME/Documents/Cross/Install"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
################################
echo Stage 2 - Building Compiler
################################
# install mpc
mkdir build-mpc
cd build-mpc
../mpc-1.0.3/configure --prefix="$PREFIX"
make -j2
make -j2 check
make -j2 install
cd ..
# install binutils
mkdir build-binutils
cd build-binutils
../binutils-2.25.1/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make -j2
make -j2 install
cd ..
# install gcc
mkdir build-gcc
cd build-gcc
../gcc-5.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --with-mpc="$PREFIX"
make -j2 all-gcc
make -j2 all-target-libgcc
make -j2 install-gcc
make -j2 install-target-libgcc
Once you have it installed, you can run it with:
export PREFIX="$HOME/Documents/Cross/Install"
export TARGET=i686-elf
$PREFIX/bin/$TARGET-gcc --version
Unfortunately, doing this inside of an alias or bash script doesn't seem to properly launch it, so, unless this gets fixed, you might have to just store the script in a text file and copy-paste it into terminal every time you reboot.
To uninstall your cross-compiler, simply delete the $HOME/Documents/Cross directory.
As a final note, changing the installation directory or target is as easy as changing the value of $PREFIX or $TARGET, but I wouldn't recommend it, because you may run into other unexpected problems.

In addition to --with-system-zlib, it worked for me when I use --disable-multilib option.

Related

How to uninstall graphics.h from ubuntu?

I have installed graphics.h using the following steps:
First install build-essential by typing
sudo apt-get install build-essential
Install some additional packages by typing
sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 \
guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev \
libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev \
libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev \
libslang2-dev libasound2 libasound2-dev
Now extract the downloaded libgraph-1.0.2.tar.gz file.
Go to the folder where the files were extracted and run the following commands:
./configure
make
sudo make install
sudo cp /usr/local/lib/libgraph.* /usr/lib
But now how do I uninstall it again?

error processing package linux-image-4.15.0-20-generic

when i want to update or install any package i got this error:
for example : whealln i exec this sudo apt upgrade or sudo apt install zsh
dpkg: error processing package linux-image-4.15.0-20-generic (--remove):
installed linux-image-4.15.0-20-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-4.15.0-20-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
how to fix it?
These commands should hopefully work. They will do a full clean and reinstall.
sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade && sudo apt-get dist-upgrade
sudo dpkg-reconfigure -a
sudo dpkg --configure -a

Getting SSL error while installing intel driver

While installing a intel Driver by doing sudo make install getting the following error-
SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
sign-file: certs/signing_key.pem: No such file or directory
Any Solutions for it?
Using
Using DKMS Solved my problem when installing v4l2loopback
solution is here
sudo cp -R . /usr/src/v4l2loopback-1.1
sudo dkms add -m v4l2loopback -v 1.1
sudo dkms build -m v4l2loopback -v 1.1
sudo dkms install -m v4l2loopback -v 1.1
u may need to install dkms using
sudo apt install dkms

unable execute arm-cc on docker images ( ubuntu 12.04 base )

i want execute arm-cc binary on docker images (ubuntu 12.04 base)
but can't
the process was below ...
download arm CC using wget ( https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.xz )
uncompress the file
execute arm cc (arm-linux-gnueabi-gcc)
arm cc file is symbolic link
arm-linux-gnueabihf-gcc -> arm-linux-gnueabihf-gcc-4.8.2
and error occurred ...
gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc: Command not found
what should I do ?
Docker file contents is below
Ubuntu as base image
FROM ubuntu:12.04
MAINTAINER ...
update ubuntu image
RUN apt-get update
install essential package
RUN apt-get -y install vim
RUN apt-get -y install wget
RUN apt-get -y install bzip2
RUN apt-get -y install git
RUN apt-get -y install patch
RUN apt-get -y install make
RUN apt-get -y install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential udev
set environment variable so I know I'm in a container
ENV ARM_CROSS_COMPILER TRUE
End Dockerfile
SOLVED
my machine is 64-bit and armcc executable is 32-bit.
when i was execute it on native linux, not occurs problem.
but on docker, error occurred. i tried 64-bit compiler execution, well
running.

How to install the latest version of octave in ubuntu 14.04

sudo apt-get build-dep octave is not working. The error message is "E: Build-Depends dependency for octave cannot be satisfied because the package automake cannot be found". I have modified the /etc/apt/sources.list file with deb replaced by deb-src. Even when I try sudo apt-get install octave, an error is displayed that the package is not located.
Octave packages http://wiki.octave.org/Octave_for_Debian_systems
Many Octave packages are also distributed by your Linux distribution. These are tested to work the best with your Octave version. For example:
sudo apt-get install octave-control octave-image octave-io octave-optim octave-signal octave-statistics
Octave's Personal Package Archive (PPA) for Ubuntu
sudo apt-add-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave
Or
sudo apt-get autoclean
You can also Try with
wget ftp://ftp.gnu.org/gnu/octave/octave-4.0.0.tar.bz2
tar -xvf octave-4.0.0.tar.bz2
cd octave-4.0.0
./configure
make
sudo make install
More version are available at ftp://ftp.gnu.org/gnu/octave
Or
Adding a line to your /etc/apt/sources.list
amd64: http://packages.ubuntu.com/trusty/amd64/libgraphicsmagick3/filelist
i386: http://packages.ubuntu.com/trusty/i386/libgraphicsmagick3/download

Resources