libtool directory argument does not work - bash

In qemu I use below command to install tools such as qemu-ga.exe,
but the problem is libtool does not accept its directory argument correctly.
If I run the command like this,
msdperera#msdperera-PC MSYS /qemu
$ libtool --quiet --mode=install install -c -m 0755 qemu-ga.exe qemu-img.exe qemu-io.exe "/c:/Program Files/QEMU"
install: target 'Files/QEMU/qemu-ga.exe' is not a directory
what is the correct format for the directory argument?

Related

Docker gives `no such file or directory` on `docker run <image_id>`

So I've just created my very first docker image (woohoo) and was able to run it on the original host system where it was created (Ubuntu 20.04 Desktop PC). The image was executed using docker run -it <image_id>. The expected command (defined in CMD which is just a bash script) was run, and the expected output was seen. I assumed this meant I successfully created my very first docker image and so I pushed this to Docker Hub.
Docker Hub
GitHub repo with original docker-compose.yml and Dockerfile
Here's the Dockerfile:
FROM ubuntu:20.04
# Required for Debian interaction
# (https://stackoverflow.com/questions/62299928/r-installation-in-docker-gets-stuck-in-geographic-area)
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /home/benchmarking-programming-languages
# Install pre-requisites
# Versions at time of writing:
# gcc -- version (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
# make -- GNU Make 4.2.1
# curl -- 7.68.0
RUN apt update && apt install make build-essential curl wget tar -y
# Install `column`
RUN wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.35/util-linux-2.35-rc1.tar.gz
RUN tar xfz util-linux-2.35-rc1.tar.gz
WORKDIR /home/benchmarking-programming-languages/util-linux-2.35-rc1
RUN ./configure
RUN make column
RUN cp .libs/column /bin/
WORKDIR /home/benchmarking-programming-languages
RUN rm -rf util-linux-2.35-rc1*
RUN apt install python3 pip -y
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt install default-jdk-headless -y
RUN apt install rustc -y
# Install GoLang
RUN wget https://go.dev/dl/go1.17.8.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.8.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
# Install Haxe and Haxelib
RUN wget https://github.com/HaxeFoundation/haxe/releases/download/4.2.5/haxe-4.2.5-linux64.tar.gz
RUN tar xfz haxe-4.2.5-linux64.tar.gz
RUN ln -s /home/benchmarking-programming-languages/haxe_20220306074705_e5eec31/haxe /usr/bin/haxe
RUN ln -s /home/benchmarking-programming-languages/haxe_20220306074705_e5eec31/haxelib /usr/bin/haxelib
# # Install Neko (Haxe VM)
# RUN add-apt-repository ppa:haxe/snapshots -y
# RUN apt update
# RUN apt install neko -y
RUN if ! test -d /home/benchmarking-programming-languages; then mkdir /home/benchmarking-programming-languages && echo "Created directory /home/benchmarking-programming-languages."; fi
COPY . /home/benchmarking-programming-languages
RUN pip install -r /home/benchmarking-programming-languages/requirements_dev.txt
CMD [ "/home/benchmarking-programming-languages/benchmark.sh -v" ]
However, upon pulling the same image on my Windows 10 machine (same machine as above just dual booted) and a Windows 11 laptop using both the Docker Desktop application and the command line (docker pull mariosyian/benchmarking-programming-languages followed by docker run -it <image_id>). Both which give me the following error
Error invoking remote method 'docker-run-container': Error: (HTTP code 400) unexpected - failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/home/benchmarking-programming-languages/benchmark.sh -v": stat /home/benchmarking-programming-languages/benchmark.sh -v: no such file or directory: unknown
Despite this, running the image as a container with a shell (docker run -it <image_id> sh), I am successfully able to, not only see the file, but execute it with no errors! Can someone suggest a reason for why the error happens in the first place, and how to fix it?
In your Dockerfile you have specified the CMD as
CMD [ "/home/benchmarking-programming-languages/benchmark.sh -v" ]
This uses the JSON syntax of the CMD instruction, i.e. is an array of strings where the first string is the executable and each following string is a parameter to that executable.
Since you only have a single string specified docker tries to invoke the executable /home/benchmarking-programming-languages/benchmark.sh -v - i.e. a file named "benchmark.sh -v", containing a space in its name and ending with -v. But what you actually intended to do was to invoke the benchmark.sh script with the -v parameter.
You can do this by correctly specifying the parameter(s) as separate strings:
CMD ["/home/benchmarking-programming-languages/benchmark.sh", "-v"]
or by using the shell syntax:
CMD /home/benchmarking-programming-languages/benchmark.sh -v

