I cannot build and install QEMU for RISCV - qemu

I try to install the toolchain of QEMU for risc-v so I follow this tuto https://github.com/riscv/riscv-qemu/wiki but i get this error:
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ make install
CHK version_gen.h
install -d -m 0755 "/usr/local/share/doc/qemu"
install -c -m 0644 qemu-doc.html qemu-tech.html "/usr/local/share/doc/qemu"
install: impossible de supprimer '/usr/local/share/doc/qemu/qemu-doc.html': Permission non accordée
install: impossible de supprimer '/usr/local/share/doc/qemu/qemu-tech.html': Permission non accordée
make: *** [Makefile:437: install-doc] Error 1
this part I change the permission but got this error
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu/qemu-doc.html
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu/qemu-tech.html
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ sudo chmod 777 /usr/local/share/doc/qemu
aitmanss#lo-lester-032:~/riscv-gnu-toolchain-rv32i/riscv-qemu$ make install
CHK version_gen.h
install -d -m 0755 "/usr/local/share/doc/qemu"
install: impossible de modifier les droits de « /usr/local/share/doc/qemu »: Opération non permise
make: *** [Makefile:436: install-doc] Error 1

The errors shown in the console output indicate that you don't have permissions to write to directories where you're trying to install QEMU.
Usually you can first build software and then install it. This is definitely the case with QEMU.
You can build it in your home directory as an ordinary user. Building step does not need any privileges. When you install it under /usr/local you can do it with root privileges, e.g. using sudo make install. Alternatively you can configure it with --prefix pointing somewhere where you have write access, then you'll be able to install it as an ordinary user.

Related

High version qemu-mipsel could not find libs automatically

System info
kernel:Linux ubuntu 5.4.0-121-generic #137~18.04.1-Ubuntu SMP Mon Jun 20 07:25:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
Default version of qemu installed by apt will cause system error when using gdb-multiarch to debug mips executable files. So i'm trying to compile the source codes.
I've installed re2c, ninja and some packages, which are the dependency of qemu.
wget https://github.com/skvadrik/re2c/releases/download/3.0/re2c-3.0.tar.xz
tar -xvzf re2c-1.0.1.tar.gz
cd re2c-1.0.1/
./configure
make -j4
sudo make install
cd ..
git clone https://github.com/ninja-build/ninja.git
cd ninja
./configure.py --bootstrap
sudo cp ninja /usr/bin/
ninja --version
cd ..
sudo apt install build-essential zlib1g-dev pkg-config
sudo apt install libglib2.0-dev binutils-dev libboost-all-dev libssl-dev
sudo apt install libpixman-1-dev libfdt-dev libsdl2-dev
Then i'd like to build qemu statically and get executable like qemu-mipsel(which are static linked so i rename the files with -static suffix). But when i was trying to run any mips executable file, i got error below.
$ ./qemu-mipsel-static (mips_file_name)
qemu-mipsel-static: Could not open '/lib/ld.so.1': No such file or directory
I'm sure that the arch and endian is right. And i copied related lib files in /usr/mipsel-linux-gnu/lib to current directory and using option -L to specify the lib file path. I got the same result.
And i tried the version installed by apt, It can run smoothly.
Commands for installing qemu via apt are as followed.
sudo apt-get install qemu
sudo apt-get install qemu-user-static
sudo apt-get install qemu-system
sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
However, as for the higher version of qemu compiled by source code, when i was tring commands below, it can run smoothly.
chroot . ./qemu-mipsel-static (mips file)
I wonder the reason and how to correctly run the file using ./ and chroot two ways. Thanks for your help!

mysql install init failure on centos7

