Tag Archives: gnu

[Solved] MSYS2+ fatal error: zlib.h: There is no such file or directory

Operating environment: windows+msys2+vscode

A brief introduction to msys2

MSYS2 (Minimal SYStem 2) is a standalone rewrite of MSYS, mainly for shell command line development environments. It is also a Windows software that builds on Cygwin (POSIX compatibility layer) and MinGW-w64 (from “MinGW-generation”) for better interoperability.

Problem Description: fatal error: zlib.h: There is no such file or directory

There is an error message when executing the makefile file.

Fatal error: zlib.h: There is no such file or directory

After carefully checking the header file library, it is clear that this header file exists. And I ruled out the possibility of incorrect environment configuration.

Therefore, I open the GUI of msys2. Try other possible solutions.

Enter at the command line

pacman -Ss zlib

The explanation of this command is to find related resources with the keyword “zlib”.

The search result is

At first, the only modules that showed up as installed were msys/zlib 1.2.12-2 (libraries) and msys/perl 5.32.1-2 (base-devel).

I found that the last one felt quite like what I needed, after all, it was installed and not used at best, so I gave it a try, just in case it worked. So I’m going to install msys/zlib-devel 1.2.12-2 (development) as well!

Solution

The command to install msys/zlib-devel 1.2.12-2 (development) is:

pacman -S zlib-devel

Successfully solved the problem!

[Solved] VScode Run C++ File Error: fatal error:opencv2\core.hpp:No such file or diretory

Run c++ file with vscode error: fatal error: opencv2\core.hpp:No such file or diretory

The main error is that the corresponding header file cannot be found in the header file directory!
C header file directory %MINGW_PATH%/include under the header file, which has strcpy and other c function declaration.
C++ header file directory %MINGW_PATH%/lib/gcc/mingw32/4.4.0/include/c++ under the header file, which has the declaration of std::string class.
//home directory
MINGW_PATH=D:/MinGW

//C header file directory
C_INCLUDE_PATH=%MINGW_PATH%/include;%MINGW_PATH%/lib/gcc/mingw32/3.4.5/include

//C++ header file directory
CPLUS_INCLUDE_PATH=%MINGW_PATH%/include/c++/3.4.5;%MINGW_PATH%/include/c++/3.4.5/mingw32;%MINGW_PATH%/include/c++/3.4.5/backward;% C_INCLUDE_PATH%

//In QTSDK with MinGW the C++ header files are in the lib folder
CPLUS_INCLUDE_PATH=%MINGW_PATH%/lib/gcc/mingw32/4.4.0/include/c++;%C_INCLUDE_PATH%

//library directory
LIBRARY_PATH=%MINGW_PATH%/lib;%MINGW_PATH%/lib/gcc/mingw32/3.4.5

//executable program directory
PATH=%MINGW_PATH%/bin;%MINGW_PATH%/libexec/gcc/mingw32/3.4.5

[Solved] lto1: fatal error: bytecode stream..generated with LTO version 6.2 instead of the expected 8.1 compi

ubuntu Compile libxml2-2.9.1
./configure & make & make install
Error Messages:

lto1: fatal error: bytecode stream in file ‘/home/…/anaconda3/envs/rasa/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a’ generated with LTO version 6.2 instead of the expected 8.1
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:519: libxml2mod.la] Error 1
make[4]: Leaving directory ‘/home/…/libxml2-2.9.1/python’
make[3]: *** [Makefile:607: all-recursive] Error 1
make[3]: Leaving directory ‘/home/…/libxml2-2.9.1/python’
make[2]: *** [Makefile:450: all] Error 2
make[2]: Leaving directory ‘/home/…/libxml2-2.9.1/python’
make[1]: *** [Makefile:1304: all-recursive] Error 1
make[1]: Leaving directory ‘/home/…/libxml2-2.9.1’
make: *** [Makefile:777: all] Error 2

 

Solution:
conda install -c anaconda gcc_linux-64

[Solved] xacro: error: expected exactly one input file as argument

xacro: error: expected exactly one input file as argument RLException: Invalid tag: Cannot load command parameter [robot_description]: command ……
Param xml is <param command="$(find xacro)/xacro $(find rot_cararm)/urdf/robot_base
/base .urdf.xacro" name="robot_description"/>
The traceback for the exception was written to the log file

Reason: There is an extra space before “/base .urdf.xacro”
Can run after modification
File names with spaces cannot be used in the workspace path where the ROS function package is located

error: unrecognized argument in option ‘-mabi=apcs-gnu‘

This is the problem I encountered when compiling rtl8723du and executing makefile:

aarch64-buildroot-linux-gnu-gcc.br_real: error: unrecognized argument in option '-mabi=apcs-gnu'
aarch64-buildroot-linux-gnu-gcc.br_real: note: valid arguments to '-mabi=' are: ilp32 lp64
aarch64-buildroot-linux-gnu-gcc.br_real: error: unrecognized command line option '-mapcs'
aarch64-buildroot-linux-gnu-gcc.br_real: error: unrecognized command line option '-mno-sched-prolog'
aarch64-buildroot-linux-gnu-gcc.br_real: error: unrecognized command line option '-msoft-float'

Let me say the conclusion first. In fact, this is the problem of conflict between the compilation target architecture. The tool chain I use is aarch64 builderoot Linux GNU GCC, which is the tool chain for compiling arm64 architecture, but the architecture in makefile is arch: = arm. Therefore, my modification is to change the architecture to arm64, that is, arch: = arm64.

Compiler problem, error: ‘for’ loop initial declarations are only allowed in C99 mode

using GCC to compile the code is to report

error: ‘for’ loop initial declarations are only allowed in C99 mode

note: use option -std=c99 or -std=gnu99 to compile your code

The

error is due to the increment being initialized in GCC directly in the for loop:

  1. for (int I = 0; I< len; I++) {
  2. }

    this syntax is incorrect in GCC, you must first define the I variable:

    1. int I;
    2. for (I = 0; i< len; I++) {
    3. }

      this is because GCC is based on the c89 standard, instead of the C99 standard, you can define the I variable within the for loop:

      gcc src.c -std=c99 -o src