The source directory does not appear to contain CMakeLists.txt

I would like to virtualize Android on my jetson nano using qemu + kvm + virglrenderer and I found these tutorials to accomplish the task :
this :
https://www.collabora.com/.../building-android-for-qemu.../
and this :
https://www.collabora.com/.../02/12/virtualizing-gpu-access/
so. on Ubuntu 20.10 I have added this script to the .bashrc file and I did : source ~/.bashrc
function add_export_env {
local VAR="$1"
shift
local VAL=$(eval echo "\$$VAR")
if [ "$VAL" ]; then
VAL=$(concatenate_colon "$#" "$VAL");
else
VAL=$(concatenate_colon "$#");
fi
eval "export $VAR=\"$VAL\""
}
function prefix_setup {
local PREFIX="$1"
add_export_env PATH "$PREFIX/bin"
add_export_env LD_LIBRARY_PATH "$PREFIX/lib"
add_export_env PKG_CONFIG_PATH "$PREFIX/lib/pkgconfig/" "$PREFIX/share/pkgconfig/"
add_export_env MANPATH "$PREFIX/share/man"
export ACLOCAL_PATH="$PREFIX/share/aclocal"
mkdir -p "$ACLOCAL_PATH"
export ACLOCAL="aclocal -I $ACLOCAL_PATH"
}
function projectshell {
case "$1" in
virgl | virglrenderer)
export ALT_LOCAL="/opt/local/virgl"
mkdir -p "$ALT_LOCAL"
prefix_setup "$ALT_LOCAL"
;;
esac
}
and I have also installed these packages :
sudo apt install autoconf gcc-aarch64-linux-gnu libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev libcap-dev libcap-ng-dev libcurl4-gnutls-dev libepoxy-dev libfdt-dev libgbm-dev libgles2-mesa-dev libglib2.0-dev libibverbs-dev libjpeg8-dev liblzo2-dev libncurses5-dev libnuma-dev librbd-dev librdmacm-dev libsasl2-dev libsdl1.2-dev libsdl2-dev libseccomp-dev libsnappy-dev libssh2-1-dev libtool libusb-1.0-0 libusb-1.0-0-dev libvde-dev libvdeplug-dev libvte-2.90-dev libxen-dev valgrind xfslibs-dev xutils-dev zlib1g-dev
and configured these paths :
export PROJECT_PATH="/opt/qemu_android"
export VIRGLRENDERER_PATH="${PROJECT_PATH}/virglrenderer"
export QEMU_PATH="${PROJECT_PATH}/qemu" export LINUX_PATH="${PROJECT_PATH}/linux"
export ANDROID_PATH="${PROJECT_PATH}/android"
export ANDROID_TOOLS_PATH="${PROJECT_PATH}/android-tools"
then :
git clone git://anongit.freedesktop.org/virglrenderer
root#aorus:/opt/qemu_android/virglrenderer# ls
ci docs perf-testing virglrenderer.pc.inconfig.h.meson meson.build src vtestCOPYING meson_options.txt tests
root#aorus:/opt/qemu_android/virglrenderer# ./autogen.sh
bash: ./autogen.sh: File or directory not found
I don't know how to compile it,since the classic way does not work (mkdir build ; cd build ; cmake ..) it says :
CMake Error: The source directory does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.
When you ran ls and saw the files in your virgilrenderer folder there isn't an ./autogen.sh but there is a meson.build
So let's try that.
sudo apt install build-essential
sudo apt install meson ninja-build
cd /opt/qemu_android/virglrenderer
meson compile
Once Meson is installed, and you are in the directory that the meson.build file is, you should be able to just run the meson compile command.
Official Docs for Meson

skip installing confirm('yes' or 'no') in Dockerfile [duplicate]

