Source: odc
Version: 1.5.0-1
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

odc fails to cross build from source, because the upstream
CMakeLists.txt tries really hard to not build on 32bit platforms. It
verifies that sizeof(long) and sizeof(double) are 64bit in three
different ways, two of which require running a program. Running a
compiled program is what really does not work at all during cross
compilation, so those checks fail. I propose removing the redundant
checks and only leaving the check_type_size ones, because they should be
sufficient to ensure the property and they work with cross compilation.
I'm attaching a patch for your convenience.

Applying this patch will not make odc cross buildable. I've filed a
separate bug against dh-fortran-mod about another problem. Still close
this bug when addressing the cmake checks.

Helmut
--- odc-1.5.0.orig/CMakeLists.txt
+++ odc-1.5.0/CMakeLists.txt
@@ -22,42 +22,6 @@
 
 ### long and double must be 64 bits exactly
 
-# test by c compilation
-ecbuild_check_c_source_return(
-    "#include <stdio.h>\nint main(){printf(\"%ld\",sizeof(long));return 0;}"
-    VAR check_long_final
-    OUTPUT __sizeof_long_final
-)
-ecbuild_check_c_source_return(
-    "#include <stdio.h>\nint main(){printf(\"%ld\",sizeof(double));return 0;}"
-    VAR check_double_final
-    OUTPUT __sizeof_double_final
-)
-
-if( NOT check_long_final OR NOT __sizeof_long_final EQUAL "8" )
-    message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} (${EC_OS_BITS} bits) and sizeof long [${__sizeof_long_final}] -- long must be 64 bits exactly" )
-elseif( NOT check_double_final OR NOT __sizeof_double_final EQUAL "8" )
-    message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} (${EC_OS_BITS} bits) and sizeof double [${__sizeof_double_final}] -- double must be 64 bits exactly" )
-endif()
-
-# test by cxx compilation
-ecbuild_check_cxx_source_return(
-    "#include <iostream>\nint main(){ std::cout << sizeof(long);return 0;}"
-    VAR cxx_check_long_final
-    OUTPUT __cxx_sizeof_long_final
-)
-ecbuild_check_cxx_source_return(
-    "#include <iostream>\nint main(){ std::cout << sizeof(double);return 0;}"
-    VAR cxx_check_double_final
-    OUTPUT __cxx_sizeof_double_final
-)
-
-if( NOT cxx_check_long_final OR NOT __cxx_sizeof_long_final EQUAL "8" )
-    message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} (${EC_OS_BITS} bits) and sizeof long [${__cxx_sizeof_long_final}] -- long must be 64 bits exactly" )
-elseif( NOT cxx_check_double_final OR NOT __cxx_sizeof_double_final EQUAL "8" )
-    message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} (${EC_OS_BITS} bits) and sizeof double [${__cxx_sizeof_double_final}] -- double must be 64 bits exactly" )
-endif()
-
 check_type_size( long ODC_SIZEOF_LONG )
 check_type_size( double ODC_SIZEOF_DOUBLE )
 

Reply via email to