public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error from memcpy in cstring
@ 2023-11-09 11:57 Dingjun Chen
  2023-11-09 12:05 ` FW: " Dingjun Chen
  0 siblings, 1 reply; 9+ messages in thread
From: Dingjun Chen @ 2023-11-09 11:57 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1467 bytes --]

Hi, guys,

Please see below and how to fix this error?


PS C:\Users\Dingjun.Chen> g++ --version
g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.


I did include the following head files in _d_dngl.cc

include/c++/13.2.0/cstring


/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:284:9: error: 'memcpy' was not declared in this scope
  284 |         memcpy(aRandom1, aDeCrypt1, 8);
      |         ^~~~~~
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:284:9: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?



I look forward to your help and hearing from you!


Thanks & regards,

Dingjun

Dingjun Chen  | Software Developer

[Geotech Airborne Geophysical Surveys]

Geotech Ltd. dba Geotech Airborne | 270 INDUSTRIAL PKY S | AURORA ON CA | L4G 3T9
T: +1 905 841 5004 | Dingjun.Chen@geotechairborne.com<mailto:Dingjun.Chen@geotechairborne.com> | www.geotechairborne.com<www.geotech.ca>

P Please consider the environment before printing this email

This message may contain PRIVILEGED AND PROPRIETARY INFORMATION intended solely for the use of the addressee (s) named above. Any disclosure, distribution, copying, or use of the information by others is strictly prohibited. If you have received this message in error, please advise the sender by immediate reply and delete the original message.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* FW: Error from memcpy in cstring
  2023-11-09 11:57 Error from memcpy in cstring Dingjun Chen
@ 2023-11-09 12:05 ` Dingjun Chen
  2023-11-09 12:24   ` Xi Ruoyao
  0 siblings, 1 reply; 9+ messages in thread
From: Dingjun Chen @ 2023-11-09 12:05 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 6091 bytes --]

Hi, guys,

More errors occurred from the head file cstring in g++ 13.2.0. Please see below and could someone please tell me how to fix them? I check the head file cstring and did not understand why cstring head file is like that?

I look forward to your solution to the error occurred from the head file cstring.

Thanks again,

Dingjun




In file included from /home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:11:
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:77:11: error: 'memchr' has not been declared in '::'
   77 |   using ::memchr;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:78:11: error: 'memcmp' has not been declared in '::'
   78 |   using ::memcmp;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:79:11: error: 'memcpy' has not been declared in '::'
   79 |   using ::memcpy;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:80:11: error: 'memmove' has not been declared in '::'
   80 |   using ::memmove;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:81:11: error: 'memset' has not been declared in '::'
   81 |   using ::memset;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:82:11: error: 'strcat' has not been declared in '::'
   82 |   using ::strcat;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:83:11: error: 'strcmp' has not been declared in '::'
   83 |   using ::strcmp;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:84:11: error: 'strcoll' has not been declared in '::'
   84 |   using ::strcoll;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:85:11: error: 'strcpy' has not been declared in '::'
   85 |   using ::strcpy;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:86:11: error: 'strcspn' has not been declared in '::'
   86 |   using ::strcspn;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:87:11: error: 'strerror' has not been declared in '::'
   87 |   using ::strerror;
      |           ^~~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:88:11: error: 'strlen' has not been declared in '::'
   88 |   using ::strlen;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:89:11: error: 'strncat' has not been declared in '::'
   89 |   using ::strncat;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:90:11: error: 'strncmp' has not been declared in '::'
   90 |   using ::strncmp;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:91:11: error: 'strncpy' has not been declared in '::'
   91 |   using ::strncpy;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:92:11: error: 'strspn' has not been declared in '::'
   92 |   using ::strspn;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:93:11: error: 'strtok' has not been declared in '::'
   93 |   using ::strtok;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:94:11: error: 'strxfrm' has not been declared in '::'
   94 |   using ::strxfrm;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:95:11: error: 'strchr' has not been declared in '::'
   95 |   using ::strchr;
      |           ^~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:96:11: error: 'strpbrk' has not been declared in '::'
   96 |   using ::strpbrk;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:97:11: error: 'strrchr' has not been declared in '::'
   97 |   using ::strrchr;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:98:11: error: 'strstr' has not been declared in '::'
   98 |   using ::strstr;
      |           ^~~~~~




From: Dingjun Chen
Sent: Thursday, November 9, 2023 6:58 AM
To: gcc-help@gcc.gnu.org
Subject: Error from memcpy in cstring

Hi, guys,

Please see below and how to fix this error?


PS C:\Users\Dingjun.Chen> g++ --version
g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.


I did include the following head files in _d_dngl.cc

include/c++/13.2.0/cstring


/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:284:9: error: 'memcpy' was not declared in this scope
  284 |         memcpy(aRandom1, aDeCrypt1, 8);
      |         ^~~~~~
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:284:9: note: 'memcpy' is defined in header '<cstring>'; did you forget to '#include <cstring>'?



I look forward to your help and hearing from you!


Thanks & regards,

Dingjun


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: FW: Error from memcpy in cstring
  2023-11-09 12:05 ` FW: " Dingjun Chen
