How to install libbz2 in cross compiler g++-arm-linux-gnueabifh on Ubuntu 14.04 - c++

I am using arm-linux-gnueabihf-g++-4.8 on an amd64 machine to cross compile boost targeting ARM 32-bit architecture. My OS is Ubuntu 14.04.
It fails to build lib libboost_iostreams because libbz2 does not comes with the compiler. Following is the error detail,
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status.
Having a hard time figure out how to install this libbz2 for arm-linux-gnueabihf-g++-4.8. Did not find much document online. Need some help. Thank you very much!

I'd install libbz2-1.0:armhf from Debian jessie repository.
Actually, it is present in the Ubuntu repositories too.
Configure package manager to manage ARM packages:
sudo dpkg --add-architecture armhf
Ubuntu 14.04 codename is 'trusty', so add ARM repositories for trusty by adding the line to the /etc/apt/sources.list file:
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports trusty main
Then update package index:
sudo apt-get update
Install libbz2 for ARM (but abort if it asks to remove any packages):
sudo apt-get install libbz2-1.0:armhf
If apt-get asks to remove half of the system in order to install something big like libc6:armhf, libgcc:armhf, build-essential:armhf etc. then there is a dependency resolution session ahead. There is no precise guide to that.
Also, one minor thing: you may want to add [arch=amd64,i386] annotations to all other repositories in /etc/apt/sources.list to avoid warnings.

Related

How to build g++ 10/C++20 on WSL2?

I would like to try out the new features of C++20 on Windows 10 & WSL2. Since my ubuntu on WSL2 was very old (16), I followed these instructions:
sudo apt update -y # makes apt system itself up-to-date
sudo apt dist-upgrade -y # updates Ubuntu 18.04 packages to latest
sudo do-release-upgrade # performs the upgrade to Ubuntu 20.04
Midway thru these directions for building g++ 10, I execute
contrib/download_prerequisites
and I get this error:
error: You must run this script in the top-level GCC source directory
The problem line of code seems to be
[ -e ./gcc/BASE-VER ] \
|| die "You must run this script in the top-level GCC source directory"
The problem is that while there is a gcc directory, there is no BASE-VER directory.
Is there a better set of instructions I should use? Is there a bug in this script?
Thanks
Siegfried
Being unfamiliar with WSL2 I cannot be sure, but this looks to me like...
[ -e ./gcc/BASE-VER ] should be referring to gcc/$BASE_VER or some such. Does it look like such a directory exists?
Also those apt commands updated you to version 18.04 of Ubuntu. do-release-upgrade goes one version at a time, roughly speaking. Assuming (?) you are on a LTS release (16.04) it will bump yu up one major version to the 18.04 version (major version numbers are even - a fact I only just noticed and I have been using Ubuntu since vit started....)

Cannot install llvm-9 or clang-9 on Ubuntu 16.04

