我想安装与Minisat求解器的绑定,以解决 Hackage 上可用的可满足性问题。
当我尝试cabal install minisat-solver
在 Linux 工作站的命令行上执行操作时,我得到以下输出
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--) {
^
显然,我需要告诉 cabal 告诉 gcc 在编译嵌入式 C 源代码时使用 ansi-c99 模式。换句话说,将 -std=c99 传递给 gcc 编译器。
我怎么做?