Bug 247763 - math/suitesparse: Fails to build: error: implicit conversion from 'long' to 'double' (-Werror)
Summary: math/suitesparse: Fails to build: error: implicit conversion from 'long' to '...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-04 16:51 UTC by rsmith
Modified: 2020-07-05 14:56 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+
thierry: merge-quarterly-


Attachments
Patch for in /usr/ports/math/suitesparse/files. (432 bytes, text/plain)
2020-07-04 16:51 UTC, rsmith
no flags Details
Patch to remove extra CFLAGS (including -Werror) from SLIP_LU Makefile (396 bytes, patch)
2020-07-05 07:21 UTC, rsmith
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rsmith 2020-07-04 16:51:12 UTC
Created attachment 216198 [details]
Patch for in /usr/ports/math/suitesparse/files.

When building the new suitesparse 5.8.0, I get the following error:

gmake[4]: Entering directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0/SLIP_LU/Lib'
gmake install INSTALL=/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0
gmake[5]: Entering directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0/SLIP_LU/Lib'
cc -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wall -Wextra -Wpedantic -Werror -Wall -Wextra -Wpedantic -Werror -isystem /usr/local/include  -O3 -fexceptions -fPIC -fopenmp -I../Include -I../../COLAMD/Include -I../../AMD/Include -I../../SuiteSparse_config  -c ../Source/slip_matrix_div.c
cc -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wall -Wextra -Wpedantic -Werror -Wall -Wextra -Wpedantic -Werror -isystem /usr/local/include  -O3 -fexceptions -fPIC -fopenmp -I../Include -I../../COLAMD/Include -I../../AMD/Include -I../../SuiteSparse_config  -c ../Source/slip_create_mpq_array.c
cc -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wall -Wextra -Wpedantic -Werror -Wall -Wextra -Wpedantic -Werror -isystem /usr/local/include  -O3 -fexceptions -fPIC -fopenmp -I../Include -I../../COLAMD/Include -I../../AMD/Include -I../../SuiteSparse_config  -c ../Source/SLIP_free.c
cc -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wall -Wextra -Wpedantic -Werror -Wall -Wextra -Wpedantic -Werror -isystem /usr/local/include  -O3 -fexceptions -fPIC -fopenmp -I../Include -I../../COLAMD/Include -I../../AMD/Include -I../../SuiteSparse_config  -c ../Source/SLIP_LU_factorize.c
In file included from ../Source/slip_create_mpq_array.c:15:
../Source/slip_internal.h:663:18: error: implicit conversion from 'long' to 'double' changes value from
      9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
    else if (x > INT64_MAX)
               ~ ^~~~~~~~~
/usr/include/x86/_stdint.h:90:19: note: expanded from macro 'INT64_MAX'
#define INT64_MAX       0x7fffffffffffffff
                        ^~~~~~~~~~~~~~~~~~
In file included from ../Source/slip_matrix_div.c:26:
../Source/slip_internal.h:663:18: error: implicit conversion from In file included from ../Source/SLIP_free.c:13:
../Source/slip_internal.h:663:18: error: implicit conversion from 'long' to 'double' changes value from
      9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
'long'    else if (x > INT64_MAX)
               ~ ^~~~~~~~~
 /usr/include/x86/_stdint.h:90:19: note: expanded from macro 'INT64_MAX'
to#define INT64_MAX       0x7fffffffffffffff
                        ^~~~~~~~~~~~~~~~~~
 'double' changes value from
      9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
    else if (x > INT64_MAX)
               ~ ^~~~~~~~~
/usr/include/x86/_stdint.h:90:19: note: expanded from macro 'INT64_MAX'
#define INT64_MAX       0x7fffffffffffffff1 error generated.

                        ^~~~~~~~~~~~~~~~~~
1 error generated.
In file included from ../Source/SLIP_LU_factorize.c:40:
../Source/slip_internal.h:663:18: error: implicit conversion from 'long' to 'double' changes value from
      9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
    else if (x > INT64_MAX)
               ~ ^~~~~~~~~
