Tag Archives: linux

Error while loading shared libraries [How to Solve]

error while loading shared libraries: libpango_image.so: cannot open shared object file: No such file or directory

#cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
#sudo sh -c "echo '/usr/local/lib' >> /etc/ld.so.conf"
#cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

/usr/local/lib
#sudo sh -c ldconfig

In this case, the shared library file has been installed under the/usr/local/lib directory by default. Before executing the ldconfig command, add the new shared library directory to the shared library configuration file/etc/ld.so.conf.

[Solved] Error in OpenSSL when compiling code locally for raspberry pie

Error in OpenSSL when compiling code locally for raspberry pie

Error content

/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_keylog_callback@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_post_handshake_auth@OPENSSL_1_1_1'
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../libcurl.so: undefined reference to `SSL_CTX_set_ciphersuites@OPENSSL_1_1_1'

Raspberry pie still reports an error when querying the OpenSSL version number locally

openssl version

Error content:

openssl: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)
openssl: /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by openssl)

Problem source:

After inquiry, it is mainly LD_LIBRARY_environment variable path is not specified, so OpenSSL is using the old system OpenSSL library

Solution:

Temporary solution: the terminal enters the following command to temporarily add the environment variables of OpenSSL library, but this method can only ensure that the current terminal is valid. If a new terminal is opened, an error will still be reported

export LD_LIBRARY_PATH=/usr/local/lib

Permanent solution: modify the. Bashrc hidden file in the working directory, taking raspberry pie as an example

vi /home/pi/.bashrc 
export LD_LIBRARY_PATH=/usr/local/lib 
source .bashrc 
sudo reboot 

You can also enter the following command

echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc 

After completing the above series of operations, you can enter the following commands to check whether it is normal

pi@raspberrypi:~ $ openssl
OpenSSL> version
OpenSSL 1.1.1l  24 Aug 2021
OpenSSL> q

Finally, the problem is solved and the compiled code is an error

Tomcat service startup error: cannot allocate memory [How to Solve]

Today, an environment hung up. First, restart it. It was found that it didn’t get up. The following error was reported:

....
Cannot allocate memory

1. Check whether the thread is full first:
# check the maximum allowed processes

[root@test ~] sysctl kernel.pid_max
kernel.pid_max = 32768

#View the number of processes in progress on this server

[root@test ~] ps -eLf | wc -l
1597

2. Compare the above two values. If the two values are similar, increase the number of allowed processes:
Modify PID_ Max value (custom)

[root@test ~] echo 999999 > /proc/sys/kernel/pid_max

Settings take effect permanently

[root@test ~] echo "kernel.pid_max=999999" >> /etc/sysctl.conf
[root@test ~] sysctl -p

3. If it is not, check the Tomcat log:

then modify the memory allocation:

1. [root@test ~] vim/etc/sysctl.conf 
vm.overcommit_memory=1
   [root@test ~] sysctl -p  

2.[root@test ~] echo 1 > /proc/sys/vm/overcommit_memory
  [root@test ~] sysctl –p  

3. [root@test ~] sysctl  vm.overcommit_memory=1 

Explanation:
memory allocation strategy in the kernel: overcommit_Memory
optional values: 0, 1, 2

0,: indicates that the kernel will check whether there is enough available memory for the process to use; If there is enough available memory, the memory application is allowed; Otherwise, the memory request fails and the error is returned to the application process
1: indicates that the kernel is allowed to allocate all physical memory regardless of the current memory state
2: indicates that the kernel allows to allocate more memory than the sum of all physical memory and swap space.

Python2.7 Pyinstaller Install Error: ERROR: Command errored out with exit status 1

Python2.7 pyinstaller installation error: Command erred out with exit status 1


Error reporting reason:

Installing pyinstaller directly in python2.7 will report an error. Version 4 is incompatible with python2, so we need to specify a compatible pyinstaller version number during installation. The installation commands are as follows:

pip install pyinstaller==3.2.1

Py2exe installation command

pip install py2exe==0.6.9 

[Solved] ModuleNotFoundError: No module named ‘_polyiou‘

Problem recurrence

//install swig
sudo apt-get install swig
swig -c++ -python polyiou.i
python setup.py build_ext --inplace

//report error
ModuleNotFoundError: No module named '_polyiou'

Solution:

Swig is not installed correctly. Because there are python2 and python3 in the environment, the command to install swig is modified as follows

sudo apt-get install swig
swig -c++ -python polyiou.i
python3 setup.py build_ext --inplace

Easycvr package Linux version error net_DVR_DownFileByName_Stop

As we all know, easycvr is a protocol integration platform that supports the most protocols among the platforms developed by tsingsee Qingxi video. Easycvr can be compatible with the private SDKs of Haikang and Dahua. At the same time, it also has the characteristics of gb28181, cascading of home protocols, voice intercom and so on. According to your own system, you can freely choose Windows version or Linux version for deployment.

When our developers packaged the Linux version of easycvr, easy appeared_ NET_ DVR_ DownFileByName_ Stop error.

As can be seen from the error, the prompt cannot find easy_NET_DVR_DownFileByName_Stop,
EASY_NET_DVR_DownFileByName_Start, NET_DVR_Startremoteconfig these three defined types.

In the corresponding source_hksdk_corresponding type is not found in the linux.go file, but it is used in the file.

So we need to find the source in the project_hksdk_Linux.go file, merge the missing code in source_hksdk_Add to linux.go. The reference code is as follows:

int Easy_NET_DVR_StartRemoteConfig(int loginhandle, int channelNum, int year, int month, int day, int hour, int minute, int second, char* path,int size){
	char pathArr[128];
	memset(pathArr, 0, sizeof(pathArr));
	memcpy(pathArr, path, size);
	NET_DVR_GET_FIGURE_COND cond;
	memset(&cond, 0 ,sizeof(NET_DVR_GET_FIGURE_COND));
	cond.dwLength = sizeof(NET_DVR_GET_FIGURE_COND);
	cond.dwChannel = channelNum;
	cond.struTimePoint.wYear = year;
	cond.struTimePoint.byMonth = month;
	cond.struTimePoint.byDay = day;
	cond.struTimePoint.byHour = hour;
	cond.struTimePoint.byMinute = minute;
	cond.struTimePoint.bySecond = second;

	int ret = NET_DVR_StartRemoteConfig(loginhandle, 6610, &cond, sizeof(cond), EasyDownloadPictureByTimeCallback, path);
	if (ret < 0)
	{
		return ret;
	}
	sleep(2);
	NET_DVR_StopRemoteConfig(ret);
	return ret;
}

int EASY_NET_DVR_DownFileByName_Start(int loginhandle, char* srcfile, char* destfile){
    int bRes = 1;
    int hPlayback = 0;
    if( (hPlayback = NET_DVR_GetFileByName(loginhandle, srcfile, destfile)) < 0 ){
        printf( "GetFileByName failed. error[%d]\n", NET_DVR_GetLastError());
        bRes= -1;
        return bRes;
    }
    int pos = 0;
    if(!NET_DVR_PlayBackControl_V40(hPlayback, NET_DVR_PLAYSETPOS, &pos,4,NULL,NULL)){
        printf("play back control failed [%d]\n",NET_DVR_GetLastError());
        bRes=-1;
        return bRes;
    }
    if(!NET_DVR_PlayBackControl_V40(hPlayback, NET_DVR_PLAYSTART, NULL,0,NULL,NULL)){
        printf("play back control failed [%d]\n",NET_DVR_GetLastError());
        bRes=-1;
        return bRes;
    }
   return 0;
}

int EASY_NET_DVR_DownFileByName_Stop(int filehandle){
	int bRes = 0;
    int nPos = NET_DVR_GetDownloadPos(filehandle);
    printf("have got %d\n", nPos);
    if(!NET_DVR_StopGetFile(filehandle)){
        printf("failed to stop get file [%d]\n",NET_DVR_GetLastError());
        bRes = -1;
        return bRes;
    }
    if(nPos<0||nPos>100) {
        printf("download err [%d]\n",NET_DVR_GetLastError());
        bRes=-1;
        return bRes;
    }else {
        return 0;
    }
 return 0;
}

Package again without error:

Solutions to remote or adding SSH key errors

 

 

Method 1

ssh-keygen -R XX.XX.XX.XX  

Method 2

【1】 Delete the corresponding IP in known_ Hosts related information

vim /.ssh/known_ hosts

The problem is solved. The reason is that after the system is reinstalled, the remote connection is made again. After entering yes, this opportunity writes the information of the remote machine to/users/Wangdong /. SSH/known_ Hosts file, so if you reinstall the system remotely, you must clean up the machine first.

Error in PIP install BS4 under Linux

1. The error information is as follows:

$ sudo pip install bs4==0.0.1
Collecting bs4==0.0.1
  Downloading http://pip.pgw.getui.com/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Collecting beautifulsoup4 (from bs4==0.0.1)
  Downloading http://pip.pgw.getui.com/packages/a1/69/daeee6d8f22c997e522cdbeb59641c4d31ab120aba0f2c799500f7456b7e/beautifulsoup4-4.10.0.tar.gz (399kB)
    100% |████████████████████████████████| 409kB 11.7MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-USqeae/beautifulsoup4/setup.py", line 7, in <module>
        from bs4 import __version__
      File "bs4/__init__.py", line 36, in <module>
        raise ImportError('You are trying to use a Python 3-specific version of Beautiful Soup under Python 2. This will not work. The final version of Beautiful Soup to support Python 2 was 4.9.3.')
    ImportError: You are trying to use a Python 3-specific version of Beautiful Soup under Python 2. This will not work. The final version of Beautiful Soup to support Python 2 was 4.9.3.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-USqeae/beautifulsoup4/

2 solution

Install beatifulsoup4 first

$ sudo  pip install beautifulsoup4==4.9.0
Collecting beautifulsoup4==4.9.0
  Downloading http://pip.pgw.getui.com/packages/2d/3e/8b2fc5d3c31c84d7209313f4059858f502f2e4a9d986693eca03fe325565/beautifulsoup4-4.9.0-py2-none-any.whl (109kB)
    100% |████████████████████████████████| 112kB 872kB/s
Collecting soupsieve<2.0 (from beautifulsoup4==4.9.0)
  Downloading http://pip.pgw.getui.com/packages/39/36/f35056eb9978a622bbcedc554993d10777e3c6ff1ca24cde53f4be9c5fc4/soupsieve-1.9.6-py2.py3-none-any.whl
Collecting backports.functools-lru-cache; python_version < "3" (from soupsieve<2.0->beautifulsoup4==4.9.0)
  Downloading http://pip.pgw.getui.com/packages/e5/c1/1a48a4bb9b515480d6c666977eeca9243be9fa9e6fb5a34be0ad9627f737/backports.functools_lru_cache-1.6.4-py2.py3-none-any.whl
Installing collected packages: backports.functools-lru-cache, soupsieve, beautifulsoup4
Successfully installed backports.functools-lru-cache-1.6.4 beautifulsoup4-4.9.0 soupsieve-1.9.6

Installing BS4

$ sudo  pip install  bs4==0.0.1
Collecting bs4==0.0.1
  Downloading http://pip.pgw.getui.com/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /usr/lib/python2.7/site-packages (from bs4==0.0.1)
Requirement already satisfied (use --upgrade to upgrade): soupsieve<2.0 in /usr/lib/python2.7/site-packages (from beautifulsoup4->bs4==0.0.1)
Requirement already satisfied (use --upgrade to upgrade): backports.functools-lru-cache; python_version < "3" in /usr/lib/python2.7/site-packages (from soupsieve<2.0->beautifulsoup4->bs4==0.0.1)
Installing collected packages: bs4
  Running setup.py install for bs4 ... done
Successfully installed bs4-0.0.1

Error in running script in openwrt

Details of error reporting are as follows
root@OpenWrt :~# /root/connect_ net.sh
-ash: /root/connect_ net.sh: not found

When running a script, the above error occurs. The variables in the script are defined as
code = curl - O/dev/null - SW% {http_code} www.baidu. Com

After querying, it is found that the shell only supports ash in openwrt, while Bash is used by default in Linux and Ubuntu

The solution here is when defining variables, the left and right sides of the equal sign '=' are not left blank, as shown in the example
code = curl - O/dev/null - SW% {http_code} www.baidu. Com

The operation of variables in openwrt still needs attention

    variable operation only supports expr, not $[], $(()), let. These three formats must leave a space around the plus sign “+”