Author Archives: Robins

Linux environment setup – Update https://apt.repos.intel.com report errors

Linux environment setup – Update https://apt.repos.intel.com report errors

Problem description and solution

Problem description

After sudo apt get update, the https://apt.repos.intel.com Error message

Hit https://mirrors.tuna.tsinghua.edu.cn focal-security/multiverse Translation-en
Hit https://mirrors.tuna.tsinghua.edu.cn focal-security/restricted Translation-en
Hit https://mirrors.tuna.tsinghua.edu.cn focal-security/universe Translation-en
Err https://apt.repos.intel.com all/main amd64 Packages
  gnutls_handshake() failed: Handshake failed
Err https://apt.repos.intel.com all/main i386 Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com all/main Translation-en_US
Ign https://apt.repos.intel.com all/main Translation-en
Err https://apt.repos.intel.com binary/ Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com binary/ Translation-en_US
Ign https://apt.repos.intel.com binary/ Translation-en
Err https://apt.repos.intel.com all/main amd64 Packages
  gnutls_handshake() failed: Handshake failed
Err https://apt.repos.intel.com all/main i386 Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com all/main Translation-en_US
Ign https://apt.repos.intel.com all/main Translation-en
Err https://apt.repos.intel.com all/main amd64 Packages
  gnutls_handshake() failed: Handshake failed
Err https://apt.repos.intel.com all/main i386 Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com all/main Translation-en_US
Ign https://apt.repos.intel.com all/main Translation-en
Err https://apt.repos.intel.com all/main amd64 Packages
  gnutls_handshake() failed: Handshake failed
Err https://apt.repos.intel.com all/main i386 Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com all/main Translation-en_US
Ign https://apt.repos.intel.com all/main Translation-en
Err https://apt.repos.intel.com all/main amd64 Packages
  gnutls_handshake() failed: Handshake failed
Err https://apt.repos.intel.com all/main i386 Packages
  gnutls_handshake() failed: Handshake failed
Ign https://apt.repos.intel.com all/main Translation-en_US
Ign https://apt.repos.intel.com all/main Translation-en
W: There is no public key available for the following key IDs:
871920D1991BC93C
W: There is no public key available for the following key IDs:
871920D1991BC93C
W: There is no public key available for the following key IDs:
871920D1991BC93C
W: There is no public key available for the following key IDs:
871920D1991BC93C
W: Failed to fetch https://apt.repos.intel.com/mkl/dists/all/main/binary-amd64/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/mkl/dists/all/main/binary-i386/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/intelpython/binary/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/ipp/dists/all/main/binary-amd64/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/ipp/dists/all/main/binary-i386/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/tbb/dists/all/main/binary-amd64/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/tbb/dists/all/main/binary-i386/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/daal/dists/all/main/binary-amd64/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/daal/dists/all/main/binary-i386/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/mpi/dists/all/main/binary-amd64/Packages  gnutls_handshake() failed: Handshake failed

W: Failed to fetch https://apt.repos.intel.com/mpi/dists/all/main/binary-i386/Packages  gnutls_handshake() failed: Handshake failed

E: Some index files failed to download. They have been ignored, or old ones used instead.

Solution

sudo rm intelproducts.list -rf
sudo rm intel-mkl.list intel-mkl.list.save -rf

PyCharm: How to Solve Tensorflow_datasets Import Error

[error scenario]

(1) Pycharm version: pycharm 2021.2.2 (Community Edition)

(2)Python Interpret:Anaconda3(64-bit)

(3)Python 3.8.11

(4)tensorflow 2.3

When using RNN for text classification experiment, the following import statement at the beginning of the program makes an error:

import tensorflow_datasets as tfds

[solution]

Select the menu file -> Open the settings dialog box, expand the project: [current project name] item in the left panel, select the python interpret item, and select the “+” icon in the right panel to open the available packages dialog box. The settings dialog box is shown in the following figure:

Enter tensorflow datasets in the search bar at the top of the available packages dialog box. After the tensorflow datasets module name appears in the list below the search bar, select it, and then click the install package button at the bottom to wait for the installation to complete. [note] the middle line of the package name here is a middle line, not an underscore, but an underscore in the front and back import statements.

Error reporting of OpenCV and Darknet under Python 2.7

Error reporting of OpenCV and Darknet under Python 2.7

Python 2.7 is run by default during the whole ROS. I don’t know how to adjust it, so Yolo can’t run. The following error is reported

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

The solution is to recompile opencv in the following order

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

sudo make install

