Category Archives: Linux

[Solved] Centos error: collect2: fatal error: cannot find ‘ld‘

When executing a compiled file in Linux (. /configure) with collect2: fatal error: cannot find ‘ld’, which is also preceded by gcc: error: unrecognized command line option -V and configure: error: C compiler cannot create executables. When you find that your gcc and the corresponding dependency packages are installed, you still get the error. At this point you look under /usr/bin/ to see if there is an ld. which ld is not found, but you find a file called ld.gold under /usr/bin by running ls -l |grep ld.

Solution:

Copy ld.gold under /usr/bin/ (do not delete the original file) and rename it to ld. You can also create a soft connection.

Re-execute the compilation

Problem found solved!

Brief description.

gcc compiles the source code to .o, then linker links the .o to .so or executable, linker can use ld.bfd, ld.gold or lld.

Linux Error: CMake Error in CMakeLists.txt: No CMAKE_CXX_COMPILER could be found.

– The C compiler identification is GNU 7.5.0
– The CXX compiler identification is unknown
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info – done
– Detecting C compile features
– Detecting C compile features – done
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
– Configuring incomplete, errors occurred!
See also “/home/dragon/Desktop/v1.0.3/onboard-api/build/CMakeFiles/CMakeOutput.log”.
See also “/home/dragon/Desktop/v1.0.3/onboard-api/build/CMakeFiles/CMakeError.log”.

Solution:

sudo apt install -y build-essential

Nginx Error: SSL: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small


ubuntu20.04 nginx startup error:

root@ubuntu:/etc/nginx/conf.d# nginx -s reload
nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl” directive instead in /etc/nginx/conf.d/xx.conf:12
nginx: [emerg] SSL_CTX_use_certificate("/etc/nginx/conf.d/crt/server.crt") failed (SSL: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small)

 

Solution: When generating the secret key, the command is as follows
openssl genrsa -des3 -out server.key 1024
Modify to
openssl genrsa -des3 -out server.key 2048

How to fix the ERROR: Failed to build gem native extension in Centos 8

[root@DBAMAXWELL ~]# gem install mongo

Building native extensions. This could take a while...
ERROR:  Error installing mongo:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/bson-4.14.1/ext/bson
/usr/bin/ruby -r ./siteconf20220325-427526-vfnj46.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/bson-4.14.1 for inspection.
Results logged to /usr/local/lib64/gems/ruby/bson-4.14.1/gem_make.out

 

Solution:
[root@DBAMAXWELL ~]# yum install ruby-devel

Last metadata expiration check: 1:48:48 ago on Fri 25 Mar 2022 05:54:43 PM CST.
Dependencies resolved.
===============================================================================================================================================================================================================
 Package                                     Architecture                            Version                                                                  Repository                                  Size
===============================================================================================================================================================================================================
Installing:
 ruby-devel                                  x86_64                                  2.5.9-109.module_el8.5.0+1097+b05a0601                                   appstream                                  126 k

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total download size: 126 k
Installed size: 294 k
Is this ok [y/N]: y
Downloading Packages:
[MIRROR] ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64.rpm: Curl error (28): Timeout was reached for http://centosg9.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/ruby-devel-2.5.9-109.module_el8.5.0%2b1097%2bb05a0601.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64.rpm                                                                                                                   1.6 kB/s | 126 kB     01:17    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                          1.6 kB/s | 126 kB     01:18     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                       1/1 
  Installing       : ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 
  Running scriptlet: ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 
  Verifying        : ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64                                                                                                                              1/1 

Installed:
  ruby-devel-2.5.9-109.module_el8.5.0+1097+b05a0601.x86_64

Complete!

[root@DBAMAXWELL ~]# gem install mongo
Building native extensions. This could take a while…
Successfully installed bson-4.14.1
Fetching: mongo-2.17.0.gem (100%)
Successfully installed mongo-2.17.0
2 gems installed
[root@DBAMAXWELL ~]#