@ 2023-11-09 12:24   ` Xi Ruoyao
  2023-11-09 12:26     ` Xi Ruoyao
  0 siblings, 1 reply; 9+ messages in thread
From: Xi Ruoyao @ 2023-11-09 12:24 UTC (permalink / raw)
  To: Dingjun Chen, gcc-help

On Thu, 2023-11-09 at 12:05 +0000, Dingjun Chen wrote:
> In file included from
> /home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:11:
> /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-
> linux-musl/include/c++/13.2.0/cstring:77:11: error: 'memchr' has not
> been declared in '::'
>    77 |   using ::memchr;
>       |           ^~~~~~

It should be defined by the libc (in your configuration, Musl) header
string.h.

Check the output of

echo '#include <cstring>'  | cpp -E -x c++ | grep -F 'string.h'

to see if the compiler is finding the correct string.h.  And view the
string.h file to see if there is something wrong.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: FW: Error from memcpy in cstring
  2023-11-09 12:24   ` Xi Ruoyao
@ 2023-11-09 12:26     ` Xi Ruoyao
  2023-11-09 13:00       ` Dingjun Chen
  0 siblings, 1 reply; 9+ messages in thread
From: Xi Ruoyao @ 2023-11-09 12:26 UTC (permalink / raw)
  To: Dingjun Chen, gcc-help

On Thu, 2023-11-09 at 20:24 +0800, Xi Ruoyao via Gcc-help wrote:
> On Thu, 2023-11-09 at 12:05 +0000, Dingjun Chen wrote:
> > In file included from
> > /home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:11:
> > /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-
> > musl/i686-
> > linux-musl/include/c++/13.2.0/cstring:77:11: error: 'memchr' has not
> > been declared in '::'
> >    77 |   using ::memchr;
> >       |           ^~~~~~
> 
> It should be defined by the libc (in your configuration, Musl) header
> string.h.
> 
> Check the output of
> 
> echo '#include <cstring>'  | cpp -E -x c++ | grep -F 'string.h'

Correction: should be "i686-linux-musl-cpp" instead of "cpp" for your
configuration.

> to see if the compiler is finding the correct string.h.  And view the
> string.h file to see if there is something wrong.
> 

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: FW: Error from memcpy in cstring
  2023-11-09 12:26     ` Xi Ruoyao
@ 2023-11-09 13:00       ` Dingjun Chen
  2023-11-09 13:07         ` LIU Hao
  0 siblings, 1 reply; 9+ messages in thread
From: Dingjun Chen @ 2023-11-09 13:00 UTC (permalink / raw)
  To: Xi Ruoyao, gcc-help

Hi, Ruoyao,


In my CMakeLists.txt, I specify below: 

include_directories(
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include/asm"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "${PROJECT_SOURCE_DIR}/include"
        "/home/Dingjun.Chen/usr/include/rtd"
        "/home/Dingjun.Chen/usr/include/gsc"
     )


The same errors still occurred and then I used the full path to specify in head files as follows:

#include </home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring>
#include </home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp/string.h>


The same errors still occurred.  I do not know why?  Did I do something wrong? 

I look forward to your help! 

Thank you very much for your reply! 

Best regards,

Dingjun 

......................................

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:97:11: error: 'strrchr' has not been declared in '::'
   97 |   using ::strrchr;
      |           ^~~~~~~
/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0/cstring:98:11: error: 'strstr' has not been declared in '::'
   98 |   using ::strstr;
      |           ^~~~~~
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc: In member function 'int dongle_interface::Transform()':
/home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:133:5: error: 'memcpy' was not declared in this scope
  133 |     memcpy(aData1, aArrayToDecode, 8);
      |     ^~~~~~
.............................................







-----Original Message-----
From: Xi Ruoyao <xry111@xry111.site> 
Sent: Thursday, November 9, 2023 7:26 AM
To: Dingjun Chen <Dingjun.Chen@geotechairborne.com>; gcc-help@gcc.gnu.org
Subject: Re: FW: Error from memcpy in cstring