I have not been able to install either llvm version 9 or clang version 9 on Ubuntu. We have installed them on Windows.
I have tried a command and saw this response.
sudo apt-get install llvm-9
Reading package lists... Done
Building dependency tree
Reading state information...
Done E: Unable to locate package llvm-9
I have also tried and saw this response.
sudo apt-get install clang-9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package clang-9
My /etc/apt/sources.list file contains
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9.0 main
I found the website and saw that the folder was llvm-toolchain-xenial-9. Trying that version did not work either.
What else can I do?
I have looked at downloading the binaries but am not sure what installation steps I might be missing. I am not interested in compiling source code.
The Clang/LLVM project provides Nightly build packages for Ubuntu and Debian.
See the https://apt.llvm.org
The goal is to provide Debian and Ubuntu [Clang and LLVM] packages ready to be installed with minimal impact on the distribution.
Packages are available for amd64 and i386 (except for recent Ubuntu) and for both the stable, old-stable and development branches (currently 8, 9 and 10).
Packages are built using stage2 and extremely similar to the one shipping in Debian & Ubuntu.
To use:
Add the appropriate repositories to the /etc/apt/sources.list file; there are distinct repos for different Debian and Ubuntu versions.
Add the apt key (shown in the link).
Run an apt update to refresh the cache.
Add packages with apt install clang-9 (or other package as desired).
If something "did not work" using the vetted package system, diagnose that issue directly. Xenial has Clang/LLVM 9 packages, and I've recently installed the packages into Disco.
The described symptom ("Unable to locate package") sounds as though one neglected to run apt update, in which case the packages from the newly-added sources would not be visible to apt. This is a tool-usage issue, not a lack of available packages.
LLVM INSTALLATION STEPS
-----------------------
LLVM Compiler Prerequisites:
OPERATING SYSTEM : Ubuntu 16.04 LTS
RAM : Minimum 16GB to 32GB
SWAP MEMORY : Minimum 10GB to 20GB
MEMORY NEEDED : Minimum 70GB
Install CMake version 3.5.1:
$sudo apt install cmake
LLVM Compiler Installation Steps
Step1:
#download llvm from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
#download clang from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
#extract files into folders:
tar -xf cfe-8.0.1.src.tar.xz
tar -xf llvm-8.0.1.src.tar.xz
#change directory names to llvm8 and clang
mv cfe-8.0.1.src clang
mv llvm-8.0.1.src llvm8
Step2 : #change present working directory to llvm_source_directory here it is llvm8
$cd llvm8
##create build directory
$mkdir build
##change pwd to build directory
$cd build
#Build (PATH =/llvm8/build)
#execute following command in build directory:
$cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../
Step3: #execute make command in pwd:
/llvm8/build$ make
Step4 : #after 100% of linking process execute following command in build directory:
$sudo make install
$ sudo reboot
step5 : #after installation restart your system!
#for checking llvm installation type
$llvm-config --version #it shows 8.0.1
$clang --version #it shows 8.0.1
Here are the commands for LLVM 9:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-9 libclang-9-dev llvm-9-dev

Installing g++ 7.0.1 on Debian 8.7