./configure Command Execute error (Centos7 Install erlang)

Windows uploads Erlang installation package to virtual machine

Install the file upload program:

# yum install -y lrzsz

Upload file:

# rz

Unzip package:

# tar -zxvf otp_src_24.3.2.tar.gz

Enter the decompression Directory:

# cd /-My_PATH-/otp_src_24.3.2/

Execute “./configure –prefix=/usr/local/erlang” command error:

[root@localhost otp_src_24.3.2]# ./configure --prefix=/usr/local/erlang
=== Running configure in /usr/local/software/otp_src_24.3.2/erts ===
./configure '--prefix=/usr/local/erlang' --disable-option-checking --cache-file=/dev/null --srcdir="/usr/local/software/otp_src_24.3.2/erts"
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/software/otp_src_24.3.2/erts':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: /usr/local/software/otp_src_24.3.2/erts/configure failed!
Killed

Solution:

Install C + + compilation environment: sudo yum install gcc-c++

[root@localhost otp_src_24.3.2]# sudo yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
Resolving Dependencies

--------------------------省略!!------------------------

Installed:
  gcc-c++.x86_64 0:4.8.5-44.el7                                                                            

Dependency Installed:
  cpp.x86_64 0:4.8.5-44.el7                               gcc.x86_64 0:4.8.5-44.el7                       
  glibc-devel.x86_64 0:2.17-325.el7_9                     glibc-headers.x86_64 0:2.17-325.el7_9           
  kernel-headers.x86_64 0:3.10.0-1160.59.1.el7            libmpc.x86_64 0:1.0.1-3.el7                     
  libstdc++-devel.x86_64 0:4.8.5-44.el7                   mpfr.x86_64 0:3.1.1-4.el7                       

Dependency Updated:
  glibc.x86_64 0:2.17-325.el7_9                    glibc-common.x86_64 0:2.17-325.el7_9                   

Complete!

After installation, re-execute . /configure command again and found a new problem.

configure: error: Perl version 5 is required to build the emulator!
ERROR: /usr/local/otp_src_24.3.2/erts/configure failed!
Killed

Then we install another one

# yum install perl

Then there are new problems:

configure: error: No curses library functions found
ERROR: /usr/local/otp_src_24.3.2/erts/configure failed!
Killed

At this time, you need to install the log Library:

# yum -y install ncurses-devel

Then re-execute ./configure command, no exception~

Set environment variables:

# vi /etc/profile

Press Enter to go to the bottom, then press keyboard i to enter edit mode and configure the environment variables.

#set erlang environment
export PATH=$PATH:/usr/local/erlang/bin

After the configuration is completed, press ESC to exit the editing mode and enter the Save command:

:wq

Refresh the profile to take effect:

# source /etc/profile

Check whether Erlang is successfully installed:

[root@localhost otp_src_24.3.2]# erl -version
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 12.3

Done!

[Solved] Ubuntu pip Install Error: which is not on PATH

First, let’s take a look at the warning information

  WARNING: The script normalizer is installed in '/home/llxy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Solution: Configure environment variables

gedit ~/.bashrc
# Add the path at the end of the file, which comes from the warning issued when installing pip in the first step
export PATH=/home/llxy/.local/bin:$PATH
source ~/.bashrc

[Solved] rs_to_velodyne-master compile Error: POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature

rs_to_velodyne-master compile Error:

/usr/include/pcl-1.10/pcl/point_types.h:574:1: error: ‘plus’ is not a member of ‘pcl::traits’
  574 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::CPPFSignature,

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘plusscalar’ is not a member of ‘pcl::traits’
  588 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘type’ is not a member of ‘pcl::traits::datatype<pcl::PPFRGBSignature, pcl::fields::f4>::decomposed’ {aka ‘pcl::traits::decomposeArray<float>’}

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘plusscalar’ is not a member of ‘pcl::traits’
  588 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