I am trying to install Mysql Community Server version5.6.40 on my Centos7 VM.
During the installation i have met below problems:
1)
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
-bash: ./mysql_install_db.sh: Permission denied
[root#Mysql_Server support-files]# /etc/init.d/mysqld start
-bash: /etc/init.d/mysqld: Permission denied
i have use chmod a+x filename to assign the execute rights but i just want to know why those files lacks of execution rights. //i download the mysql installation tar file and extract with root privilege
2)while i was running the mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
FATAL ERROR: Could not find my_print_defaults
The following directories were searched:
/application/mysql/bin
/application/mysql/extra
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
i tried follow steps to find out what the possible reason for causing this issue:
find / my_print_defaults
find: ‘my_print_defaults’: No such file or directory
and
ls /application/mysql/
[root#Mysql_Server scripts]# ls /application/mysql/
BUILD dbug libmysqld README support-files
client Docs libservices regex tests
cmake Doxyfile-perfschema man scripts unittest
CMakeLists.txt extra mysql-test sql VERSION
cmd-line-utils include mysys sql-bench vio
config.h.cmake INSTALL mysys_ssl sql-common win
configure.cmake libevent packaging storage zlib
COPYING libmysql plugin strings
no bin and extra directory were created.
so i was wondering if it was caused by lacking of gcc gcc-c++ because my centos7 installation chose minimal install.
or maybe it was caused by lacking of execution rights result the shell files did run correctly.
attached:below whole operations for better trouble shooting
[root#Mysql_Server ~]# yum install wget -y
[root#Mysql_Server ~]# wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# tar -xf mysql-5.6.40.tar.gz
[root#Mysql_Server ~]# mkdir /application
[root#Mysql_Server ~]# mv mysql-5.6.40 /application/
[root#Mysql_Server ~]# ln -s /application/mysql-5.6.40/ /application/mysql
[root#Mysql_Server ~]# cd /application/mysql/support-files/
[root#Mysql_Server support-files]# cp my-default.cnf.sh /etc/my.cnf
[root#Mysql_Server support-files]# cp mysql.server.sh /etc/init.d/mysqld
[root#Mysql_Server support-files]# cd /application/mysql/scripts/
[root#Mysql_Server scripts]# useradd mysql -s /sbin/nologin -M
[root#Mysql_Server scripts]# chmod a+x mysql_install_db.sh
[root#Mysql_Server scripts]# ./mysql_install_db.sh --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
It is a fatal mistake by misunderstanding between the source code and binary package.
Since i downloaded the source code which can not be run directly without encoding and packaging.
Thanks again for #danblack's reminds!
I've successfully run mysql_community_server on centos7 now.(using the binary package installed).
now i am going to install mysql by using the source code.

Installing Connector C for Mariadb

So, I want to use Mariadb. There is this Connector-C for it.
https://downloads.mariadb.org/connector-c/
How do I install it? Quiet frankly, the documentation for it is horrible. Even the src file for 3.0.5 is linked to 3.0.4 page.
I did not find a way to install the binary, and the documentation for building from src is quiet vague. I would prefer to know how to install both ways (binary and build from source)
I'm using CentOS7 64bit.
The easiest way to install it would be to use the MariaDB package repository.
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum -y install MariaDB-devel
As for building from source, these steps should work on CentOS 7.
sudo yum -y install git gcc openssl-devel make cmake
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
And for Ubuntu 20.04...
sudo apt-get install libmariadb3 libmariadb-dev
Raspberry Pi OS
cd to preferred build location. Then install (thanks to #markusjm!):
sudo apt install git gcc make cmake libssl-dev
git clone https://github.com/MariaDB/mariadb-connector-c.git
mkdir build && cd build
cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
Then add installation directory to LD_LIBRARY_PATH. Note: my installation directory is /usr/lib/mariadb. If you cannot find this after your installation, search for e.g. libmariadb.so, a file that should reside in your installation folder.
export LD_LIBRARY_PATH=/usr/lib/mariadb:$LD_LIBRARY_PATH
Afterwards you can finally pip3 install mariadb, if, like me, you tried to do that in the first place.
After you download MariaDB Connector/C, untar and cd. Then mv the executable first.
sudo mv -f bin/mariadb_config /usr/bin/
Now you can execute mariadb_config and will know where to put header and library files to build wheel for mariadb.
For example,
Ubuntu 18.04
sudo mv -f include/mariadb /usr/local/include/
sudo mv -f lib/mariadb /usr/local/lib/
CentOS 7 & Ubuntu 20.04
sudo mv -f include/mariadb /usr/include/
sudo mv -f lib/mariadb /usr/lib/
Finally, you could pip install mariadb. (Or, export CFLAGS=-std=c99 may help.)
After, in the case you cannot import mariadb,
export LD_LIBRARY_PATH=/PATH/TO/where/you/mv/lib/mariadb

Unable to install Couchbase sync gateway

I am trying to install Couchbase sync gateway using the steps from the following URL for MacOS
https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html
This issue is, i downloaded "couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz" and its in "Downloads" folder in MacBook.
When I execute this command -> sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
[MyMacbook:downloads administrator$ sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
tar: could not chdir to '/opt']
Throws error as "tar: could not chdir to '/opt'"
I don't understand how to resolve this. I couldn't get help anywhere.
Please help installing Couchbase sync gateway successfully on MacBook.
It dosen't actually matter if /opt does not exist on your Mac. You can either create one before firing the command with the following command:
sudo mkdir /opt
Otherwise, you can replace "opt" with locations like : /Users/< your_user > or /usr/share or /var

How do I do a clean re-install of zoneminder?

Because doing this:-
sudo apt-get remove --purge zoneminder
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /var/lib/mysql
sudo apt-get remove --purge apache2*
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo rm -r /var/www/*
sudo rm -r /etc/apache2/*
sudo rmdir /var/www
sudo rmdir /etc/apache2
sudo rm -r /opt/zm
sudo rm /etc/apache2/conf.d/zoneminder.conf
sudo dpkg --configure -a
reboot hardware
sudo apt-get install zoneminder
produces this error:-
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up libapache2-mod-php5 (5.4.6-1ubuntu1.4) ...
Creating config file /etc/php5/apache2/php.ini with new version
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up apache2 (2.2.22-6ubuntu2.3) ...
Setting up zoneminder (1.25.0-1.1ubuntu1) ...
Starting ZoneMinder: Can't open config file '/opt/zm/etc/zm.conf': No such file or directory at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.
failure
invoke-rc.d: initscript zoneminder, action "start" failed.
dpkg: error processing zoneminder (--configure):
subprocess installed post-installation script returned error exit status 2
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for ureadahead ...
Errors were encountered while processing:
zoneminder
E: Sub-process /usr/bin/dpkg returned an error code (1)
Originally zoneminder installed "first time" Ok on this 32bit "mint 14" machine using just the single apt-get install zoneminder command from here:-
http://www.tuxradar.com/content/build-your-own-surveillance-zoneminder
but when I tried to upgrade a couple of days ago to version 1.26.2 by compiling manually, I messed it up.
How can I remove zoneminder completely so that the original "clean" install works again?
No need to do any of the above, from this link:-
http://pjpramod.blogspot.co.uk/2010/01/starting-zoneminder-cant-open-config.html
So I did this:-
sudo rm -r /usr/local/share/perl/5.14.2/*
and then the install completes OK - but the popups no longer work (don't open at all or open in the same window), so don't do that.
Finally I abandoned re-installing the pre-built package (1.25.0 - or was it 1.25.2?) and downloaded the 1.26.3 tar file and unpacked it and cd'ed into it...
...and ./configure was missing...
...but if you run bootstrap.sh
./bootstrap.sh
then that (and some other things) magically appear.
Then did this:
sudo ./configure --prefix=/opt/zm --with-mysql=/usr --with-ffmpeg=/usr --with-webuser=www-data --with-webgroup=www-data --disable-debug --disable-crashtrace --enable-mmap=yes --with-webdir=/var/www --with-cgidir=/usr/lib/cgi-bin ZM_SSL_LIB=openssl
and it configured OK.
then this
sudo make
followed by this:-
sudo make install
and it installed OK but when I tried to run zoneminder I got database errors so did something like this to delete zm:-
mysql -uroot -pyourPassWord
mysql > drop database zm;
mysql > quit;
and this to recreate it (I know nothing about databases, this is monkey-see, monkey-do from here):-
mysql -u root -pyourPassWord
>create database zm;
>exit
mysql -u root -pyourPassWord zm < db/zm_create.sql
mysql -u root -pyourPassWord zm
>grant select,insert,update,delete on zm.* to 'zmuser'#localhost identified by 'zmpass';
>quit
mysqladmin -u root -pyourPassWord reload
and it then worked OK (I am running zm like this:-)
sudo /etc/init.d/zm start
And while trying to figure out what link between apache and zm did (and how apache works etc) I discovered that you only need to do this:-
localhost/index.php
to bring up zoneminder, working OK, in my browser - Yee Haw! Not bad for two day's effort and one divorce.
But I could only get zmpkg.pl to work by doing this:-
sudo /opt/zm/bin/zmpkg.pl
and not this:-
sudo zmpkg.pl
Because, I learn, that that $PATH is defined "globally" for sudo and therefore my adding /opt/zm/bin in my .bashrc file had no effect so then, rather than put zmpkg.pl into /usr/local/sbin (or one of those paths in "global" $PATH) I insert a link instead like this:-
sudo ln -s /opt/zm/bin/zmpkg.pl /usr/local/sbin/zmpkg.pl
and it works! so now e.g.
sudo zmpkg.pl status
works again.
Does anyone know how all this should be done? E.g. so that
localhost/zm
works again?
Update on 20th December 2013: I just upgraded to verion 1.26.5 successfully on this mint 14 system by repeating some of the above instructions i.e.
1) Stop zoneminder.
2) Download version 1.26.5
3) Ran the ./bootstrap.sh script (as mentioned above).
4) Ran the ./configure... script (as mentioned above).
5) Ran the make (as mentioned above - but got errors)...
So I read the README and copied and pasted this from it (line 24):
root#host:~# aptitude install -y apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm subversion automake autoconf libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch;
and then did a
sudo make clean
and then repeated 4) and 5) above and it compiled OK.
6) Did the "sudo make install" OK (i.e. on top of the old version I guess).
7) Then did all the rest of the "as mentioned above" instructions to delete zm from the database (after trying to zm unsuccessfully) and re-inserted it and then it started OK via the "zmpkg.pl start" script as version 1.26.5
8) As before I then had to manually reset up all cameras and password and users and zones but at least it all worked "first time"
I would suggest that you have to uninstall all the packages which include LAMP(apache, mysql, php) and zoneminder.
use this command to remove these packages.
sudo aptitude purge <pkg-name>
Then you have to go to zoneminder manual installation directory (say /usr/src). and use command
sudo make clean
sudp updatedb
After this you can start normal install procedure.