office-gobmx/external/coinmp/configure-exit.patch
Stephan Bergmann 762aacc4e0 exteranl/coinmp: Fix build with recent GCC 11 trunk
It had started to fail for me now with

>  ~/gcc/trunk/inst/bin/g++ -DHAVE_CONFIG_H -I. -I. -O -MT CoinFinite.lo -MD -MP -MF .deps/CoinFinite.Tpo -c CoinFinite.cpp  -fPIC -DPIC -o .libs/CoinFinite.o
> CoinFinite.cpp: In function 'bool CoinFinite(double)':
> CoinFinite.cpp:38:19: error: 'DBL_MAX' was not declared in this scope
>    38 |     return val != DBL_MAX && val != -DBL_MAX;
>       |                   ^~~~~~~
> CoinFinite.cpp:8:1: note: 'DBL_MAX' is defined in header '<cfloat>'; did you forget to '#include <cfloat>'?
>     7 | #include "CoinUtilsConfig.h"
>   +++ |+#include <cfloat>
>     8 |

because of a missing -DCOINUTILS_BUILD.  Which in turn was caused by
workdir/UnpackedTarball/coinmp/CoinUtils/configure (see
workdir/UnpackedTarball/coinmp/CoinUtils/config.log), which first tries to
determine an ac_declaration that would apparently be a suitable declaration of
`exit` without actually including <stdlib.h> in a C++ file.  It settles on

> configure:3551: ~/gcc/trunk/inst/bin/g++ -c -g -O2  conftest.cc >&5
> conftest.cc:15:17: warning: 'void std::exit(int)' has not been declared within 'std'
>    15 | extern "C" void std::exit (int) throw (); using std::exit;
>       |                 ^~~
> <built-in>: note: only here as a 'friend'
> configure:3557: $? = 0

(which generates a warning, but no error with the given g++ invocation).  The
determined ac_declaration value is then included in confdefs.h, causing the
later

> configure:4014: ~/gcc/trunk/inst/bin/g++ -o conftest -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCOINUTILS_BUILD  -Wl,-z,origin -Wl,-rpath,\$$ORIGIN conftest.cc  >&5
> conftest.cc:15:17: error: 'void std::exit(int)' has not been declared within 'std'
>    15 | extern "C" void std::exit (int) throw (); using std::exit;
>       |                 ^~~
> <built-in>: note: only here as a 'friend'
> configure:4020: $? = 1
> configure: failed program was:
> | /* confdefs.h.  */
> |
> | #define PACKAGE_NAME "CoinUtils"
> | #define PACKAGE_TARNAME "coinutils"
> | #define PACKAGE_VERSION "2.9.11"
> | #define PACKAGE_STRING "CoinUtils 2.9.11"
> | #define PACKAGE_BUGREPORT "http://projects.coin-or.org/CoinUtils"
> | #define COINUTILS_VERSION "2.9.11"
> | #define COINUTILS_VERSION_MAJOR 2
> | #define COINUTILS_VERSION_MINOR 9
> | #define COINUTILS_VERSION_RELEASE 11
> | #define COIN_COINUTILS_VERBOSITY 0
> | #define COIN_COINUTILS_CHECKLEVEL 0
> | #ifdef __cplusplus
> | extern "C" void std::exit (int) throw (); using std::exit;
> | #endif
> | /* end confdefs.h.  */
> |
> | int
> | main ()
> | {
> | int i=0; i++;
> |   ;
> |   return 0;
> | }
> configure:4045: WARNING: The flags CXXFLAGS="-O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DCOINUTILS_BUILD" do not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.

to fail, because its g++ invocation including -pedantic-errors turns that

> 'void std::exit(int)' has not been declared within 'std'

warning into an error.

There were similar build failures in the Cgl,

>  ~/gcc/trunk/inst/bin/g++ -DHAVE_CONFIG_H -I. -I. -I~/lo/core/workdir/UnpackedTarball/coinmp/CoinUtils/src -DCOIN_HAS_CLP -O -MT ClpCholeskyDense.lo -MD -MP -MF .deps/ClpCholeskyDense.Tpo -c ClpCholeskyDense.cpp  -fPIC -DPIC -o .libs/ClpCholeskyDense.o
> In file included from ClpCholeskyDense.cpp:11:
> ClpHelperFunctions.hpp:16:4: error: #error "don't have header file for math"
>    16 | #  error "don't have header file for math"
>       |    ^~~~~
> In file included from ClpCholeskyDense.cpp:11:
> ClpHelperFunctions.hpp: In function 'double CoinSqrt(double)':
> ClpHelperFunctions.hpp:81:13: error: 'sqrt' was not declared in this scope
>    81 |      return sqrt(x);
>       |             ^~~~

and Clp,

>  ~/gcc/trunk/inst/bin/g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./.. -I./../CglGomory -I~/lo/core/workdir/UnpackedTarball/coinmp/CoinUtils/src -I~/lo/core/workdir/UnpackedTarball/coinmp/Osi/src/Osi -I~/lo/core/workdir/UnpackedTarball/coinmp/CoinUtils/src -I~/lo/core/workdir/UnpackedTarball/coinmp/Clp/src/OsiClp -I~/lo/core/workdir/UnpackedTarball/coinmp/Clp/src -I~/lo/core/workdir/UnpackedTarball/coinmp/CoinUtils/src -I~/lo/core/workdir/UnpackedTarball/coinmp/Osi/src/Osi -O -MT CglLandPValidator.lo -MD -MP -MF .deps/CglLandPValidator.Tpo -c CglLandPValidator.cpp  -fPIC -DPIC -o .libs/CglLandPValidator.o
> CglLandPValidator.cpp: In member function 'int LAP::Validator::cleanCut(OsiRowCut&, const double*, const OsiSolverInterface&, const CglParam&, const double*, const double*)':
> CglLandPValidator.cpp:66:22: error: 'fabs' was not declared in this scope; did you mean 'labs'?
>    66 |         double val = fabs(elems[i]);
>       |                      ^~~~
>       |                      labs
> CglLandPValidator.cpp: In member function 'int LAP::Validator::cleanCut2(OsiRowCut&, const double*, const OsiSolverInterface&, const CglParam&, const double*, const double*)':
> CglLandPValidator.cpp:189:23: error: 'fabs' was not declared in this scope; did you mean 'labs'?
>   189 |     double smallest = fabs(rhs);
>       |                       ^~~~
>       |                       labs

subdirectories, and which happened to get solved by the same approach of
removing problematic ac_declaration values from configure.

I am not sure what all that magic of determining that ac_declaration value is
supposed to be good for.  There appears to be no trace of it in the
corresponding configure.ac sources, so it likely was automatically added by some
dated autotools (all three configure files mention "Generated by GNU
Autoconf 2.59").  At least on a cursory look, the determined ac_declaration
appears to only be used in configure itself, and not leak into the actual coinmp
build stage, so dropping the problematic ac_declaration values is hopefully
harmless.  These three subdirectories were all that failed for me, but there
might still be silent issues in other subdirectories when a problematic
ac_declaration value would negatively affect other configure checks.  (An
alternative approach could be to regenerate all the configure files from their
configure.ac sources with a recent autotools.  But at least some of the existing
external/coinmp/*.patch* already change such configure files, which would need
to be adapted.)

Change-Id: I0a33b0f654800e8288d3ca28e26a64efc23a3f6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103756
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-10-01 14:11:11 +02:00

33 lines
987 B
Diff

--- Cgl/configure
+++ Cgl/configure
@@ -3501,8 +3501,6 @@
fi
for ac_declaration in \
'' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
--- Clp/configure
+++ Clp/configure
@@ -3528,8 +3528,6 @@
fi
for ac_declaration in \
'' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
--- CoinUtils/configure
+++ CoinUtils/configure
@@ -3527,8 +3527,6 @@
fi
for ac_declaration in \
'' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'