Bug#885845: netcdf FTCBFS: CHECK_C_SOURCE_RUNS

2017-12-30 Thread Sebastiaan Couwenberg
Control: tags -1 upstream pending
Control: forwarded -1 https://github.com/Unidata/netcdf-c/issues/753

Hi Helmut,

On 12/30/2017 11:35 AM, Helmut Grohne wrote:
> netcdf fails to cross build from source, because it uses
> CHECK_C_SOURCE_RUNS. Fortunately, the only relevant check can easily be
> turned into CHECK_C_SOURCE_COMPILES (by exploiting that arrays of
> negative length cause a compile error). After doing so, netcdf cross
> builds successfully. Please consider applying the attached patch.

Thanks for the patch, I've applied it in git and forwarded it upstream.

The upstream developers may not apply your patch before you sign their
CLA. Please keep an eye on the issue in the upstream tracker.

Kind Regards,

Bas



Bug#885845: netcdf FTCBFS: CHECK_C_SOURCE_RUNS

2017-12-30 Thread Helmut Grohne
Source: netcdf
Version: 1:4.5.0-1
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap

netcdf fails to cross build from source, because it uses
CHECK_C_SOURCE_RUNS. Fortunately, the only relevant check can easily be
turned into CHECK_C_SOURCE_COMPILES (by exploiting that arrays of
negative length cause a compile error). After doing so, netcdf cross
builds successfully. Please consider applying the attached patch.

Helmut
Index: netcdf-4.5.0/CMakeLists.txt
===
--- netcdf-4.5.0.orig/CMakeLists.txt
+++ netcdf-4.5.0/CMakeLists.txt
@@ -93,7 +93,6 @@
 INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
 INCLUDE(${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
 INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceCompiles.cmake)
-INCLUDE(${CMAKE_ROOT}/Modules/CheckCSourceRuns.cmake)
 INCLUDE(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
 INCLUDE(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
 INCLUDE(${CMAKE_ROOT}/Modules/GetPrerequisites.cmake)
@@ -1194,14 +1193,12 @@
 SET(SIGNED_TEST_SOURCE "\n
   #include \n
   int main(void) {\n
-char is_signed = (char) - 1;\n
-if(is_signed < 0)\n
-  return 1;\n
-else\n
-  return 0;\n
+char error_if_char_is_signed[((char)-1) < 0 ? -1 : 1];\n
+error_if_char_is_signed[0] = 0;
+return 0;\n
 }\n")
 
-CHECK_C_SOURCE_RUNS("${SIGNED_TEST_SOURCE}" __CHAR_UNSIGNED__)
+CHECK_C_SOURCE_COMPILES("${SIGNED_TEST_SOURCE}" __CHAR_UNSIGNED__)
 
 # Library include checks
 CHECK_INCLUDE_FILE("math.h"  HAVE_MATH_H)