/usr/include/x86/_stdint.h:90:19: note: expanded from macro 'INT64_MAX'
gmake[5]: *** [Makefile:46: SLIP_free.o] Error 1
#define INT64_MAX       0x7fffffffffffffffgmake[5]: *** Waiting for unfinished jobs....

                        ^~~~~~~~~~~~~~~~~~
gmake[5]: *** [Makefile:46: slip_create_mpq_array.o] Error 1
1 error generated.
gmake[5]: *** [Makefile:46: slip_matrix_div.o] Error 1
1 error generated.
gmake[5]: *** [Makefile:46: SLIP_LU_factorize.o] Error 1
gmake[5]: Leaving directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0/SLIP_LU/Lib'
gmake[4]: *** [Makefile:53: library] Error 2
gmake[4]: Leaving directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0/SLIP_LU/Lib'
gmake[3]: *** [Makefile:32: library] Error 2
gmake[3]: Leaving directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0/SLIP_LU'
gmake[2]: *** [Makefile:144: library] Error 2
gmake[2]: Leaving directory '/usr/ports/math/suitesparse/work/SuiteSparse-5.8.0'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/math/suitesparse
*** Error code 1

Stop.
make: stopped in /usr/ports/math/suitesparse

A small modification to slip__internal.h (making the conversion explicit) fixes this issue.
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-07-04 18:44:05 UTC
A commit references this bug:

Author: thierry
Date: Sat Jul  4 18:43:31 UTC 2020
New revision: 541233
URL: https://svnweb.freebsd.org/changeset/ports/541233

Log:
  Fix an implicit conversion from long to double.

  PR:		247763
  Submitted by:	rsmith (at) xs4all.nl

Changes:
  head/math/suitesparse/files/
  head/math/suitesparse/files/patch-SLIP__LU_Source_slip__internal.h
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2020-07-04 18:45:07 UTC
Committed, thanks!

(The strangest thing is that it built fine on my workstation under 12.1-STABLE and in my poudriere!)
Comment 3 rsmith 2020-07-04 22:09:29 UTC
My 12-STABLE is fairly recent and uses clang 10.
[FreeBSD clang version 10.0.0 (git@github.com:llvm/llvm-project.git llvmorg-10.0.0-0-gd32170dbd5b)]

Could it be that you're still using clang 9?
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-05 02:20:44 UTC
@Thierry Is quarterly affected by this build issue? If so, please re-open, and close setting merge-quarterly + post merge, thanks!

Note also that ports should not build with -Werror (ports compliance), should be able to override this with CFLAGS+=-Wno-error or if the port has a ./configure style argument, use that in CONFIGURE_ARGS
Comment 5 rsmith 2020-07-05 07:21:50 UTC
Created attachment 216208 [details]
Patch to remove extra CFLAGS (including -Werror) from SLIP_LU Makefile
Comment 6 rsmith 2020-07-05 07:43:36 UTC
(In reply to Kubilay Kocak from comment #4)

At @thierry's request, I submitted my initial patch upstream:
https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/51

I've created another patch that removes the extra CFLAGS from the SLIP_LU Lib Makefile. I have verified that this also builds correctly.

At first I suspected the recent change from clang 9.0.1 to clang 10.0 in 12-STABLE. 
But I have since learned that SLIP_LU was added in 5.8.0, so earlier releases would not have shown this behavior.

Based on the comment in the SLIP_LI/Lib Makefile, I believe that was left uncommented by mistake. I have amended my report upstream.
Comment 7 Thierry Thomas freebsd_committer freebsd_triage 2020-07-05 08:59:56 UTC
(In reply to Kubilay Kocak from comment #4)

The upgrade was committed after the cut-off, and 2020Q3 still has 5.7.2_1.
Comment 8 commit-hook freebsd_committer freebsd_triage 2020-07-05 14:56:35 UTC
A commit references this bug:

Author: thierry
Date: Sun Jul  5 14:55:49 UTC 2020
New revision: 541284
URL: https://svnweb.freebsd.org/changeset/ports/541284

Log:
  Remove extra CFLAGS.

  See also <https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/51>.

  PR:		247763
  Submitted by:	rsmith (at) xs4all.nl

Changes:
  head/math/suitesparse/files/patch-SLIP__LU_Lib_Makefile