External Email Warning: Do not click any links or open any attachments unless you trust the sender and know the content is safe. From Geotech IT.



On Thu, 2023-11-09 at 20:24 +0800, Xi Ruoyao via Gcc-help wrote:
> On Thu, 2023-11-09 at 12:05 +0000, Dingjun Chen wrote:
> > In file included from
> > /home/Dingjun.Chen/DAQ_XYZCross2_cmake_v5/src/_d_dngl.cc:11:
> > /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-
> > musl/i686-
> > linux-musl/include/c++/13.2.0/cstring:77:11: error: 'memchr' has not 
> > been declared in '::'
> >    77 |   using ::memchr;
> >       |           ^~~~~~
>
> It should be defined by the libc (in your configuration, Musl) header 
> string.h.
>
> Check the output of
>
> echo '#include <cstring>'  | cpp -E -x c++ | grep -F 'string.h'

Correction: should be "i686-linux-musl-cpp" instead of "cpp" for your configuration.

> to see if the compiler is finding the correct string.h.  And view the 
> string.h file to see if there is something wrong.
>

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: FW: Error from memcpy in cstring
  2023-11-09 13:00       ` Dingjun Chen
@ 2023-11-09 13:07         ` LIU Hao
  2023-11-09 13:14           ` Dingjun Chen
  0 siblings, 1 reply; 9+ messages in thread
From: LIU Hao @ 2023-11-09 13:07 UTC (permalink / raw)
  To: Dingjun Chen, Xi Ruoyao, gcc-help


[-- Attachment #1.1: Type: text/plain, Size: 585 bytes --]

在 2023/11/9 21:00, Dingjun Chen 写道:
> PS C:\Users\Dingjun.Chen> g++ --version
> g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 13.2.0

This is the native compiler from x86_64-w64-mingw32 to itself (i.e. native Windows on x86-64)...


> include_directories(
>          "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"

... but you tell it to look for Linux headers? That's not a correct configuration. You will need a 
cross compiler, and maybe linker, etc.



-- 
Best regards,
LIU Hao


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: FW: Error from memcpy in cstring
  2023-11-09 13:07         ` LIU Hao
@ 2023-11-09 13:14           ` Dingjun Chen
  2023-11-09 13:18             ` Xi Ruoyao
  0 siblings, 1 reply; 9+ messages in thread
From: Dingjun Chen @ 2023-11-09 13:14 UTC (permalink / raw)
  To: LIU Hao, Xi Ruoyao, gcc-help

Hi, Hao, 

Yes, you are right. I did use a cross compiler generated by crosstool-NG 1.26.0 with GNU gcc 13.2 and MUSL libc. 

Please see below my full CMakeLists.txt and I look forward to your advice on how to fix it. 


/**********CMakeLists.txt*******************/
cmake_minimum_required(VERSION 3.25.3)

# the name of the target operating system
set(CMAKE_SYSTEM_NAME Linux)

# which C and C++ compiler to use
set(CMAKE_C_COMPILER "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/bin/i686-linux-musl-gcc.exe")
set(CMAKE_CXX_COMPILER "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/bin/i686-linux-musl-g++.exe")


# location of the target environment
set(CMAKE_FIND_ROOT_PATH  "${PROJECT_SOURCE_DIR}"
                          "${PROJECT_SOURCE_DIR}/bin")

# adjust the default behavior of the FIND_XXX() commands:
# search for headers and libraries in the target environment,
# search for programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

project(vtem_xyz VERSION 6.3.3 DESCRIPTION "DAQ VTEM")

