dotnet --version can't find GLIBCXX_3.4.21 - centos7

I installed .donet core and code under CentOS 7 but I get this error:
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkID=816869
sudo mkdir -p /opt/dotnet && sudo tar xvf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
curl -sSL -o code.el7.x86_64.rpm https://go.microsoft.com/fwlink/?linkID=760867
sudo yum localinstall code.el7.x86_64.rpm
dotnet --version
dotnet: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by dotnet)

Related

How to install brew into a Dockerfile (`brew: not found`)

Rather than necro-post on a two-year old thread, I decided to create a new question.
I want add brew (homebrew) to a Docker container, but I get a brew: not found error.
The suggested solution in that previous article doesn't seem to work. This new Dockerfile...
FROM rust:1.63.0-buster
WORKDIR app
RUN apt-get update && \
apt-get install -y -q --allow-unauthenticated \
git \
sudo
RUN useradd -m -s /bin/zsh linuxbrew && \
usermod -aG sudo linuxbrew && \
mkdir -p /home/linuxbrew/.linuxbrew && \
chown -R linuxbrew: /home/linuxbrew/.linuxbrew
USER linuxbrew
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
USER root
RUN chown -R $CONTAINER_USER: /home/linuxbrew/.linuxbrew
RUN brew install hello
gives this error... What am I missing? Thanks.
=> ERROR [6/6] RUN brew install hello 0.2s
------
> [6/6] RUN brew install hello:
#9 0.181 /bin/sh: 1: brew: not found
------
executor failed running [/bin/sh -c brew install hello]: exit code: 127
This Dockerfile installs brew in /home/linuxbrew/.linuxbrew/bin/brew. Including that directory in the path (with the ENV command) does the trick.
...
ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"
RUN brew install hello

X DevAPI mysqlx::Session() over linux socket fails with “CDK Error: unexpected message”