......

 



 
解决方法:
在对应程序包的CMakeLists.txt中加入一行代码即可顺利编译。

Solution:
Add the following line in CMakeLists.txt of the corresponding program package:
set(CMAKE_CXX_STANDARD 14)

You can also use the same method when compiling other packages with the same error!

[Solved] Linux gcc Compile Error: unknown type name ‘bool‘

Error description

error: unknown type name ‘bool’; did you mean ‘_Bool’?

Cause of error
Unknown type name: ‘bool’, because the boolean type is not defined in the C standard (C89), so it will report an error. C99 provides a header file that defines bool, true for 1 and false for 0. Just import stdbool.h and you can manipulate boolean types very easily.

Solution:

//add the header file 
#include <stdbool.h>

Linux Error: error:Failed dependencies [How to Solve]

1. problem description

When I tried to install the RPM package of vscode in Ubuntu, the following error occurred:

[root@localhost src]# rpm -ivh code-insider-1.66.0-1647322605.el7.x86_64.rpm
error: Failed dependencies:
	code-insider conflicts with (installed) code-insider-1.66.0-1647322605.el7.x86_64

 

2. solution

Add two parameters –nodeps --force or –force --nodeps after the installation package, and ignore the error message for installation. For example:

– force means mandatory installation
– nodeps means that dependencies are not checked during installation

Enter the following code:

rpm -ivh –nodeps --force code-insider-1.66.0-1647322605.el7.x86_64.rpm

Problem-solving.

yum: Error: Failed to download metadata for repo ‘aliyun-AppStream‘: Cannot download repomd.xml

preface

centos8 stopped the service of source on December 31, 2021

The current system is CentOS

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 8.5.2111
[root@localhost ~]# 

Yum error message

[root@localhost ~]# yum install ipmitool
CentOS-8 - AppStream                                                                                                                                                                   439  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 182.105.147.113)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost ~]# 

Solution

1. Execute the following commands

[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum update -y
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             437  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 124.225.134.244)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

2. If the problem is not solved, do the following:

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:08:42--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.241, 124.225.134.239, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo                    100%[===================================================================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:08:47 (49.0 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum clean all
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
18 files removed
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum makecache
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             428  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 119.41.210.242)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# 

3. Then perform the following operations

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv  *.repo  bak
[root@localhost yum.repos.d]# ls
bak
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:10:10--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.239, 124.225.134.241, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.239|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo   100%[==================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:10:15 (98.3 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum clean all
0 files removed
[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                     454 kB/s | 4.6 MB     00:10    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                                                                    1.0 kB/s |  10 kB     00:10    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                                                                                 571 kB/s | 8.4 MB     00:15    
Metadata cache created.
[root@localhost yum.repos.d]# ls 
bak  CentOS-Base.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum install ipmitool
Last metadata expiration check: 0:00:27 ago on Tue 22 Mar 2022 08:10:54 PM CST.
Dependencies resolved.
=================================================================================================================================================================================================================
 Package                                          Architecture                                   Version                                                 Repository                                         Size
=================================================================================================================================================================================================================
Installing:
 ipmitool                                         x86_64                                         1.8.18-18.el8                                           AppStream                                         395 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 395 k
Installed size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
ipmitool-1.8.18-18.el8.x86_64.rpm                                                                                                                                                 71 kB/s | 395 kB     00:05    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             71 kB/s | 395 kB     00:05     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                         1/1 
  Installing       : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Running scriptlet: ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Verifying        : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 

Installed:
  ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                                                  

Complete!
[root@localhost yum.repos.d]#

At this point, you can use the yum install command.

Failed to find Qt component “Widgets“ [How to Solve]

In the project, QT6 is used 2.1 after installing QT, this error is reported when QtCreator is used:

but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "Widgets" config file at ""

The reason is that although QT has been installed, some other libraries QT depends on have not been installed:

I use Ubuntu system: use the following command to install (OpenGL installation)

sudo apt-get install build-essential libgl1-mesa-dev