I have been trying for quite some time to install g++ 7 on my Debian machine. I was able to install it quite easily on my mac (as homebrew had a formula for it). However I cannot seem to find a way to install it on Linux.
This individual had a thread on installing g++ 4.9, and changing the url he gave led me to this page, which seems to be in the right direction... But I imagine installing it this way might lead to a few potential problems down the road when I wish to update these packages.
Is there a source I'm missing? Or is there maybe a place where I can download and compile everything I need to get it running?
Thank you for your help.
Helpful Data:
My kernel is x86_64 Linux 3.16.0-4-amd64.
Edit: After following Dietrich's advice, I am now met with a new error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc-7 : Depends: cpp-7 (= 7-20170316-1) but it is not going to be installed
Depends: libcc1-0 (>= 7-20170316-1) but it is not going to be installed
Depends: binutils (>= 2.28) but 2.25-5+deb8u1 is to be installed
Depends: libgcc-7-dev (= 7-20170316-1) but it is not going to be installed
Depends: libisl15 (>= 0.15) but it is not installable
Depends: libmpfr4 (>= 3.1.3) but 3.1.2-2 is to be installed
Depends: libstdc++6 (>= 5) but 4.9.2-10 is to be installed
E: Unable to correct problems, you have held broken packages.
This is how my sources.list is set up:
#------------------------------------------------------------------------------#
# OFFICIAL DEBIAN REPOS
#------------------------------------------------------------------------------#
###### Debian Main Repos
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free
###### Debian Update Repos
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free
###### For ffmpeg
deb http://www.deb-multimedia.org jessie main non-free
###### For gcc-7 (Experimental)
deb http://httpredir.debian.org/debian experimental main
I'm guessing this is, as you said, a problem with me being on Debian stable? What would I need to do in order to fix this error, while remaining on stable?
Edit 2: Okay, so I figured out that last error. I just had to add go through for every individual dependency that gave my trouble and install it using apt-get install -t testing . Thank you to everyone who replied. You were all very helpful.
You can find similar in the Stack Overflow Unix pages
To install the newest g++ from testing on debian, do the following:
Add debian testing repo to your apt sources by creating a file (with .list extension) on /etc/apt/sources.list.d folder containing the line
deb http://ftp.us.debian.org/debian testing main contrib non-free
Instruct debian to use testing sources on certain packages by creating a file on /etc/apt/preferences.d containing the following:
Package: *
Pin: release a=testing
Pin-Priority: 100
You should name the file something like preferences or testingpref,etc. If you have a preferences file, you can add it there. Remove the .unused or any . in the filename.
Update database:
sudo apt-get update
Install g++:
sudo apt-get install -t testing g++
This will give you the most recent version of g++ in the repo. Thus it will receive updates and more-easily reversable. You need to use -t testing to get most recent versions.
You may have dependency issues. It may be in experimental instead of testing for your architecture. See https://packages.debian.org/search?keywords=g%2B%2B
For experimental packages (7 is in there) add:
deb http://httpredir.debian.org/debian experimental main
to /etc/apt/sources.list . Similar to above.. pinning should say a=experimental instead of a=testing and lastly,
sudo apt-get install -t experimental g++
Good luck.
The kernel is irrelevant.
GCC 7 has not been released yet, as you can see in the GCC 7 release notes:
Disclaimer: GCC 7 has not been released yet, so this document is a work-in-progress.
You may want to learn about what makes different Linux distros different. In particular, what a rolling distribution is, and how Debian releases work. In a rolling distribution, all of the packages continually get updated to newer versions. Debian 8.7 (Jessie / stable) is not a rolling distribution. The packages versions are frozen and only updated when necessary, for extra stability. The latest version of GCC on Debian 8.7 is GCC 4.9.
Debian 9.0 (Stretch / testing) is a rolling release, at least until it gets frozen. If you switch your computer to Stretch you will get GCC 6.3.
If you need something newer, you can either switch to Sid (unstable), or pin packages from Sid.
However, GCC 7 is only available in experimental because it hasn't been released yet. You can install a single package from experimental if you like, see Debian Experimental for instructions.
Howto
Add to your /etc/apt/sources.list
https://wiki.debian.org/DebianExperimental
Then
apt-get update
apt-get -t experimental install gcc-7
From the page you must download the g++7 for amd64 deb file. Then, as root, run the following command.
dpkg -i file.deb

Installing gcc on linux

How to install gcc version 4.8 on centos or scientific linux operating systems which require yum for installing.
I tried to download gcc from https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/ and then ran ./configure and then make. After running make it gives me the error: configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Is there some way by which I may install gcc version 4.8 on linux using yum install
I tried:
1). I tried with yum --enablerepo=testing-2-devtools-6 install devtoolset-2-gcc devtoolset-2-gcc-c++ it gives me repository not found
2). yum group install "Development Tools". It gives me Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
3). building it from scratch, you'll have to do ./contrib/download_prerequisites first to get MPFR, GMP and MPC in the GCC source tree, then make a separate directory and run /path/to/gcc/source/configure.
It gives:
configure: error: building out of tree but /home/Softwares/gcc-4.8.2
contains host-x86_64-unknown-linux-gnu
https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3/html/3.0_Release_Notes/DTS3.0_Release.html#Features
Install the Red Hat Developer Toolset 3.0 (or 2.X) in a way similar to what is described here. (Basically you use a repo someone else built for CentOS).
Google says to try
yum group install "Development Tools"
check out: http://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/

Link error: "Cannot find -ltinfo" on Ubuntu 12.04 on a 32-bit arm processor

I get the following link error when I'm compiling a small function using ncurses for an Ubuntu 12.04 running on arm. The error is
arm-linux-gnueabihf/bin/ld: cannot find -ltinfo
A lot of hints are floating around on what to install, but I can't seem to find any packages that does the trick for my arm box.
I have done
sudo apt-get install libncurses5-dev
And this does not contain the tinfo library. Other suggestions usually result in the library is "not available but referred by another package" or "has no installation candidate".
All help is appreciated
/Henrik
As mentioned by lucasg
sudo apt-get install libtinfo-dev
solved the same problem for me.
When you cross compile the nurses library, configure this option --with-termlib. It shall install libtinfo into your target location.