Skip to content

Commit 1adecdb

Browse files
authored
fix bernmm compilation
/opt/conda/envs/sage-dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_tree.h:772:15: error: static assertion failed: comparison object must be invocable as const 772 | is_invocable_v<const _Compare&, const _Key&, const _Key&>, /opt/conda/envs/sage-dev/x86_64-conda-linux-gnu/include/c++/12.3.0/bits/stl_tree.h:772:15: note: 'std::is_invocable_v<const bernmm::Item_cmp&, bernmm::Item* const&, bernmm::Item* const&>' evaluates to false
1 parent 4698e07 commit 1adecdb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sage/rings/bernmm/bern_rat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct Item
8787
*/
8888
struct Item_cmp
8989
{
90-
bool operator()(const Item* x, const Item* y)
90+
bool operator()(const Item* x, const Item* y) const
9191
{
9292
return mpz_cmp(x->modulus, y->modulus) < 0;
9393
}
@@ -331,9 +331,9 @@ void bern_rat(mpq_t res, long k, int num_threads)
331331
#ifdef USE_THREADS
332332
for (long i = 0; i < num_threads - 1; i++)
333333
pthread_join(threads[i], NULL);
334-
#endif
335334

336335
pthread_attr_destroy (&attr);
336+
#endif
337337

338338
// reconstruct B_k as a rational number
339339
Item* item = *(state.items.begin());

src/sage/rings/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ foreach name, pyx : extension_data
136136
endforeach
137137

138138
extension_data_cpp = {
139-
'bernmm': files('bernmm.pyx', 'bernmm/bern_modp.cpp', 'bernmm/bern_modp_util.cpp'),#, 'bernmm/bern_rat.cpp'), - TODO: Compilation error
139+
'bernmm': files('bernmm.pyx', 'bernmm/bern_modp.cpp', 'bernmm/bern_modp_util.cpp', 'bernmm/bern_rat.cpp'),
140140
'bernoulli_mod_p': files('bernoulli_mod_p.pyx'),
141141
'fraction_field_FpT': files('fraction_field_FpT.pyx'),
142142
'rational': files('rational.pyx'),
@@ -147,6 +147,7 @@ foreach name, pyx : extension_data_cpp
147147
sources: pyx,
148148
subdir: 'sage/rings',
149149
install: true,
150+
cpp_args: ['-DUSE_THREADS=1','-DTHREAD_STACK_SIZE=4096'],
150151
override_options : ['cython_language=cpp'],
151152
include_directories: [inc_arb, inc_cpython, inc_ext, inc_flint, inc_gsl, inc_ntl, inc_rings, inc_rings_finite],
152153
dependencies: [py_dep, cypari2, cysignals, flint, gmp, gmpy2, gsl, m, mpc, mpfi, mpfr, ntl, pari, pthread],

0 commit comments

Comments
 (0)