message(STATUS "The CMake SOURCE directory is ${CMAKE_SOURCE_DIR}")
message(STATUS "The CMake BINARY directory is ${CMAKE_BINARY_DIR}${CMAKE_SOURCE_DIR}")
message(STATUS "The SOURCE directory of the '${PROJECT_NAME}' project is ${PROJECT_SOURCE_DIR}")
message(STATUS "The BINARY directory of the '${PROJECT_NAME}' project is ${PROJECT_BINARY_DIR}")
message(STATUS "The current SOURCE directory is ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "The current BINARY directory is ${CMAKE_CURRENT_BINARY_DIR}")

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
add_definitions( -DCYGWIN )

include_directories(
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include/asm"
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "${PROJECT_SOURCE_DIR}/include"
        "/home/Dingjun.Chen/usr/include/rtd"
        "/home/Dingjun.Chen/usr/include/gsc"
     )
link_directories(
        "${PROJECT_SOURCE_DIR}/lib"
        )

file(GLOB all_SRCS
        "${PROJECT_SOURCE_DIR}/include/*.hh"
        "${PROJECT_SOURCE_DIR}/src/*.cc"
    )
add_executable(vtem_xyz ${all_SRCS} )
target_link_libraries(vtem_xyz libvga.so libvgagl.so libpthread.so librtd-dm6620.a)
 


-----Original Message-----
From: LIU Hao <lh_mouse@126.com> 
Sent: Thursday, November 9, 2023 8:07 AM
To: Dingjun Chen <Dingjun.Chen@geotechairborne.com>; Xi Ruoyao <xry111@xry111.site>; gcc-help@gcc.gnu.org
Subject: Re: FW: Error from memcpy in cstring

在 2023/11/9 21:00, Dingjun Chen 写道:
> PS C:\Users\Dingjun.Chen> g++ --version
> g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 
> g++13.2.0

This is the native compiler from x86_64-w64-mingw32 to itself (i.e. native Windows on x86-64)...


> include_directories(
>          "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"

... but you tell it to look for Linux headers? That's not a correct configuration. You will need a cross compiler, and maybe linker, etc.



-- 
Best regards,
LIU Hao


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: FW: Error from memcpy in cstring
  2023-11-09 13:14           ` Dingjun Chen
@ 2023-11-09 13:18             ` Xi Ruoyao
  2023-11-09 13:41               ` Dingjun Chen
  0 siblings, 1 reply; 9+ messages in thread
From: Xi Ruoyao @ 2023-11-09 13:18 UTC (permalink / raw)
  To: Dingjun Chen, LIU Hao, gcc-help

On Thu, 2023-11-09 at 13:14 +0000, Dingjun Chen wrote:

> include_directories(
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include/asm"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"

All entries above just seem wrong.

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-
linux-musl/include/c++/13.2.0 should be a default system C++ header
path.

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-
linux-musl/sysroot/usr/include should be a default system header search
paths if --sysroot is used correctly.

The other paths contain internal implementation details, and they should
never be used with -I.

In this case /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-
linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp contains a
string.h, so using it with -I causes #include <string.h> to find a wrong
string.h.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: FW: Error from memcpy in cstring
  2023-11-09 13:18             ` Xi Ruoyao
@ 2023-11-09 13:41               ` Dingjun Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Dingjun Chen @ 2023-11-09 13:41 UTC (permalink / raw)
  To: Xi Ruoyao, LIU Hao, gcc-help

Hi, Ruoyao, 

Thanks indeed for your advice. After I change 'include_directories' below and then the errors occurred before are gone. 

Thanks again and have a great day, 

Best regards, 

Dingjun


include_directories(
        "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
        "${PROJECT_SOURCE_DIR}/include"
        "/home/Dingjun.Chen/usr/include/rtd"
        "/home/Dingjun.Chen/usr/include/gsc"
     )


-----Original Message-----
From: Xi Ruoyao <xry111@xry111.site> 
Sent: Thursday, November 9, 2023 8:19 AM
To: Dingjun Chen <Dingjun.Chen@geotechairborne.com>; LIU Hao <lh_mouse@126.com>; gcc-help@gcc.gnu.org
Subject: Re: FW: Error from memcpy in cstring

External Email Warning: Do not click any links or open any attachments unless you trust the sender and know the content is safe. From Geotech IT.



On Thu, 2023-11-09 at 13:14 +0000, Dingjun Chen wrote:

> include_directories(
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/include/c++/13.2.0"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-linux-musl/sysroot/usr/include/asm"
>         "/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp"

All entries above just seem wrong.

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-
linux-musl/include/c++/13.2.0 should be a default system C++ header path.

/home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-linux-musl/i686-
linux-musl/sysroot/usr/include should be a default system header search paths if --sysroot is used correctly.

The other paths contain internal implementation details, and they should never be used with -I.

In this case /home/Dingjun.Chen/x-tools/HOST-x86_64-pc-cygwin/i686-
linux-musl/lib/gcc/i686-linux-musl/13.2.0/include/ssp contains a string.h, so using it with -I causes #include <string.h> to find a wrong string.h.

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-09 13:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 11:57 Error from memcpy in cstring Dingjun Chen
2023-11-09 12:05 ` FW: " Dingjun Chen
2023-11-09 12:24   ` Xi Ruoyao
2023-11-09 12:26     ` Xi Ruoyao
2023-11-09 13:00       ` Dingjun Chen
2023-11-09 13:07         ` LIU Hao
2023-11-09 13:14           ` Dingjun Chen
2023-11-09 13:18             ` Xi Ruoyao
2023-11-09 13:41               ` Dingjun Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).