How do I install the anaconda / miniconda without prompts on Linux command line?
Is there a way to pass -y kind of option to agree to the T&Cs, suggested installation location etc. by default?
can be achieved by bash miniconda.sh -b (thanks #darthbith)
The command line usage for this can only be seen with -h flag but not --help, so I missed it.
To install the anaconda to another place, use the -p option:
bash anaconda.sh -b -p /some/path
AFAIK pyenv let you install anaconda/miniconda
(after successful instalation)
pyenv install --list
pyenv install miniconda3-4.3.30
For a quick installation of miniconda silently I use a wrapper
script script that can be executed from the terminal without
even downloading the script. It takes the installation destination path
as an argument (in this case ~/miniconda) and does some validation too.
curl -s https://gist.githubusercontent.com/mherkazandjian/cce01cf3e15c0b41c1c4321245a99096/raw/03c86dae9a212446cf5b095643854f029b39c921/miniconda_installer.sh | bash -s -- ~/miniconda
Silent installation can be done like this, but it doesn't update the PATH variable so you can't run it after the installation with a short command like conda:
cd /tmp/
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -u
Here -b means batch/silent mode, and -u means update the existing installation of Miniconda at that path, rather than failing.
You need to run additional commands to initialize PATH and other shell init scripts, e.g. for Bash:
source ~/miniconda3/bin/activate
conda init bash

Compile cygwin1.dll from its source code

I want to edit some code in cygwin1.dll for my project. So, I clone git repository from these two url:
https://github.com/mirror/newlib-cygwin.git
git://sourceware.org/git/newlib-cygwin.git
I've gcc, g++, make installed with cygwin and mingw-w64 (and also in WSL). But none of them generate DLL file. I also follow the commands ./configure & make. Command generates only object files. Is it possible to compile cygwin1.dll from its source code?
I had two different problems.
First, I followed the steps in cygwin FAQ: How do I build Cygwin on my own?. I forget to install mingww64_x86_64-gcc-g++ package. So, I installed those with the following commands:
setup-x86_64.exe -q -P gcc-g++ -P make -P perl -P cocom -P gettext-devel -P libiconv-devel -P zlib-devel
setup-x86_64.exe -q -P mingw64-x86_64-gcc-core -P mingw64-i686-gcc-g++ -P mingw64-i686-zlib
setup-x86_64.exe -q -P mingw64-x86_64-gcc-g++ -P mingw64-x86_64-zlib
Second, I logged the output from make command with make |& tee make.log. Thanks, #matzeri for the logging tip. Then I followed an error in make.log file as below:
../../.././winsup/cygwin/cygmagic: line 25: /usr/bin/awk: cannot
execute binary file: Exec format error
*** WARNING WARNING WARNING WARNING WARNING ***
*** ../../.././winsup/cygwin/child_info.h: magic number for
CHILD_INFO_MAGIC changed old 0xc96f5e9U != new
Somehow, the awk (hard linked with gawk) does not work in cygwin. So I installed awk package with setup-x86_64.exe. And now I can easily compile cygwin.dll.

Difference in details between "make install" and "make altinstall"

Here is my case:
I am using Ubuntu 10.04 (Lucid Lynx). The system's default Python is v2.6.5, but I need Python v2.7. So I downloaded the source from python.org and tried to install it.
The first time I installed it, I ran:
cd Python2.7.4
./configure --prefix=/usr
make
su root
make install
This installs Python 2.7 to my system. It will create a link, "python", in /usr/bin linking to python2.7 also in /usr/bin. So when I type >python, the system will start Python 2.7.4 for me just like when I type >python2.7.
But when I install this way:
cd Python2.7.4
./configure --prefix=/usr
make
su root
make altinstall
The link "python" in /usr/bin still exists and links to python2.6 which is the default system version. Of course, I can remove it and create a new soft link linking to python2.7.
What is the difference between the command "make install" and "make altinstall", except for the link in /usr/bin?
Let's take a look at the generated Makefile!
First, the install target:
install: altinstall bininstall maninstall
It does everything altinstall does, along with bininstall and maninstall
Here's bininstall; it just creates the python and other symbolic links.
# Install the interpreter by creating a symlink chain:
# $(PYTHON) -> python2 -> python$(VERSION))
# Also create equivalent chains for other installed files
bininstall: altbininstall
-if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
else true; \
fi
(cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))
-rm -f $(DESTDIR)$(BINDIR)/python2$(EXE)
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))
... (More links created)
And here's maninstall, it just creates "unversioned" links to the Python manual pages.
# Install the unversioned manual pages
maninstall: altmaninstall
-rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
-rm -f $(DESTDIR)$(MANDIR)/man1/python.1
(cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)
TLDR: altinstall skips creating the python link and the manual pages links, install will hide the system binaries and manual pages.
Simply: The altinstall target will make sure the default Python on your machine is not touched, or to avoid overwriting the system Python.

Resources