[pcre-dev] [Bug 2589] New: CMake: strerror not detected prop…

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2589] New: CMake: strerror not detected properly on WinXX
https://bugs.exim.org/show_bug.cgi?id=2589

            Bug ID: 2589
           Summary: CMake: strerror not detected properly on WinXX
           Product: PCRE
           Version: 10.35 (PCRE2)
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: scooter.phd@???
                CC: pcre-dev@???


CMake does not detect strerror correctly on Windows and HAVE_STRERROR isn't set
in config.h. This results in "inconsistent DLL linkage" errors at link time
when pcre2test.c provides the stub. The problem is the way that the function is
detected in CMakeLists.txt. Below is the suggested way to fix it [tested] (and
secure_getenv and memmove):

----
CHECK_FUNCTION_EXISTS(bcopy         HAVE_BCOPY)
CHECK_FUNCTION_EXISTS(memfd_create  HAVE_MEMFD_CREATE)
## CHECK_FUNCTION_EXISTS(memmove       HAVE_MEMMOVE)
## CHECK_FUNCTION_EXISTS(secure_getenv HAVE_SECURE_GETENV)
## CHECK_FUNCTION_EXISTS(strerror      HAVE_STRERROR)


CHECK_SYMBOL_EXISTS(memmove       "string.h"  HAVE_MEMMOVE)
CHECK_SYMBOL_EXISTS(secure_getenv "stdlib.h"  HAVE_SECURE_GETENV)
CHECK_SYMBOL_EXISTS(strerror      "string.h"  HAVE_STRERROR)
----


CMake's documentation suggests using CHECK_SYMBOL_EXISTS over
CHECK_FUNCTION_EXIST. Moreover, these functions come from specific header
files, which need to be specified (and, thankfully, are the same on both the
Linux and WinXX platforms.)

--
You are receiving this mail because:
You are on the CC list for the bug.