Git Product home page Git Product logo

Comments (16)

bschommer avatar bschommer commented on June 15, 2024

You jeed to update Menhir to the newest Version 20151030. The new version is needed for the new error reporting interface.

from compcert.

xavierleroy avatar xavierleroy commented on June 15, 2024

Also, "make clean" or at least "make -f Makefile.extr clean" could help. It could be that cparser/pre_parser.cmx was left over from an earlier build using an earlier version of Menhir.

from compcert.

didickman avatar didickman commented on June 15, 2024

Bernhard: Thanks. I was actually on an even newer version of menhir (20151103 is newer than the version you recommended). I tried downgrading to 20151030, but same problem.

Xavier: so far it looks like the problem is somewhere between commit 9416342 and db1be72.

from compcert.

bschommer avatar bschommer commented on June 15, 2024

It could be the case that the searching for the include path did not work correct. You can also try to set the variable MENHIR_INCLUDE by hand to the correct location.

from compcert.

didickman avatar didickman commented on June 15, 2024

Thanks for the hint, I'll take a look. I also started to "git bisect" last night and have narrowed the problem down to somewhere in the following range of commits.

commit 03f39523094fd41c8aad5ee7a8169ffc448cfd4a
commit e036d68cb41de1ddac47d7686d25904281405ffe
commit ed549acd7d71d274c7e39480900b14d1b65c3cd1
commit 1ea7d1d09c350d0f0613f0bd763c3e01a70ddbb9
commit 581ac226fb42a0a005baa8941e5f39b181acc6cb

from compcert.

didickman avatar didickman commented on June 15, 2024

git bisect says the problematic commit is ed549ac

from compcert.

bschommer avatar bschommer commented on June 15, 2024

That explains the problem, since the commits you mentioned were all part of the Pull Request #60 which requires a new version of Menhir. In table mode the generated parser needs the menhirLib. Before it did not need the library.

The error messages seems to come from the fact that you may be using an older version of the lib since the api changed and thus the inconsistent assumptions.

Currently the place is set in the Makefile.menhir by:

ifeq ($(MENHIR_TABLE),true)

  MENHIR_SUGGESTION = $(MENHIR) $(MENHIR_MODE) --suggest-comp-flags

  MENHIR_INCLUDES := $(shell \
    if $(MENHIR_SUGGESTION) | grep -e "-package" >/dev/null ; then \
      echo "-I `ocamlfind query menhirLib`" ; \
    else \
      $(MENHIR_SUGGESTION) ; \
    fi)
fi 

I'm don't now how you installed menhir but it could be the case that either ocamlfind returns an old file or the menhir suggestions itself.

from compcert.

bschommer avatar bschommer commented on June 15, 2024

I just merged another PR which should solve some Problems with newer menhir versions.

from compcert.

didickman avatar didickman commented on June 15, 2024

Unfortunately no change in behaviour. Some diagnostics below.