When C language refers to a user-defined type as a parameter, an error segmentation fault is reported

Problem Description:

In the data structure operation, a function to initialize the table is written:


#define InitSize 100
#define ElemType int

typedef struct {
    ElemType* list;
    int len;
    int size;
} sql_;


int sql_init(sql_ *head) {
    (*head).list = (ElemType*)malloc(InitSize*sizeof(ElemType));
    (*head).len = 0;
    (*head).size = InitSize;

    return 1;
}

int main() {
    sql_ L1;
    sql_init(&L1);

    sql_*L2;
    sql_init(L2);

    system("pause");
}

However, an error is reported at runtime: segmentation fault

  After entering the debugging interface, it is found that L1 has been initialized successfully, but there is a problem when it comes to L2. What is the difference between L1 and L2 initialization codes?

Analyze the problem:

    sql_ L1;
    sql_init(&L1);

    sql_*L2;
    sql_init(L2);

It can be seen that L1 is declared as SQL_ Type; L2 is declared as SQL*_ Type.

There is no warning in vscode, but there is a warning and error in vs2019, and it can not even be compiled. So what’s the reason?

Through network retrieval, we get such an article: int * a in C + +; int & a; int & * a; int * & a_ Tianya Mingyue Dao blog – CSDN blog

Inspired by the quoted concepts mentioned in the article, we made the following attempts:

sql_ L;
    sql_*L2 = &L;
    sql_init(L2);

  After such processing, the initialization can be completed successfully. Therefore, the following guess is made:

When defining a macro type, only SQL is declared_ Type, but for SQL_* The type is not declared, so it is declared in main   sql_  *  L1; The compiler can’t find the prototype, so it can’t reference SQL when declaring parameters_* Type, so vs the more stringent compiler found this problem and told L2 that memory could not be allocated.

resolvent:

Using predefined SQL_ Type declaration, use its reference when parameters need to be passed & amp; L as SQL_* Arguments of type, that is, the method of initializing L1 mentioned earlier:

    sql_ L1;
    sql_init(&L1);

Errors encountered when integrating activiti6 with springboot

There is also a spring-boot-autoconfigure-2.0.. release.jar in the start of 2.0 by default. If you also refer to activiti’s activiti-spring-boot-starter-rest-api.jar package, you need to exclude securityautoconfiguration.class in both packages

Write it in the startup class

@SpringBootApplication(exclude={
  org.activiti.spring.boot.SecurityAutoConfiguration.class,
  SecurityAutoConfiguration.class
})

Redhat8 make nginx error reporting solution

1. Enter the objs folder and modify the makefile

Remove – werror, and the modification result is shown in the figure below

 

Error Src/OS/Unix/NGX_ user.c:26:7: error: ‘struct crypt_ data’ has no member named ‘current_ salt

Search current_ Salt, after commenting out this line, make & amp; make install

Junit4 unit test reports an error invalid project specified

Junit4 unit test reports an error invalid project specified.

During the unit test the day before yesterday, an invalid project specified error was reported. After checking, it was found that the problem was the project name. If there are illegal characters such as’ – ‘or space in the project name, an error invalid project specified will be reported when running

ed.

Ultimate solution to error reporting of sudo rosdep init of ROS

Error reporting solution for sudo rosdep init of ROS
when installing ROS, the sudo rosdep init command reports an error:

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

