Issue while installing Redis on a Pi - redis

I'm trying to install Redis on my Pi. Sames steps as explained in next link: https://redis.io/download
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
After a while next messages gets returned-->
/usr/bin/ld: networking.o: in function `createClient':
/home/pi/redis-stable/src/networking.c:109: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:219: redis-server] Error 1
make[1]: Leaving directory '/home/pi/redis-stable/src'
make: *** [Makefile:6: all] Error 2
Other approaches:
#!/bin/bash
# Installing redis from tar, we need the newest for Redis Stream
rm -rf /etc/redis
mkdir -p /etc/redis
cd /etc/redis
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar xzf redis-5.0.3.tar.gz
cd redis-5.0.3
make cleandist
make
make install

I haven't run into this issue myself, but it seems that libatomic.so provides the symbol on my Raspberry Pi. So try adding -latomic to the linker flags (LDFLAGS='-latomic' to configure if the project uses GNU Autoconf, -DCMAKE_SHARED_LINKER_FLAGS='-latomic' if it uses cmake, etc).
You may also have to install the package libatomic-ops-dev as well (if not already installed)
EDIT: Seems other people have run into this. See for example this redis bug: https://github.com/antirez/redis/issues/6275
Also redis seems to have it's own obscure build system. It may work to do: make FINAL_LIBS=-latomic or you may have to patch src/Makefile to add -latomic to the FINAL_LIBS variable

Related

Apache httpd compile (make) error. How to fix it?

I get an error when compiling (configure) Apache httpd. Please tell me how to solve it.
Error message
$ git clone -b 2.2.3 --single-branch https://github.com/apache/httpd.git
$ cd httpd
$ autoconf
$ ./configure
configure: error: cannot find required auxiliary files: config.guess config.sub
My environment
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ autoconf -V
autoconf (GNU Autoconf) 2.71
Update 1
The "configure" problem has probably been solved. (I stopped using github). However, an error occurs during make.
"make" error message
$ wget https://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
$ gzip -d httpd-2.2.3.tar.gz
$ tar xvf httpd-2.2.3.tar
$ cd httpd-2.2.3
$ ./configure --prefix /home/ubuntu/local
$ make
/usr/bin/ld: .libs/htpasswd.o: undefined reference to symbol 'crypt##XCRYPT_2.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcrypt.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:39: htpasswd] Error 1
make[2]: Leaving directory '/home/ubuntu/httpd-2.2.3/support'
make[1]: *** [/home/ubuntu/httpd-2.2.3/build/rules.mk:72: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/httpd-2.2.3/support'
make: *** [/home/ubuntu/httpd-2.2.3/build/rules.mk:72: all-recursive] Error 1
Installed modules
sudo apt-get install libapr1-dev libaprutil1-dev
sudo apt-get install build-essential
sudo apt-get install libpcre3-dev
Try this:
wget http://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
tar -xf httpd-2.2.3.tar.gz
sudo ./configure --prefix=/opt/httpd --with-included-apr --with-ssl=/opt/openssl-1.0.1i --enable-ssl-staticlib-deps --enable-mods-static=ssl
sudo make
sudo make install

OpenvSwitch building, installation and testing problem

I am trying to install OpenvSwitch on Ubuntu 18.04.
I have two kernels version which are 5.11.0-27-generic and 5.4.0-42-generic.
I set ./configure to build 5.4.0-42-generic version.
Then I use command 'make modules_install', and I get the following message
"[openvswitch-2.16.2]make modules_install
cd datapath/linux && make modules_install
make[1]: 進入目錄「/home/user/下載/openvswitch-2.16.2/datapath/linux」
make -C /lib/modules/5.4.0-42-generic/build M=/home/user/下載/openvswitch-2.16.2/datapath/linux modules_install
make[2]: 進入目錄「/usr/src/linux-headers-5.4.0-42-generic」
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/openvswitch.ko
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/vport-geneve.ko
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/vport-gre.ko
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/vport-lisp.ko
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/vport-stt.ko
INSTALL /home/user/下載/openvswitch-2.16.2/datapath/linux/vport-vxlan.ko
DEPMOD 5.4.0-42-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[2]: 離開目錄「/usr/src/linux-headers-5.4.0-42-generic」
/sbin/depmod sed -n 's/#define UTS_RELEASE "\([^"]*\)"/\1/p' /lib/modules/5.4.0-42-generic/build/include/generated/utsrelease.h"
The result seems to be success.
However, I use mininet to set a topology which have three eths connect to a switch.
'mn --topo=single,3 --controller=none --mac'
Next I add a flow that is 'ovs-ofctl add-flow s1 action=normal'
and 'pingall'
The wireshark gets all icmp packets.
I add a code in vport.c in advance.
The code is 'printk(KERN_ERR "\r\n!!!print1 !!!\r\n)"'
However, dmesg doesn't show printk.
I found the 'insmod' command will show the following error
'insmod: ERROR: could not insert module openvswitch.ko: Invalid module format'
Is there anything wrong in my building and installation process?
How can I show printk message in dmesg?

How do I install libpng on MSYS2?

I want to build a program with mingw w64 and I have msys2 installed.
I tried to work with pacman from the msys2 prompt.
$ pacman -Q libpng
error: package 'libpng' was not found
$ pacman -S libpng
error: target not found: libpng
$ pacman -S *libpng
error: target not found: *libpng
I attempted to use google and came up with:
$ pacman -S mingw-w64-libpng
error: target not found: mingw-w64-libpng
$ pacman -F mingw-w64-libpng
warning: database file for 'mingw32' does not exist (use '-Fy' to download)
warning: database file for 'mingw64' does not exist (use '-Fy' to download)
warning: database file for 'msys' does not exist (use '-Fy' to download)
error: no options specified (use -h for help)
Very peculiar that after all the downloading I did, which I distinctly recall including a database for pacman, that these database files don't seem to exist.
$ pacman -Fy mingw-w64-libpng
[... stuff downloads ... ]
error: no options specified (use -h for help)
$ pacman -U mingw-w64-libpng
loading packages...
error: 'mingw-w64-libpng': could not find or read package
So now the questions are,
1) How in the future will I find the magic prefix for a well-known library in order to be able to tell pacman what to install?
2) How at the moment do I instruct pacman to install the libpng package which seems to be in the mingw-w64-libpng package?
3) Is that the package with the development headers or is that yet another package, as I have adjusted to on Deb/Ubuntu by looking for something like libpng-dev?
Have you tried pacman -Ss libpng? This will list all packages mentioning libpng, prefix and all:
$ pacman -Ss libpng
mingw32/mingw-w64-i686-libpng 1.6.35-1
A collection of routines used to create PNG format graphics (mingw-w64)
mingw64/mingw-w64-x86_64-libpng 1.6.35-1 [installed]
A collection of routines used to create PNG format graphics (mingw-w64)
I notice that these names include an architecture (i686/x86_64), which is fairly common in MinGW package names.
EDIT: The headers end up here:
$ ls /mingw64/include/libpng16/
png.h pngconf.h pnglibconf.h

Mosquitto Auth Plugin with Openssl issue on raspberry pi

I have first created a user for mosquitto:
sudo adduser --system -no-create-home mosquitto
Then I installed some dependencies:
sudo apt-get install libc-ares-dev libcurl4-openssl-dev libmysqlclient-dev
Then I installed mosquitto:
wget http://mosquitto.org/files/source/mosquitto-1.3.5.tar.gz //download mosquitto-1.3.5
tar xvzf mosquitto-1.3.5.tar.gz //unzip tar file
Then cd mosquitto-1.3.5
Then I put config.mk in edit mode using
sudo nano config.mk
Then I searched for SRV by pressing Ctrl + W
Changed With_SRV:=no
Ctrl + O followed by Enter to save
Ctrl + X to exit out of file
Now I need to install Openssl to build mosquitto.
So I installed Openssl using this command:
wget http://www.openssl.org/source/openssl-1.0.0c.tar.gz
Download md5 file to generate md5 code
wget http://www.openssl.org/source/openssl-1.0.0c.tar.gz.md5
Generate md5sum
md5sum openssl-1.0.0c.tar.gz
Generate md5 code
cat openssl-1.0.0c.tar.gz.md5
if both code matches than we have downloaded the file completely
unzip the tar file
tar -xvzf openssl-1.1.0c.tar.gz 54. cd openssl-1.1.0c
Configure the openssl before compiling it
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
Compile openssl
make
Install Openssl
sudo make install
The above line gives error, so the below line of code:
sudo make install_sw
Verify if openssl was installed successfully
/usr/local/openssl/bin/openssl version //get the version number of openssl
Come out of the directory and go to the directory of mosquitto:
cd
cd mosquitto-1.3.5
Install another dependency of mosquitto
sudo apt-get install libssl-dev
Compile Mosquitto
sudo make
Install Mosquitto:
sudo make install
download mosquitto auth plugin from github
git clone https://github.com/jpmens/mosquitto-auth-plug.git
Download hiredis
git clone https://github.com/redis/hiredis.git
Go to hiredis directory and compile it and install it
cd hiredis
make
sudo make install
Go to mosquitto auth plugin directory
cd
cd mosquitto-1.3.5
cd mosquitto-auth-plug
Copy the contents of config.mk.in to config.mk
cp config.mk.in config.mk
Open config.mk in edit mode
sudo nano config.mk
Change these lines of code:
MOSQUITTO_SRC = /home/pi/mosquitto-1.3.5
OPENSSLDIR = /usr/local/openssl
Save the file and come out of it
Ctrl + O followed by Enter then
Ctrl + X to exit
Then I try to compile mosquitto-auth-plug:
make
At this time I get this error:
Selected backends: MySQL
Using mosquitto source dir: /home/pi/mosquitto-1.3.5
OpenSSL install dir: /usr/local/openssl
If you changed the backend selection, you might need to 'make clean' first
CFLAGS: -I/home/pi/mosquitto-1.3.5/src/ -I/home/pi/mosquitto-1.3.5/lib/ -fPIC -Wall -Werror -DBE_MYSQL -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG -I/src -DDEBUG=1 -I/usr/local/openssl/include
LDFLAGS: -L/home/pi/mosquitto-1.3.5/lib/
LDADD: -L/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -ldl -L/usr/local/openssl/lib -lcrypto -lmosquitto
cc -I/home/pi/mosquitto-1.3.5/src/ -I/home/pi/mosquitto-1.3.5/lib/ -fPIC -Wall -Werror -DBE_MYSQL `mysql_config --cflags` -I/src -DDEBUG=1 -I/usr/local/openssl/include -c -o cache.o cache.c
cache.c: In function ‘sha_hash’:
cache.c:48:3: error: implicit declaration of function ‘EVP_MD_CTX_new’ [-Werror=implicit-function-declaration]
EVP_MD_CTX *mdctx = EVP_MD_CTX_new();
^
cache.c:48:23: error: initialization makes pointer from integer without a cast [-Werror]
EVP_MD_CTX *mdctx = EVP_MD_CTX_new();
^
cache.c:53:3: error: implicit declaration of function ‘EVP_MD_CTX_free’ [-Werror=implicit-function-declaration]
EVP_MD_CTX_free(mdctx);
^
cc1: all warnings being treated as errors
<builtin>: recipe for target 'cache.o' failed
make: *** [cache.o] Error 1
So, I removed openssl-1.0.0c and installed openssl-1.1.0c version
Then compiling of mosquitto-auth-plug is done successfully
Then move the files as follows:
sudo mv auth-plug.so /etc/mosquitto
sudo mv /etc/mosquitto/mosquitto.conf.example /etc/mosquitto/mosquitto.conf
edit mosquitto .conf file
sudo nano /etc/mosquitto/mosquitto.conf
Press Ctrl + W to search
search for auth_plugin and write below mentioned commands after the second occurance of auth_plugin
auth_plugin /etc/mosquitto/auth-plug.so
auth_opt_backends mysql
auth_opt_redis_host localhost
auth_opt_redis_port 12885
auth_opt_host localhost
auth_opt_port 3306
auth_opt_dbname HAC
auth_opt_user mqtt_user
auth_opt_pass ###YOUR_PASSWORD###
auth_opt_userquery SELECT pw FROM mqtt_users WHERE username = '%s'
auth_opt_superquery SELECT COUNT(*) FROM mqtt_users WHERE username = '%s' AND super = 1
auth_opt_aclquery SELECT topic FROM mqtt_acls WHERE (username = '%s') AND (rw >= %d)
auth_opt_anonusername AnonymouS
Then save the file by presssing Ctrl + O and then Enter
To exit out of the file press Ctrl + X
Then when I run this command:
/usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
I get the following error:
1486888881: mosquitto version 1.3.5 (build date 2017-02-11 22:22:57+0000) starting
1486888881: Config loaded from /etc/mosquitto/mosquitto.conf.
1486888881: Error: Unable to load auth plugin "/etc/mosquitto/auth-plug.so".
Can anybody help me please?
I have already wasted 4 days in searching a solution of this error.
Update:
I have uninstalled mosquitto and installed its latest version. Still getting the same error but its more descriptive this time. Now it says:
mosquitto version 1.4.10 (build date 2017-02-13 22:22:57+0000) starting
Config loaded from /etc/mosquitto/mosquitto.conf.
Error: Unable to load auth plugin "/etc/mosquitto/auth-plug.so".
Load Error: /etc/mosquitto/auth-plug.so: Undefined Symbol: EVP_MD_CTX_reset

Installation of sql relay fails

I just created a docker container and tried to install SQL Relay inside it.
I've checked the prerequisites here and followed the installation documents here.
However, at the end of make install of sqlrelay, I saw an error like this:
update-rc.d: /etc/init.d/sqlrelay: file does not exist
update-rc.d: /etc/init.d/sqlrcachemanager: file does not exist
make[1]: *** [install] Error 1
make[1]: Leaving directory `/sqlrelay-0.66.0/init'
make: *** [install-init] Error 2
What might be wrong with my installation?
Here's the docker file I used to start my installation:
FROM ubuntu:trusty
RUN apt-get update && \
apt-get install libxml2-dev libpcre3 libpcre3-dev libmysqld-dev -y
RUN apt-get install mysql-server libmysqlclient-dev -y
# sql relay prerequisites
RUN apt-get install g++ make perl php5-dev python-dev ruby-dev \
tcl-dev openjdk-7-jdk erlang-dev nodejs-dev node-gyp mono-devel \
libmariadbclient-dev libpq-dev firebird-dev libfbclient2 libsqlite3-dev \
unixodbc-dev freetds-dev mdbtools-dev -y
COPY rudiments-0.56.0.tar.gz /
COPY sqlrelay-0.66.0.tar.gz /
EXPOSE 80
Here are the outputs of ./configure, make, and make install inside sqlrelay-0.66.0 folder:
configure_log
make_log
make_install_log
If you need more information of my installation process, just let me know. I can provide it.
I think you should use ADD instead of COPY in your lines such as
COPY rudiments-0.56.0.tar.gz /
Your COPY just copies the .tar.gz, but does not unpack them
as with ADD
If the <src> parameter of ADD is an archive in a recognised compression format, it will be unpacked
This is extracted from
What is the difference between the `COPY` and `ADD` commands in a Dockerfile?
I have recently hit the same issue. The issue I found was that the init Makefile was incorrectly detecting the use of systemctl on Ubuntu Trusty and putting the scripts there. Later on the script would try to find the scripts in init.d and fail.
The solution is to edit the Makefile: sqlrelay-X.X.X/init/Makefile
Replace:
install:
if ( test -d "/lib/systemd/system" ); \
With:
install:
if ( test -d "/lib/systemd/system_x" ); \
Make a similar change to the uninstall option later in the script and it will now correctly install on Ubuntu.