Comments (10)
@nuernbergk this is to let you know that @BenKaufmann added a second patch that addresses the problem at the root. With this it should be possible to build clasp using C++98 and still use it in code requiring later standards.
from clingo.
Enabling threads also enables C++11 in clasp and static_assert comes along with it. It seems like there is some cmake configuration that is wrong. I would recommend to build without threads and enable C++14 or higher project wide.
from clingo.
Wouldn't that mean I should get this issue only when building with threads? It seems odd that it happens when I try to build without threads.
I tried to set C++14 project wide, but it doesn't help. In any case, this shouldn't be the problem, since the clingo CMakeLists.txt requires the C++14 standard as well.
from clingo.
This message shows that the static_assert of libpotassco is used somewhere within the STL:
min_element.h:57:61: error: too many arguments provided to function-like macro invocation
It should not happen if everything is compiled with C++14. I cannot really tell you more. I would compile in verbose mode and have a look at the compiler commands to check if compiler options are used consistently.
from clingo.
Thank you so much. Indeed, the problem is in the CMakeLists.txt for Clasp, lines L98-L100, where the standard is set to 98. Simply changing this to be 11 works.
Is this desired behaviour? It seems like it would make more sense to not set the standard at all in the case that threads aren't used. For my use case, it is of course fine to simply patch this file, but this does seem like an odd design choice.
from clingo.
Thank you so much. Indeed, the problem is in the CMakeLists.txt for Clasp, lines L98-L100, where the standard is set to 98. Simply changing this to be 11 works.
Is this desired behaviour? It seems like it would make more sense to not set the standard at all in the case that threads aren't used. For my use case, it is of course fine to simply patch this file, but this does seem like an odd design choice.
Clasp is written in C++98. Setting the standard to C++98 is the right thing to do.
@BenKaufmann I think there is a problem how libc++ uses static_assert. Maybe we should patch this in libpotassco by simply using another name? We could also add an option to not set the standard at all and use whatever is the default or configured by projects like clingo using clasp.
from clingo.
I think there is a problem how libc++ uses static_assert. Maybe we should patch this in libpotassco by simply using another name? We could also add an option to not set the standard at all and use whatever is the default or configured by projects like clingo using clasp.
@rkaminsk I'd be fine with either option. However, I'd first like to understand the underlying problem better - i.e. why is the detection code in libpotassco's platform.h not working and/or written like it is?
- The error message implies that
POTASSCO_HAS_STATIC_ASSERT
has been set to0
and therefore we define astatic_assert
macro with two parameters. - However, the compiler's
min_element.h
header contains astatic_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>
, which when parsed as a macro, has more than two arguments (due to the commas in the expression). Hence, one would need a variadicstatic_assert
macro. - Now, my assumption would be that we are in the context of LLVM's LIBCPP, which defines
static_assert
as a variadic macro in C++98/03 mode. - But for some reason I currently don't remember, our check contains
defined(static_assert) && !defined(_LIBCPP_VERSION)
. Hence, we overwrite libcpp's macro definition.
From my current understanding, I'd say that our check in platform.h is broken and we should either just drop the && !defined(_LIBCPP_VERSION)
part completely or at least remove the !
.
from clingo.
@nuernbergk Could you maybe check whether compiling with DCLASP_BUILD_WITH_THREADS=Off
works if you change the defined(static_assert) && !defined(_LIBCPP_VERSION)
check in line 31 of potassco/platform.h to defined(static_assert) && defined(_LIBCPP_VERSION)
(i.e. just drop the !
)?
from clingo.
@BenKaufmann Yep, that fixes it.
from clingo.
I suspect this also causes my build issues in domoritz/clingo-wasm#348. Do you plan to release a new version that can compile without threads (which is what makes sense for WASM at the moment)?
from clingo.
Related Issues (20)
- Solving iteratively (as in `examples/cc/solve_iteratively.cc` gives different results than solving using the CLI. HOT 6
- How to get atom numbers for symbols associated with facts in the Python Observer? HOT 5
- Computing minimal answer sets w.r.t. a subset of atoms HOT 11
- wrong grounding involving recursive conditional literals
- Is it possible to maintain order of literals? HOT 2
- Unexpected grounding blow-up in aggregates HOT 2
- Gringo considers unnecessary instantiations of rule heads. HOT 12
- graph.lp:2:1-5: error: syntax error, unexpected <IDENTIFIER> HOT 3
- how to write the "different than" symbol in a .lp file ? HOT 3
- understanding how to format an lp input graph file for clingo HOT 2
- How to check if #external predicates are defined properly? HOT 6
- Multiple conditions in the head of a condition literal HOT 11
- Absolute submodule paths would be welcome. HOT 6
- Cannot instantiate Comment AST using CommentType enum as argument.
- Benchmarking gringo HOT 1
- Grounder output description HOT 2
- Projected AllSAT with partial solutions in clingo HOT 5
- Does Clingo support floating-point number? HOT 1
- Rewrite: extern(Device, function) ==> function(Device) HOT 9
- avoid canonicalize_file_name HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clingo.