In the process of installing ROS, I encountered the problem of sudo rosdep init reporting an error. I searched many tutorials and couldn’t solve it. Later, I referred to the tutorial at the end of the article and couldn’t deal with it. Later, I realized that the installation failed because the installation source corresponding to rosdep couldn’t be opened directly in China. Based on the principle that others will encounter their own problems, Stick to the search and finally find the corresponding source file in gitee (you can also search in chinacode). Therefore, refer to the tutorial at the end of the article. Only when the final file of the tutorial is modified, the original source file will be added to the link( https://raw.github.com/ros/rosdistro/master/ )Replace with the link in chinacode:( https://gitee.com/BlicNet/rosdistro/ )When you try to follow the tutorial again, The problem is solved and posted in memory.

1. If a version of other versions of ROS system has been installed before, delete the existing initialization file according to the prompt:

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

2. Add the content/ROS/rosdep/sources.list.d/20-default.list in the/etc directory again

cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

On some computers, there may be an error that MKDIR cannot create the package… The problem occurs because there is no permission to open related files. You can use the Chmod command to obtain permission

sudo chmod 777 /etc
    re execute the above command, open the 20-default.list file, copy the following contents into it, and save

    # os-specific listings first
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/osx-homebrew.yaml osx
    
    # generic
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/base.yaml
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/python.yaml
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/ruby.yaml
    gbpdistro https://gitee.com/BlicNet/rosdistro/releases/fuerte.yaml fuerte
    
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
    

    4. Open the terminal on the desktop and execute the command:

    rosdep update
    

    Solve the problem and keep working hard!

    Reference link

    Link: https://blog.csdn.net/qq_ 41058594/article/details/102970901.
    link: https://www.cnblogs.com/JuiceCat/p/12000953.html.

Error reporting and resolution of #selector above swift5

Error reporting and resolution of #selector above swift5

The version of swift has changed a lot recently. If you add an event to a button, you must be very skilled in OC. How do you define functions and pass parameters in
swift

 let btn = UIButton()
 btn.tag = 2
 btn.addTarget(self, action: #selector(buttonClick(button:)), for: .touchUpInside)

  @objc func buttonClick(button: UIButton) {
       button.isSelected = true
       print(btn.tag!)
        print("\(btn.tag)")
 }

The custom method must be preceded by @ objc to follow the OC mechanism, otherwise an error will be reported

When react devtools is enabled, an error is reported for the project

I installed the latest version of react devtools on the V3 branch. I installed it according to a series of operations in the official documents, and then ran the project to report an error:

However, the previous project was running normally, so I searched the Internet and found that most of them said that the plug-in react devtools was disabled directly, and there was no language. Why do I install it??Too much memory??

So I looked at the error message again, and then commented out the code used in my project according to the following error message

according to its path, and then re yarn start, there was no error message

I read it online and said that this is the reason for the version. I said that the previous version did not have this problem
just sauce, bye!

UOS LTP compilation ustat test item error

environmental information

$ dpkg -l|grep libc6-dev
ii  libc6-dev:mips64el  2.28.12-1+eagle    mips64el  GNU C Library: Development Libraries and Header Files

Error message

~ltp/testcases/kernel/syscalls/ustat$ make
In file included from ../../../../include/tst_test.h:14,
                 from ustat01.c:9:
/usr/include/mips64el-linux-gnuabi64/bits/ustat.h:24:8: error: redefinition of ‘struct statfs’
 struct ustat
        ^~~~~

It shows that the struct ustat is repeatedly defined.

analysis

In the normal environment, the struct ustat structure is not defined. If you want to use this structure, you need to define it yourself. LTP also provides a custom struct ustat structure
where lapi/ustat. H is defined as follows:

//SPDX-License-Identifier: GPL-2.0-or-later

#ifndef LAPI_USTAT_H__
#define LAPI_USTAT_H__

#include "config.h"
#include <sys/types.h>
#ifdef HAVE_SYS_USTAT_H
# include <sys/ustat.h>
#elif HAVE_LINUX_TYPES_H
# include <linux/types.h>
struct ustat {
        __kernel_daddr_t f_tfree;
        ino_t f_tinode;
        char f_fname[6];
        char f_fpack[6];
};
#endif

#endif /* LAPI_USTAT_H__ */

The header file in the test code contains lapi/ustat. H, so the test code is OK.

#include "config.h"
#include "tst_test.h"

#if defined(HAVE_SYS_USTAT_H) || defined(HAVE_LINUX_TYPES_H)
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>

#include "lapi/syscalls.h"
#include "lapi/ustat.h"

According to the error message, it is displayed in… /… /… /…/include/TST_ Test. H: line 14 of 14.

	...
 14 #include <unistd.h>
	 ...

Line 14 is the header file unistd. H, which is the file of libc6 dev package
file content:

...
/* Move FD's file position to OFFSET bytes from the
   beginning of the file (if WHENCE is SEEK_SET),
   the current position (if WHENCE is SEEK_CUR),
   or the end of the file (if WHENCE is SEEK_END).
   Return the new file position.  */


#define llseek lseek     
#define ustat statfs
#ifndef __USE_FILE_OFFSET64
extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
#else
...

There are macro definitions

#define ustat statfs

Simply replacing statfs with ustat leads to the problem of repeatedly defining struct ustat.

Conclusion

After investigation, unistd. H belongs to libc6 dev. the version installed in the current environment is 2.28.12-1 + eagle. These two macros are not added to unistd. H in 2.28.10 and 2.28.14.

#define llseek lseek     
#define ustat statfs

It is speculated that UOS may have modified the source code of glibc. The record of adding these two macros in unistd. H was not found in the public glibc.