$MENHIR_SUGGESTION is [menhir --table --suggest-comp-flags]
$MENHIR_INCLUDES is [-I /usr/local/lib/ocaml/menhirLib]
$OCAMLOPT is [ocamlopt.opt -g -I extraction -I lib -I common -I ia32 -I backend -I cfrontend -I cparser -I driver -I exportclight -I debug -I /usr/local/lib/ocaml/menhirLib -w -3]
$LIBS is [str.cmxa unix.cmxa menhirLib.cmx]
$CCOMP_OBJS is [driver/Version.cmx lib/Readconfig.cmx driver/Configuration.cmx driver/Clflags.cmx extraction/Datatypes.cmx extraction/Peano.cmx extraction/Bool.cmx extraction/BinNums.cmx extraction/BinPosDef.cmx extraction/BinPos.cmx extraction/Zpower.cmx extraction/Specif.cmx extraction/List0.cmx extraction/BinNat.cmx extraction/BinInt.cmx extraction/ZArith_dec.cmx extraction/Coqlib.cmx extraction/Integers.cmx extraction/Fcore_Zaux.cmx extraction/Fcore_digits.cmx extraction/Fcore_FLT.cmx extraction/Zbool.cmx extraction/Fcalc_bracket.cmx extraction/Fcalc_round.cmx extraction/Fappli_IEEE.cmx extraction/Fappli_IEEE_extra.cmx extraction/Fappli_IEEE_bits.cmx extraction/Archi.cmx extraction/Floats.cmx lib/Camlcoq.cmx driver/Timing.cmx cparser/Machine.cmx cparser/Env.cmx cparser/Cprint.cmx cparser/Cerrors.cmx cparser/Cutil.cmx extraction/String0.cmx extraction/Errors.cmx extraction/AST.cmx common/Sections.cmx extraction/Orders.cmx extraction/OrdersTac.cmx extraction/OrderedType.cmx extraction/EquivDec.cmx extraction/Maps.cmx extraction/Ordered.cmx extraction/Int0.cmx extraction/OrdersAlt.cmx extraction/OrdersFacts.cmx extraction/MSetInterface.cmx extraction/MSetAVL.cmx extraction/FSetAVL.cmx extraction/Registers.cmx extraction/Op.cmx extraction/Machregs.cmx extraction/Locations.cmx backend/XTL.cmx extraction/RTL.cmx extraction/Equalities.cmx extraction/DecidableType.cmx extraction/FSetInterface.cmx extraction/Lattice.cmx extraction/Iteration.cmx extraction/Heaps.cmx extraction/Kildall.cmx backend/Splitting.cmx extraction/Unityping.cmx extraction/Conventions1.cmx extraction/Conventions.cmx extraction/RTLtyping.cmx ia32/PrintOp.cmx common/PrintAST.cmx ia32/Machregsaux.cmx backend/PrintXTL.cmx extraction/LTL.cmx backend/PrintLTL.cmx extraction/Values.cmx extraction/EqNat.cmx extraction/Memdata.cmx backend/IRC.cmx backend/Regalloc.cmx backend/PrintRTL.cmx extraction/Mach.cmx backend/PrintMach.cmx extraction/Memtype.cmx extraction/Memory.cmx extraction/Globalenvs.cmx extraction/Ctypes.cmx extraction/Cop.cmx extraction/Csyntax.cmx cfrontend/PrintCsyntax.cmx extraction/Cminor.cmx backend/PrintCminor.cmx extraction/Clight.cmx cfrontend/PrintClight.cmx extraction/Asm.cmx backend/PrintAsmaux.cmx lib/Printlines.cmx backend/Fileinfo.cmx debug/DwarfUtil.cmx cparser/Builtins.cmx ia32/CBuiltins.cmx debug/DebugInformation.cmx debug/Dwarfgen.cmx debug/Debug.cmx extraction/Initializers.cmx cparser/Ceval.cmx cparser/ExtendedAsm.cmx extraction/Ring.cmx extraction/Ctyping.cmx cfrontend/C2C.cmx ia32/TargetPrinter.cmx debug/DwarfPrinter.cmx backend/PrintAsm.cmx cparser/Unblock.cmx cparser/Transform.cmx cparser/StructReturn.cmx cparser/Rename.cmx extraction/Tuples.cmx extraction/Streams.cmx extraction/Int31.cmx extraction/Compare_dec.cmx extraction/Alphabet.cmx extraction/Grammar.cmx extraction/Automaton.cmx extraction/Validator_safe.cmx extraction/Interpreter_safe.cmx extraction/Interpreter_correct.cmx extraction/FMapList.cmx extraction/FMapAVL.cmx extraction/Validator_complete.cmx extraction/Interpreter_complete.cmx extraction/Interpreter.cmx extraction/Main.cmx extraction/Cabs.cmx extraction/Parser.cmx cparser/PackedStructs.cmx cparser/pre_parser_aux.cmx cparser/pre_parser.cmx cparser/pre_parser_messages.cmx cparser/ErrorReports.cmx cparser/Cabshelper.cmx cparser/Lexer.cmx cparser/Cleanup.cmx cparser/Elab.cmx cparser/Bitfields.cmx cparser/Parse.cmx extraction/Events.cmx extraction/Determinism.cmx extraction/Csem.cmx extraction/Cexec.cmx driver/Interp.cmx debug/DebugInit.cmx extraction/Unusedglob.cmx extraction/UnionFind.cmx extraction/Tunneling.cmx extraction/Tailcall.cmx extraction/Linear.cmx extraction/Bounds.cmx extraction/Stacklayout.cmx extraction/Lineartyping.cmx extraction/Stacking.cmx extraction/Compopts.cmx extraction/SimplLocals.cmx extraction/SimplExpr.cmx extraction/Switch.cmx common/Switchaux.cmx extraction/CminorSel.cmx extraction/SelectOp.cmx extraction/SelectLong.cmx extraction/SelectDiv.cmx extraction/Selection.cmx extraction/Mergesort.cmx extraction/Postorder.cmx extraction/Renumber.cmx backend/RTLgenaux.cmx extraction/RTLgen.cmx backend/Linearizeaux.cmx extraction/Linearize.cmx backend/Inliningaux.cmx extraction/Inlining.cmx extraction/Debugvar.cmx extraction/ValueDomain.cmx extraction/ValueAOp.cmx extraction/Liveness.cmx extraction/ValueAnalysis.cmx extraction/IntvSets.cmx extraction/NeedDomain.cmx extraction/NeedOp.cmx extraction/Deadcode.cmx extraction/Csharpminor.cmx extraction/Cshmgen.cmx extraction/ConstpropOp.cmx extraction/Constprop.cmx extraction/Cminorgen.cmx extraction/CleanupLabels.cmx extraction/CSEdomain.cmx extraction/CombineOp.cmx extraction/CSE.cmx extraction/Asmgen.cmx extraction/FSetAVLplus.cmx extraction/Allocation.cmx extraction/Compiler.cmx driver/Commandline.cmx lib/Tokenize.cmx cfrontend/CPragmas.cmx backend/CMtypecheck.cmx backend/CMparser.cmx backend/CMlexer.cmx backend/Asmexpandaux.cmx ia32/Asmexpand.cmx ia32/AsmToJSON.cmx driver/Driver.cmx ]

