Build fails with GCC 14. This blocks GCC_DEFAULT update to GCC 14. gcc14 -DHAVE_CONFIG_H -I. -I.. -I../src -I/usr/local/include/guile/2.2 -I/usr/local/include -D_THREAD_SAFE -pthread -I../src/util -I../src/matrices -I../src/matrixio -I../src/maxwell -DHAVE_CTL_HOOKS=1 -DHAVE_CTL_EXPORT_HOOK=1 -DCTL_SCM='"'/usr/local/share/libctl/base/ctl.scm'"' -DINCLUDE_SCM='"'/usr/local/share/libctl/base/include.scm'"' -DSPEC_SCM='"'/usr/local/share/mpb/mpb.scm'"' -DVERSION_STRING='"'"mpb 1.11.1, Copyright (C) 1999-2012, MIT"'"' -I/usr/local/include -I/usr/local/include -O2 -pipe -fstack-protector-strong -Wl,-rpath=/usr/local/lib/gcc14 -fno-strict-aliasing -Wall -W -Wbad-function-cast -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -MT mpb-field-smob.o -MD -MP -MF .deps/mpb-field-smob.Tpo -c -o mpb-field-smob.o `test -f 'field-smob.c' || echo './'`field-smob.c In file included from /usr/local/include/guile/2.2/libguile.h:38, from /usr/local/include/ctl.h:28, from ctl-io.h:7, from field-smob.h:21, from field-smob.c:27: field-smob.c: In function 'field_p': my-smob.h:53:44: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] 53 | && SCM_TYP16 (X) == (scm_tc16_smob_ ## T)) | ^~ field-smob.h:45:20: note: in expansion of macro 'T_SMOB_P' 45 | #define FIELD_P(X) T_SMOB_P(field_smob, X) | ^~~~~~~~ field-smob.c:42:40: note: in expansion of macro 'FIELD_P' 42 | return ctl_convert_boolean_to_scm(FIELD_P(obj)); | ^~~~~~~ field-smob.c: In function 'rscalar_field_p': my-smob.h:53:44: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] 53 | && SCM_TYP16 (X) == (scm_tc16_smob_ ## T)) | ^~ field-smob.h:45:20: note: in expansion of macro 'T_SMOB_P' 45 | #define FIELD_P(X) T_SMOB_P(field_smob, X) | ^~~~~~~~ field-smob.h:49:29: note: in expansion of macro 'FIELD_P' 49 | #define RSCALAR_FIELD_P(X) (FIELD_P(X) && ((FIELD(X))->type == RSCALAR_FIELD_SMOB)) | ^~~~~~~ field-smob.c:47:40: note: in expansion of macro 'RSCALAR_FIELD_P' 47 | return ctl_convert_boolean_to_scm(RSCALAR_FIELD_P(obj)); | ^~~~~~~~~~~~~~~ field-smob.c: In function 'cscalar_field_p': my-smob.h:53:44: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] 53 | && SCM_TYP16 (X) == (scm_tc16_smob_ ## T)) | ^~ field-smob.h:45:20: note: in expansion of macro 'T_SMOB_P' 45 | #define FIELD_P(X) T_SMOB_P(field_smob, X) | ^~~~~~~~ field-smob.h:50:29: note: in expansion of macro 'FIELD_P' 50 | #define CSCALAR_FIELD_P(X) (FIELD_P(X) && ((FIELD(X))->type == CSCALAR_FIELD_SMOB)) | ^~~~~~~ field-smob.c:52:40: note: in expansion of macro 'CSCALAR_FIELD_P' 52 | return ctl_convert_boolean_to_scm(CSCALAR_FIELD_P(obj)); | ^~~~~~~~~~~~~~~ field-smob.c: In function 'cvector_field_p': my-smob.h:53:44: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] 53 | && SCM_TYP16 (X) == (scm_tc16_smob_ ## T)) | ^~ field-smob.h:45:20: note: in expansion of macro 'T_SMOB_P' 45 | #define FIELD_P(X) T_SMOB_P(field_smob, X) | ^~~~~~~~ field-smob.h:51:29: note: in expansion of macro 'FIELD_P' 51 | #define CVECTOR_FIELD_P(X) (FIELD_P(X) && ((FIELD(X))->type == CVECTOR_FIELD_SMOB)) | ^~~~~~~ field-smob.c:57:40: note: in expansion of macro 'CVECTOR_FIELD_P' 57 | return ctl_convert_boolean_to_scm(CVECTOR_FIELD_P(obj)); | ^~~~~~~~~~~~~~~ In file included from field-smob.h:22: field-smob.c: In function 'field2scm': my-smob.h:42:6: error: implicit declaration of function 'SCM_NEWCELL' [-Wimplicit-function-declaration] 42 | SCM_NEWCELL((ANSWER)); \ | ^~~~~~~~~~~ field-smob.c:102:6: note: in expansion of macro 'NEWCELL_SMOB' 102 | NEWCELL_SMOB(obj, field_smob, pf); | ^~~~~~~~~~~~ field-smob.c:102:6: error: assignment to 'SCM' {aka 'struct scm_unused_struct *'} from 'long int' makes pointer from integer without a cast [-Wint-conversion] field-smob.c: In function 'assert_field_smob': my-smob.h:53:44: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] 53 | && SCM_TYP16 (X) == (scm_tc16_smob_ ## T)) | ^~ my-smob.h:66:28: note: in expansion of macro 'T_SMOB_P' 66 | #define SAFE_T_SMOB(T, X) (T_SMOB_P(T,X) ? T_SMOB(T,X) : NULL) | ^~~~~~~~ field-smob.h:47:65: note: in expansion of macro 'SAFE_T_SMOB' 47 | #define SAFE_FIELD(X) (cur_fieldp(X) ? update_curfield_smob() : SAFE_T_SMOB(field_smob, X)) | ^~~~~~~~~~~ field-smob.c:187:22: note: in expansion of macro 'SAFE_FIELD' 187 | field_smob *f = SAFE_FIELD(fo); | ^~~~~~~~~~ field-smob.c: In function 'integrate_fieldL': field-smob.c:407:54: warning: variable 'last_dim' set but not used [-Wunused-but-set-variable] 407 | int i, j, k, n1, n2, n3, n_other, n_last, rank, last_dim; | ^~~~~~~~ field-smob.c:407:48: warning: variable 'rank' set but not used [-Wunused-but-set-variable] 407 | int i, j, k, n1, n2, n3, n_other, n_last, rank, last_dim; | ^~~~ field-smob.c:407:40: warning: variable 'n_last' set but not used [-Wunused-but-set-variable] 407 | int i, j, k, n1, n2, n3, n_other, n_last, rank, last_dim; | ^~~~~~ field-smob.c:407:31: warning: variable 'n_other' set but not used [-Wunused-but-set-variable] 407 | int i, j, k, n1, n2, n3, n_other, n_last, rank, last_dim; | ^~~~~~~ field-smob.c: At top level: field-smob.c:395:17: warning: 'cvector3_conj' defined but not used [-Wunused-function] 395 | static cvector3 cvector3_conj(cvector3 c) | ^~~~~~~~~~~~~ *** Error code 1 Stop. make[3]: stopped in /wrkdirs/usr/ports/science/mpb/work/mpb-1.11.1/mpb *** Error code 1 Stop. make[2]: stopped in /wrkdirs/usr/ports/science/mpb/work/mpb-1.11.1/mpb *** Error code 1 Stop. make[1]: stopped in /wrkdirs/usr/ports/science/mpb/work/mpb-1.11.1 *** Error code 1 Stop. make: stopped in /wrkdirs/usr/ports/science/mpb/work/mpb-1.11.1 *** Error code 1 Stop. Full log: https://pkg-status.freebsd.org/gohan04/data/140amd64-default-foo/2024-08-29_19h57m48s/logs/errors/mpb-1.11.1_8.log Useful link: https://gcc.gnu.org/gcc-14/porting_to.html
Hi Lorenzo, Thanks for the report. I must confess that with my very limited knowledge of C/C++ I have not yet found a solution. In fact, there was already an issue in the mpb project on Github [1], in which a two patches are suggested. However, these did not eliminate the actual error with SCM_NEWCELL for me. I haven't gotten any further so far, but I could use some help from here on. P.S.: I'm AFK until Sept 27, so I can't help or test until then. [1] https://github.com/NanoComp/mpb/issues/165
Created attachment 256007 [details] Fix build with GCC 14 This patch adds the -fpermissive flag so that the build works with GCC 14. Does the maintainer approve?
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=abffdd9a18a7aef287ccd21897fdc91c792cbc4d commit abffdd9a18a7aef287ccd21897fdc91c792cbc4d Author: Lorenzo Salvadore <salvadore@freebsd.org> AuthorDate: 2024-12-21 17:46:44 +0000 Commit: Rainer Hurling <rhurlin@FreeBSD.org> CommitDate: 2024-12-21 17:52:22 +0000 science/mpb: Fix build with GCC 14 error: implicit declaration of function 'SCM_NEWCELL' [-Wimplicit-function-declaration] Thanks for the patch to salvadore@ PR: 281245 science/mpb/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Hi Lorenzo, Thanks for the patch! I'm really very sorry, I had lost sight of this bug and didn't bother. With the patch the port can be built very well with gcc14. Also the tests all seem to be ok: # make test [..] Finished solving for bands 1 to 3 after 56 iterations. freqs:, 1, 0.12, 0.34, 0.41, 0.545985, 0.291848, 0.315613, 0.491642 elapsed time for k point: 1 seconds. total elapsed time for run: 1 seconds. done. check-almost-equal: PASSED check-almost-equal: PASSED eigensolver iterations for 84 k-points: 8-9963/10, mean = 89.26369047619048, median = 19.0 mean flops per iteration = 5316807.658155679 mean time per iteration = 0.007735241359535352 s Relative error ranged from 0.0 to 1.9765712311535006e-4, with a mean of 2.0205952373393855e-6 Absolute error ranged to 1.0067210840147833e-4, with a mean of 8.857129426257578e-7 PASSED all tests. Making check in examples Making check in utils I have therefore committed the patch. Thanks again!
(In reply to Lorenzo Salvadore from comment #2) > This patch adds the -fpermissive flag so that the build works with > GCC 14. Does the maintainer approve? Adding -fpermissive isn't really a fix, it's a hack to force a build on software not honoring a language standard that's three decades old. IMnsHO any such change should be accompanied by deprecating the respective port, even if with a generous EXPIRATION_DATE of, let's say, four to six months in the future.