I’ve (3) freshly installed mysql, (4) freshly installed Connector/C++ 8.0 X DevAPI, (5) did minimal configuration in my.cnf, (1) wrote a minimal C++ program, (2) build it, and after executing it gave the following output:
$ sudo bin/sql
[sudo] password for xxxxxx:
CDK Error: unexpected message
But when I use mysql it connects properly:
$ sudo mysql --socket /var/run/mysqld/mysqld.sock -u root
<…>
Server version: 8.0.22 MySQL Community Server – GPL
<…>
mysql>
In my imagination, my minimal C++ program is doing the same the mysql client application is doing, but apparently not. What am I doing wrong here?
Below are some details which have been referred to in my opening sentence.
(1) The minimal C++ program:
#include <iostream>
#include <stdexcept>
#include <mysqlx/xdevapi.h>
int main()
{
try
{
mysqlx::Session sess("mysqlx://root#%2Fvar%2Frun%2Fmysqld%2Fmysqld.sock");
}
catch(std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
(2) Build with:
g++ -std=gnu++17 -I/usr/include/mysql-cppconn-8 sql.cpp -lstdc++fs -lmysqlcppconn8 -o bin/sql
chmod u+x bin/sql
(3) I’ve installed mysql:
<download from https://dev.mysql.com/downloads/repo/apt/>
$ sudo dpkg -i ~/Downloads/mysql-apt-config_0.8.16-1_all.deb
$ sudo apt-get update
$ sudo apt-get install mysql-server
<leave pwd blank>
$ systemctl status mysql
<active (running)>
$ mysql -V
mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
(4) Installed Connector/C++ 8.0 X DevAPI (when I recall correctly)
<download from https://dev.mysql.com/downloads/connector/cpp/>
<chose Ubuntu Linux>
<Chose Ubuntu Linux 20.04 (x86, 64-bit)
<downloaded libmysqlcppconn8-2_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn8-2_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn8-2
<downloaded libmysqlcppconn8-2-dbgsym_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn8-2-dbgsym_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn8-2-dbgsym
<downloaded libmysqlcppconn-dev_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn-dev_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn-dev
<downloaded libmysqlcppconn7_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn7_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn7
<downloaded libmysqlcppconn7-dbgsym_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn7-dbgsym_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn7-dbgsym
(5) Configured my.cnf and added [client] and socket
$ sudo vi /etc/mysql/my.cnf
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<…>
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[client]
socket = /var/run/mysqld/mysqld.sock
<save>
$ systemctl stop mysql
$ systemctl start mysql
$ systemctl status mysql
<active (running)>
Let me answer my own question in the form of a recipe how to get the minimal program working from scratch. The numbers refer to the numbers in the question.
(3) Install mysql:
<download from https://dev.mysql.com/downloads/repo/apt/>
$ sudo dpkg -i ~/Downloads/mysql-apt-config_0.8.16-1_all.deb
$ sudo apt-get update
$ sudo apt-get install mysql-server
<leave pwd blank>
$ systemctl status mysql
<active (running)>
$ mysql -V
mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
(4) Install Connector/C++ 8.0 X DevAPI (in my case Ubuntu Linux 20.04)
<download from https://dev.mysql.com/downloads/connector/cpp/>
<chose Ubuntu Linux>
<Chose Ubuntu Linux 20.04 (x86, 64-bit)
<downloaded libmysqlcppconn8-2_8.0.22-1ubuntu20.04_amd64.deb>
<downloaded libmysqlcppconn8-2-dbgsym_8.0.22-1ubuntu20.04_amd64.deb>
<downloaded libmysqlcppconn-dev_8.0.22-1ubuntu20.04_amd64.deb>
<downloaded libmysqlcppconn7_8.0.22-1ubuntu20.04_amd64.deb>
<downloaded libmysqlcppconn7-dbgsym_8.0.22-1ubuntu20.04_amd64.deb>
$ sudo dpkg -i ~/Downloads/libmysqlcppconn8-2_8.0.22-1ubuntu20.04_amd64.deb
$ sudo dpkg -i ~/Downloads/libmysqlcppconn8-2-dbgsym_8.0.22-1ubuntu20.04_amd64.deb
$ sudo dpkg -i ~/Downloads/libmysqlcppconn-dev_8.0.22-1ubuntu20.04_amd64.deb
$ sudo dpkg -i ~/Downloads/libmysqlcppconn7_8.0.22-1ubuntu20.04_amd64.deb
$ sudo dpkg -i ~/Downloads/libmysqlcppconn7-dbgsym_8.0.22-1ubuntu20.04_amd64.deb
$ sudo apt-get update
$ sudo apt-get install libmysqlcppconn8-2
$ sudo apt-get install libmysqlcppconn8-2-dbgsym
$ sudo apt-get install libmysqlcppconn-dev
$ sudo apt-get install libmysqlcppconn7
$ sudo apt-get install libmysqlcppconn7-dbgsym
(5) Configured my.cnf and added [client] and socket
(5) Do not change my.cnf, it is not needed
(+) Create a user with all privileges and check the socket path
$ sudo mysql -u root
mysql> CREATE USER 'user'#'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'user'#'localhost';
mysql> FLUSH PRIVILEGES;
mysql> show variables like 'mysqlx_socket';
+---------------+-----------------------------+
| Variable_name | Value |
+---------------+-----------------------------+
| mysqlx_socket | /var/run/mysqld/mysqlx.sock |
+---------------+-----------------------------+
1 row in set (0.00 sec)
mysql> exit
<check:>
$ sudo mysql -u user -p
<first password is sudo password>
<second pass is sql password for user>
mysql> exit
(1) Write minimal C++ program (sql.cpp). Replace in above mysqlx_socket all '/' by '%2F':
#include <iostream>
#include <stdexcept>
#include <mysqlx/xdevapi.h>
int main()
{
try
{
// wrong: mysqlx::Session sess("mysqlx://root#%2Fvar%2Frun%2Fmysqld%2Fmysqld.sock"); replace d by x
mysqlx::Session sess("mysqlx://user:password#%2Fvar%2Frun%2Fmysqld%2Fmysqlx.sock");
}
catch(std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
(2) Build with:
g++ -std=gnu++17 -I/usr/include/mysql-cppconn-8 sql.cpp -lstdc++fs -lmysqlcppconn8 -o sql
chmod u+x sql
(+) Executing it should lead to no exceptions:
$ ./sql
$

clang --version permission denied error

I have installed the latest clang-6.0 using the instructions from here:
install latest clang (6.0) on Ubuntu 16.04 (xenial) / WSL. Basically, these are the steps:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
sudo apt-get update
sudo apt-get install -y clang-6.0
It was successful but while checking for the version I'm getting the following error
❯ clang --version
⏎
zsh: permission denied: clang
What's the issue here and how to resolve this?
The way you are installing, the clang binary is being installed at /usr/bin/clang-6.0. However, you are trying to run clang --version. This is likely to avoid clobbering in case you have multiple versions of clang installed.
You have 2 options:
Install clang without the version, apt-get install clang, which should still install clang 6 since it is in your package list.
Use the binary by the correct name, clang-6.0 --version
I tested this out using the following Dockerfile:
FROM ubuntu:16.04
# Install software we need to test
RUN apt-get update && apt-get install -y \
software-properties-common \
wget \
zsh
# Get clang-6.0 package
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
# Install clang-6.0 package
RUN apt-get update && apt-get install -y \
clang-6.0
# Default to shell
ENTRYPOINT ["zsh"]
I get the output:
# which clang
clang not found
# which clang-6.0
/usr/bin/clang-6.0

How to compile C code that is using kernel function in docker and use pci device in container?

I have a Makefile some C++ code that is using PCI device
all:
g++ -o executable main.cpp dragon.pb.cc -std=c++11 -O3 -I/usr/include/postgresql -I/usr/include/hiredis -lzmq -lprotobuf -lpthread -lpq -lhiredis
clean:
rm executable
And It have dependencies on this C library that is using kernel functions. Makefile for this libraby is
# dist and build are folders, not phony targets
.PHONY: all package clean
all: dragon.pb.cc dragon_pb2.py package
dragon.pb.cc: dragon.proto
protoc --cpp_out=. dragon.proto
dragon_pb2.py: dragon.proto
protoc --python_out=. dragon.proto
package: build
clean:
rm -f dragon.pb.*
rm -f dragon_pb*
rm -rf build
rm -rf dist
rm -f MANIFEST
And here is my Dockerfile
FROM ubuntu:14.04
ENV PG_MAJOR 9.3
RUN apt-get update
RUN apt-get install -y git make protobuf-compiler libhiredis-dev postgresql-server-dev-${PG_MAJOR}
RUN apt-get install -y g++
RUN apt-get install -y libzmq-dev
RUN apt-get install -y libprotobuf-dev
RUN apt-get install -y linux-headers-$(uname -r)
ADD deployment_key /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
RUN echo "StrictHostKeyChecking no" >> /root/.ssh/config
RUN echo >> /root/.ssh/config
RUN echo "Host bitbucket.org" >> /root/.ssh/config
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app/
RUN git clone git#bitbucket.org:opticsdevelopment/dragon-protocols.git
WORKDIR ./dragon-protocols
RUN make dragon.pb.cc
RUN cp ./dragon.pb.* ../
COPY . /usr/src/app
WORKDIR ../
RUN git clone git#bitbucket.org:opticsdevelopment/dragon-module.git
WORKDIR ./dragon-module
RUN make all
WORKDIR ../
RUN make
EXPOSE 5570
CMD ["dragon"]
The problem right now is in installing linux-headers. Somehow it can't find headers
E: Unable to locate package linux-headers-3.13.0-19-generic
E: Couldn't find any package by regex 'linux-headers-3.13.0-19-generic'
If your app can compile with any generic linux headers
In your Dockerfile change
RUN apt-get install -y linux-headers-$(uname -r)
to just
RUN apt-get install -y linux-headers-generic
or if you need the same specific one as your host system
why dont you just volume link this directory from host to the docker container with the -v?
on your host system:
sudo apt-get install linux-headers-$(uname -r)
Now you have the kernel headers here: /usr/src/linux-headers-$(uname -r)/include
now on your docker container run command, link that volume like
-v /usr/src/linux-headers-$(uname -r)/include:/usr/src/linux-headers-$(uname -r)/include

Homebrew Python not installing setuptools

This is all on an iMac OSX 10.9.2
When doing a Homebrew install of python2.7 everything appears to be creating correctly. However upon finishing and attempting anything with pip or easy_install I keep getting the following error:
$ pip install virtualenv
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I have tried uninstalling and reinstalling the Brewed python with the same results. I also ran the install with -v which produced the following:
==> Verifying python-2.7.6.mavericks.bottle.tar.gz checksum
==> Pouring python-2.7.6.mavericks.bottle.tar.gz
tar xf /Library/Caches/Homebrew/python-2.7.6.mavericks.bottle.tar.gz
==> Caveats
Python demo
/usr/local/share/python/Extras
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip
You can install Python packages with (the outdated easy_install or)
`pip install <your_favorite_package>`
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
==> Finishing up
ln -s ../Cellar/python/2.7.6/bin/smtpd2.py smtpd2.py
ln -s ../Cellar/python/2.7.6/bin/smtpd2.7.py smtpd2.7.py
ln -s ../Cellar/python/2.7.6/bin/smtpd.py smtpd.py
ln -s ../Cellar/python/2.7.6/bin/pythonw2.7 pythonw2.7
ln -s ../Cellar/python/2.7.6/bin/pythonw2 pythonw2
ln -s ../Cellar/python/2.7.6/bin/pythonw pythonw
ln -s ../Cellar/python/2.7.6/bin/python2.7-config python2.7-config
ln -s ../Cellar/python/2.7.6/bin/python2.7 python2.7
ln -s ../Cellar/python/2.7.6/bin/python2-config python2-config
ln -s ../Cellar/python/2.7.6/bin/python2 python2
ln -s ../Cellar/python/2.7.6/bin/python-config python-config
ln -s ../Cellar/python/2.7.6/bin/python python
ln -s ../Cellar/python/2.7.6/bin/pydoc2.7 pydoc2.7
ln -s ../Cellar/python/2.7.6/bin/pydoc2 pydoc2
ln -s ../Cellar/python/2.7.6/bin/pydoc pydoc
ln -s ../Cellar/python/2.7.6/bin/pip2.7 pip2.7
ln -s ../Cellar/python/2.7.6/bin/pip2 pip2
ln -s ../Cellar/python/2.7.6/bin/pip pip
ln -s ../Cellar/python/2.7.6/bin/idle2.7 idle2.7
ln -s ../Cellar/python/2.7.6/bin/idle2 idle2
ln -s ../Cellar/python/2.7.6/bin/idle idle
ln -s ../Cellar/python/2.7.6/bin/easy_install-2.7 easy_install-2.7
ln -s ../Cellar/python/2.7.6/bin/easy_install easy_install
ln -s ../Cellar/python/2.7.6/bin/2to3-2.7 2to3-2.7
ln -s ../Cellar/python/2.7.6/bin/2to3-2 2to3-2
ln -s ../Cellar/python/2.7.6/bin/2to3 2to3
ln -s ../Cellar/python/2.7.6/share/python python
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python2.7.1 python2.7.1
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python2.1 python2.1
ln -s ../../../Cellar/python/2.7.6/share/man/man1/python.1 python.1
ln -s ../../../Cellar/python/2.7.6/Frameworks/Python.framework/Versions/Current Current
ln -s ../../../Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7 2.7
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Resources Resources
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Python Python
ln -s ../../Cellar/python/2.7.6/Frameworks/Python.framework/Headers Headers
ln -s ../../Cellar/python/2.7.6 python
ln -s ../Cellar/python/2.7.6 python
==> Summary
🍺 /usr/local/Cellar/python/2.7.6: 3790 files, 59M
I noticed that the Homebrew Python page indicated that "brew install python" should create a site packages folder at '/usr/local/lib/python2.7/site-packages'. However when I navigate to '/usr/local/lib' and use 'ls -a' there are no folders pertaining to python.
brew doctor reports no errors
Thank you in advance and please let me know what additional information may be needed.
In case anyone else runs into this I did manage to find a solution from the following page:
https://github.com/Homebrew/homebrew/issues/27515
It is apparently a bug in this most recent build. Doing a
brew install python --with-brewed-openssl
appears to do the trick.
Tom