Linking ccomp
File "_none_", line 1:
Error: Files cparser/pre_parser.cmx
       and /usr/local/lib/ocaml/menhirLib/menhirLib.cmx
       make inconsistent assumptions over interface MenhirLib
Makefile.extr:81: recipe for target 'ccomp' failed

from compcert.

didickman avatar didickman commented on June 15, 2024

don't know if this is a red herring or not, but doing a build of compcert seems to change these files. is it expected?

/usr/local/lib/ocaml/menhirLib/menhirLib.cmx (bad checksum)
/usr/local/lib/ocaml/menhirLib/menhirLib.o (bad checksum)
/usr/local/lib/ocaml/menhirLib/menhirLib.cmi (bad checksum)

from compcert.

bschommer avatar bschommer commented on June 15, 2024

I'm not sure if this should happen but I cannot reproduce the behavior.

from compcert.

bschommer avatar bschommer commented on June 15, 2024

Sorry hit the wrong button.

from compcert.

xavierleroy avatar xavierleroy commented on June 15, 2024

It is not expected that menhirLib/ changes during a build of CompCert, indeed. (Normally, you shouldn't have permissions to change the files there, but I guess you're building CompCert as root.) My guess is the following:

  • .depend.extr contains dependencies on ..../menhirLib/menhirLib.{cmi.cmx}
  • Makefile.extr find these files outdated w.r.t. ..../menhirLib/menhirLib.{ml,mli} and decides to rebuild them.

The moral of the story is that -I.../menhirLib should not be passed to ocamldep when building .depend.extr. Either that, or find a way to turn off the ".ml -> .cmx" and ".mli -> .cmi" rules for .../menhirLib.

from compcert.

xavierleroy avatar xavierleroy commented on June 15, 2024

Tentative fix in [master 20e3c4a] so that ocamldep does not generate dependencies on .../menhirLib/menhirLib.{cmi,cmx}.

from compcert.

fpottier avatar fpottier commented on June 15, 2024

Indeed, it now occurs to me that, since 20151030, Menhir installs two files menhirLib.{ml,mli} in the same directory as menhirLib.{cmi,cmo,cmx}. This was not the case in previous versions of Menhir. The files menhirLib.{ml,mli} are supposed to be used by people who want to integrate the source code of MenhirLib in their project, whereas the files menhirLib.{cmi,cmo,cmx} are supposed to be used by people who want to link against MenhirLib in the traditional way. (They are created using ocamlc -pack.)

I can think of two solutions:

1- Menhir could install these two groups of files in two distinct directories, to avoid confusion.

2- I could build menhirLib.{cmi,cmo,cmx} from menhirLib.{ml,mli}, without using -for-pack and -pack.
The files menhirLib.{ml,mli} are obtained by textually concatenating all of the files *.{ml,mli} for MenhirLib. Would that be a good/bad idea? I'm not sure.

from compcert.

didickman avatar didickman commented on June 15, 2024

Confirmed that commit 20e3c4a fixes the issue for me. Thanks!

from compcert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.