Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Head Broken - Unable To Compile src/ast/sls/sls_arith_lookahead.h - Missing ::sqrt #7527

Closed
ErrWare opened this issue Jan 25, 2025 · 1 comment

Comments

@ErrWare
Copy link

ErrWare commented Jan 25, 2025

I was unable to build from source on my RHEL 9 using make and gcc. Adding "#include <math.h>" to the top of src/ast/sls/sls_arith_lookahead.h fixed the issue for me.

gcc version: gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)
make version: GNU Make 4.3 Built for x86_64-redhat-linux-gnu

I'm wondering if this is the correct fix, or if it will cause subtle and hard to diagnose issues later?

Here's the full error I saw:

src/ast/sls/sls_arith_lookahead.cpp
../src/ast/sls/sls_arith_lookahead.cpp: In member function ‘expr* sls::arith_lookahead<num_t>::get_candidate_unsat()’:
../src/ast/sls/sls_arith_lookahead.cpp:723:51: error: ‘::sqrt’ has not been declared; did you mean ‘sort’?
  723 |                     + a.m_config.ucb_constant * ::sqrt(log((double)m_touched) / get_touched(f))
      |                                                   ^~~~
      |                                                   sort
../src/ast/sls/sls_arith_lookahead.cpp:723:56: error: there are no arguments to ‘log’ that depend on a template parameter, so a declaration of ‘log’ must be available [-fpermissive]
  723 |                     + a.m_config.ucb_constant * ::sqrt(log((double)m_touched) / get_touched(f))
      |                                                        ^~~
../src/ast/sls/sls_arith_lookahead.cpp:723:56: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make: *** [Makefile:1538: ast/sls/sls_arith_lookahead.o] Error 1

And here's the diff of my workaround:

diff --git a/src/ast/sls/sls_arith_lookahead.cpp b/src/ast/sls/sls_arith_lookahead.cpp
index 1db76cf36..09f6867b8 100644
--- a/src/ast/sls/sls_arith_lookahead.cpp
+++ b/src/ast/sls/sls_arith_lookahead.cpp
@@ -12,6 +12,7 @@ Author:

 --*/

+#include <math.h>
 #include "ast/ast_pp.h"
 #include "ast/ast_ll_pp.h"
 #include "ast/sls/sls_arith_lookahead.h"
@NikolajBjorner
Copy link
Contributor

57cb988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants