Bitbucket pipeline installing the wrong version of cmake - linux

When I apt-get install cmake in my Bitbucket pipeline, it installs version 3.0.2. This then leads to an error "CMake 3.7.2 or higher is required. You are running version 3.0.2". How can I install cmake version 3.7.2 or higher in my .yml?
bitbucket-pipelines.yml
image: gcc:6.5
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- apt-get update && apt-get -y install cmake
- cmake -B build .
Error:
+ cmake -B build .
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.7.2 or higher is required. You are running version 3.0.2

This isn't really a pipelines issue. I'll walk through the troubleshooting process to identify the problem and a possible solution. You could pursue other solutions to install your desired version but hopefully following the approach here will help you in future.
Full disclosure, I work for Atlassian - though not on the Bitbucket Pipelines team :)
The version of cmake that you see being installed is actually related to the third party base image you're using, gcc:6.5. You can test/verify this on your own machine:
$ docker run --rm -it gcc:6.5 bash
root#77d4fde67119:/# apt-get update && apt-get -y install cmake
root#77d4fde67119:/# cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
We can see the gcc:6.5 image is based on Debian Jessie:
root#77d4fde67119:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
If you look up the default cmake package for Jessie you'll find that it's v3.0.2: https://packages.debian.org/jessie/devel/cmake
A little more digging will show you that newer Debian versions package newer versions of cmake by default: Stretch or Buster will package 3.7 or 3.13 respectively. So the solution to your issue is using a newer version of the gcc base image based on a more recent Debian version:
Let's try it again with the gcc:7 base image:
$ docker run --rm -it gcc:7 bash
root#26e82f7b5e56:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
Well, that's a good sign: gcc:7 is based on Debian Buster. Buster ships 3.13: https://packages.debian.org/buster/devel/cmake
root#26e82f7b5e56:/# apt-get update && apt-get -y install cmake
root#26e82f7b5e56:/# cmake --version
cmake version 3.13.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
There you have it: a version above 3.7.
If you can't use this version of gcc, of course, you'll need to look at a different solution. But hopefully this helps to illustrate the source of your issue and how you can investigate these kinds of issues in future.

Related

Rust Linux version glibc not found - compile for different glibc / libc6 version

I compile a Rust binary on one Linux system and try to run it on another. When I run the program I get:
./hello-rust: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./hello-rust)
GLIBC aka libc6 is installed on the system, however, the version is 2.31 Is there a way to compile the program for a less recent version of libc6?
Per the issue: https://github.com/rust-lang/rust/issues/57497 - there's no way to tell the Rust compiler to link a different library other than the one installed on the system.
This means I have to compile the binary on a system that has a less recent version of libc6 installed - then the binary should be compatible with the same version of libc6, or a more recent version*
The most convenient way of doing that would by using a Docker image that has the target libc6 version and rustup.
For myself, the official Rust docker image had the correct version I could use to compile for my target.
In the working directory:
sudo docker pull rust
sudo docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp rust cargo build --release
If the official image, which is based on Debian does not satisfy the version requirement, you will have to create a custom docker image, i.e.:
fork the official Rust docker image and set it to use an older version of Debian
or create an image that is based on an older Debian or other Linux distro image and configure it to install rustup
* I could use a binary compiled with libc6 2.31 on a system that has libc6 2.32 - I'm not sure how far backwards compatibility goes.
If you want a simple way of doing it, try the cross project. It requires Docker, but is super easy.
cargo install cross --git https://github.com/cross-rs/cross
Make sure your user can run Docker:
sudo usermod -aG docker ${USER}
Then, for example, if you want to compile for armv6l arch:
cross build --target arm-unknown-linux-gnueabihf --release
If you want to compile for armv7l:
cross build --target armv7-unknown-linux-gnueabihf --release
The compiled file will be placed in the usual target/armv7-unknown-linux-gnueabihf/release/... folder.
Make sure to check the proper destination arch in the targeted system with the command arch. Example:
pi#raspberrypi:~ $ arch
armv6l

ncl: /lib/x86_64-linux-gnu/libssl.so.10: version `libssl.so.10' not found (required by ncl)

This is in reference to running the WRF model in my system. I am trying to run the file plotgrids.ncl to ensure that the domain is in the right location before running geogrid.exe . Running the following command in my terminal(ubuntu)
ncl util/plotgrids.ncl
gives me the following error:
ncl: /lib/x86_64-linux-gnu/libssl.so.10: version 'libssl.so.10' not found (required by ncl)
ncl: /lib/x86_64-linux-gnu/libcrypto.so.10: version 'libcrypto.so.10' not found (required by ncl)
at one NCL 6.4.0 installation at Ubuntu 10.10 the solution was
searching a compat-openssl10 package, as
compat-openssl10-1.0.2j-9.fc26.x86_64.rpm
turn it into a .deb package by doing this steps:
apt-get install libdpkg-perl
alien compat-openssl10-1.0.2j-9.fc26.x86_64.rpm
dpkg -i compat-openssl10_1.0.2j-10_amd64.deb
find / -name libssl.so.*
will now show it at /usr/lib/ libssl.so.10
NCL will still complain about GLIBC version
at this case that was solved by editing
vi /etc/apt/sources.list
:%s/maverick/wily/g
apt-get update
apt-get install libc6
this still shows as 2.15 with
ldd --version
however now the test works with
ng4ex xy01n -clean
for Ubuntu 16 please check help given by NCL forum at
mailman.ucar.edu/pipermail/ncl-install/2017-November/thread.html
as resumed here:
http://conda.pydata.org/miniconda.html
used Python 3.6 Linux 64-bit (bash installer)
cd /home/user/Downloads/
chmod +x Miniconda2-latest-Linux-x86_64.sh
./Miniconda2-latest-Linux-x86_64.sh
conda -V
conda 4.3.30
http://ncl.ucar.edu/Download/conda.shtml
conda create -n ncl_stable -c conda-forge ncl=6.4.0 gsl
root#hostname:~# source activate ncl_stable
(ncl_stable) root#hostname:~# ncl -V
6.4.0
ng4ex xy05n -clean -W png
it works!
outside conda (ncl_stable)
ng4ex
The program 'ng4ex' is currently not installed. You can install it by:
sudo su
vi /etc/apt/sources.list
add at the end
deb http://http.us.debian.org/debian/ testing non-free contrib main
exit editor
apt-get update
apt install libncarg-bin

Error when connecting Azure IoT Suite with Raspberry Pi

I am attempting to link my Raspberry Pi to my Azure IoT suite using this tutorial.
I get these errors when entering the following code into my terminal:
cd ~/azure-iot-sdks/
sudo ~/azure-iot-sdks/c/build_all/linux/setup.sh
chmod +x ~/azure-iot-sdks/c/build_all/linux/build.sh
~/azure-iot-sdks/c/build_all/linux/build.sh
Any help is appreciated, as I cannot wait to connect my Pi to Azure!
I've verified the tutorial works on various environments,
Host: Ubuntu 14.04, gcc version 4.8.4, cmake version 2.8.12.2, build succesfully.
Host: Ubuntu 14.04, gcc version 4.9.3, cmake version 2.8.12.2, build succesfully.
Host: Ubuntu 14.04, gcc version 4.9.3, cmake version 3.3.2, build succesfully.
Host: Bash On Ubuntu On Windows, gcc version 4.8.4, cmake version 2.8.12.2, build succesfully.
Interesting thing is although gcc(>=4.9) and cmake(>=3.0) is recommended per this page, I found gcc 4.8 and cmake 2.8 also works find with this tutorial.
Anyway, you need to make sure you follow the steps thoroughly,
Clone iot-hub-c-raspberrypi-getstartedkit and WiringPi repositories, with the --recursive parameter.
Go to WiringPi and do ./build. This step is not mentioned in the tutorial but I found it necessary.
Make sure you have all the tools installed,
sudo apt-get install curl libcurl4-openssl-dev uuid-dev uuid g++ make cmake git unzip openjdk-7-jre libssl-dev libncurses-dev subversion gawk
Build the source code,
cd ~/iot-hub-c-raspberrypi-getstartedkit/
sudo ~/iot-hub-c-raspberrypi-getstartedkit/azure-iot- sdks/c/build_all/linux/setup.sh
chmod +x ~/iot-hub-c-raspberrypi-getstartedkit/sample/build.sh
~/iot-hub-c-raspberrypi-getstartedkit/sample/build.sh
I've verified following the steps above, it builds successfully on various environments.

How do I install protobuf 2.5 on Arch Linux for compiling hadoop 2.6.0 using maven 3.3.1?

Am looking for installing protobuf 2.5.0 on Arch Linux, so that protoc-2.5.0.so is installed on the OS, so that I can go ahead with building hadoop 2.6.0 from source and make my life easy! :)
BTW, protobuf 2.6.0 does not compile when hadoop is built from source I have tried that as well. Ubuntu 14.04 comes with protoc 2.5.0. I DO NOT want to use Ubuntu.
Please check the screenshot first (there is no protobuf 2.5.0), since the problem lies there.. I guess
am getting the following exception, I am aware that protoc is not installed in arch linux currently.
[ERROR] Failed to execute goal
org.apache.hadoop:hadoop-maven-plugins:2.6.0:protoc (compile-protoc)
on project hadoop-common:
org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did
not return a version -> [Help 1]
Please help me out, since, I have spent 4 hours every day from two days, with no luck.
Compiling Google's protobuf is pretty easy.
I originally found out how to do it on this blog post while compiling hadoop myself.
But here is my version:
$ cd /usr/local/src/
$ wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
$ tar xvf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ make install
$ protoc --version
Install protobuf for java
$ cd java
$ mvn install
$ mvn package
You should be good to go.
To enable you to install different versions of protobuf, install stow
then change ./configure --prefix=/usr to ./configure --prefix=/usr/local/stow/protobuf-2.5.0
Then link protobuf into your system with stow:
$ cd /usr/local/stow
$ stow protobuf-2.5.0
Note: stow uses /usr/local/bin by default. Make sure thats in your $PATH
To unlink that version of protobuf,
$ stow -D protobuf-2.5.0
Hope this helped.
I wonder why the above answer got downvoted,even I had to perform few more steps (in addition to the accepted answer by Rudker) to get protobuf 2.5 installed on Ubuntu Xenial.
Leaving the additional steps here for everyone's benefit:
apt-get install autoconf in response to the error : ./autogen.sh: autoreconf: not found for command : ./autogen.sh
apt-get install libtool in response to the error : autoreconf: libtoolize is needed because this package uses Libtool for command : ./autogen.sh
apt install g++ in response to the error : configure: error: C++ preprocessor "/lib/cpp" fails sanity check for command : ./configure --prefix=/usr
An easier but not future proof solution (for future queries) would be to head over to Arch Linux Archives: http://seblu.net/a/archive/packages/p/protobuf/
Uninstall the newer version of protobuf and install the downloaded package via pacman -U protobuf-2.5.x..
Though whenever you upgrade the Arch Linux packages via pacman you'd need to ensure you are doing: sudo pacman -Syu --ignore protobuf
I currently don't have enough reputation to comment, so I add a answer here to update the top voted answer.
Since protobuf move to different repo, the new wget command should be:
wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
And in order to run ./autogen.sh, you may need install these:
sudo yum install libtool automake autoconf
For OSX prerequisites, try SunitaKoppar's answer (I don't know why the down-votes).
Thanks for the steps. Just wanted to add that, to get autogen.sh to work, I had to install the below packages (commands for mac below):
brew install gtk
brew install autoconf
brew install automake

Dart throwing errors on linux: GLIBC_2.14 GLIBC_2.15 not found

I'm running Debian 7.2 on Google Compute Engine (Though I suspect Centos, Red Hat, and Amazon Linux AMI all have the same problem). After downloading the 64-bit Linux version of the Dart SDK from this page, any dart command I run, for example, dart --version, will output the following error:
./editor/dart/dart-sdk/bin/dart: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by ./editor/dart/dart-sdk/bin/dart)
./editor/dart/dart-sdk/bin/dart: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./editor/dart/dart-sdk/bin/dart)
Update: October 2014: Dart can now be installed on Debian with apt-get:
Instructions summarized from the dart website:
# Enable HTTPS for apt.
sudo apt-get update
sudo apt-get install apt-transport-https
# Get the Google Linux package signing key.
sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
# Set up the location of the stable repository.
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
# Finally, install the dart package!
sudo apt-get install dart
Instructions for building the binary yourself:
This problem appears to be caused by Google compiling against an edge version of GLIBC (>= 2.15) which is not generally supported on Linux outside of Ubuntu 12 (Precise Pangolin).
First of all, do not attempt to download an experimental version of GLIBC or EGLIBC. I was able to get dart to work using that method, but the rest of my machine fell apart. Updating GLIBC is a recipe for madness.
Instead, the best solution is building dart from source. Despite the GLIBC version requirements of the binary, the source itself has no such requirements. There are wiki pages for installing from source on debian, centos/fedora/red hat/amazon, ubuntu, and other linux versions.
Here is an overview of those steps, which I can confirm works on Debian 7.2. The centos/fedora/redhat steps appear to be the same except they use yum instead of apt-get.
Install subversion and the required build tools:
sudo apt-get -y update
sudo apt-get -y install subversion
sudo apt-get -y install make
sudo apt-get -y install g++
sudo apt-get -y install openjdk-6-jdk
Check out google's depot tools and add gclient to your path
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=$PATH:`pwd`/depot_tools
Download the dart source at the desired branch.
Replace 1.2 with whatever branch you wish to build. You can see a list of available versions here. In general, the latest numbered branch is best.
gclient config http://dart.googlecode.com/svn/branches/1.2/deps/all.deps
gclient sync
gclient runhooks
Move into the new dart directory
cd dart
Do only A or B below:
Note: For 32bit, use the --arch=ia32 flag instead.
A. Build the entire Dart SDK including pub, dart2js, dart, etc.:
tools/build.py --mode=release --arch=x64 create_sdk
B. Build just the dart executable:
tools/build.py --mode=release --arch=x64 runtime
The dart executable is now at either out/ReleaseX64/dart or out/ReleaseX64/dart-sdk/bin/dart you can do a smoke test by printing the version
dart/out/ReleaseX64/dart --version
The output should be something like Dart VM version: 1.2.0 (Mon Mar 3 03:06:20 2014) on "linux_x64".
How to help fix this issue
This was much more painful than it needed to be, since the binary clearly doesn't need to be built using GLIBC >= 2.15. If you wish to draw attention to this issue, please star this dart bug.

Resources