I want to install bindings to the Minisat solver for satisfiability problems available here on Hackage.
When I tried doing cabal install minisat-solver
at the command-line on a Linux work-station, I got the following output
user@home: $ cabal install minisat-solver
Resolving dependencies...
Configuring minisat-solver-0.1...
Building minisat-solver-0.1...
Failed to install minisat-solver-0.1
Build log ( /home/gaurish/.cabal/logs/minisat-solver-0.1.log ):
cabal: Entering directory '/tmp/cabal-tmp-6317/minisat-solver-0.1'
Configuring minisat-solver-0.1...
Building minisat-solver-0.1...
Preprocessing library minisat-solver-0.1...
[1 of 7] Compiling SAT.MiniSat.Literals ( SAT/MiniSat/Literals.hs, dist/build/SAT/MiniSat/Literals.o )
[2 of 7] Compiling SAT.MiniSat.LowLevel ( SAT/MiniSat/LowLevel.hs, dist/build/SAT/MiniSat/LowLevel.o )
[3 of 7] Compiling SAT.MiniSat.Monadic ( SAT/MiniSat/Monadic.hs, dist/build/SAT/MiniSat/Monadic.o )
[4 of 7] Compiling SAT.MiniSat.Functional ( SAT/MiniSat/Functional.hs, dist/build/SAT/MiniSat/Functional.o )
[5 of 7] Compiling SAT.MiniSat.Variable ( SAT/MiniSat/Variable.hs, dist/build/SAT/MiniSat/Variable.o )
[6 of 7] Compiling SAT.MiniSat.Formula ( SAT/MiniSat/Formula.hs, dist/build/SAT/MiniSat/Formula.o )
[7 of 7] Compiling SAT.MiniSat ( SAT/MiniSat.hs, dist/build/SAT/MiniSat.o )
c-sources/solver.c: In function ‘solver_simplification’:
c-sources/solver.c:901:3:
error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = solver_dlevel(s); i >= 0; i--) {
^
c-sources/solver.c:901:3:
note: use option -std=c99 or -std=gnu99 to compile your code
c-sources/solver.c:907:3:
error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int c = s->qtail - 1; c >= 0; c--) {
^
Clearly, I need to tell cabal to tell gcc to use ansi-c99 mode while compiling the embedded C-sources. in other words to pass -std=c99 to the gcc compiler.
How do I do that?
--gcc-option
might do the trick.
It's also found in here as --prog-option
where prog is any program known to cabal(such as gcc)
Another option is to download the package yourself then modify its build configuration.