Mike Samuel
Mike Samuel

Reputation: 120576

ocaml oUnit and main ocaml lib make inconsistent assumptions over implementation Unix

Inconsistent assumptions over interface (Ocaml) suggests that I rebuild and I've tried that but to no avail.

I use mac port to manage most of my dev tools, and since upgrading to Mac OS 10.8.2, there seems to be a bad interaction between ocaml and ocaml-ounit.

Below is a pretty minimal shell dump, but the problem is

 Error: Files /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmxa
        and /opt/local/lib/ocaml/unix.cmxa
        make inconsistent assumptions over implementation Unix

and forcing a rebuild as described at http://www.puredarwin.org/developers/macports/port does not seem to address the problem:

To force an upgrade (rebuild) use:

          port -f upgrade vim

Below is a shell dump of my attempt to build a native binary (.byte works fine but I'm about to start a round of profiling and want to profile native execution) and my attempts to bend mac ports to my will.

Any thoughts on how to further investigate this problem would be much appreciated. I'd rather not start building ocaml from sources myself since I want to be able to distribute my project to colleagues with minimal instructions as to what they need to do to get things up and running, so I want to use vanilla packages where possible.

 > ocaml make.ml PegParserTest.native
 ocamlbuild \
         -libs \
         nums,str,unix,oUnit,graph \
         -cflags \
         -g,-w,+a-4,-warn-error,+a-4,-I,/opt/local/lib/ocaml/site-lib/oUnit,-I,/opt/local/lib/ocaml/site-lib/ocamlgraph \
         -lflags \
         -g,-I,/opt/local/lib/ocaml/site-lib/oUnit,-I,/opt/local/lib/ocaml/site-lib/ocamlgraph \
         PegParserTest.native
 + /opt/local/bin/ocamlopt.opt -g -I /opt/local/lib/ocaml/site-lib/oUnit -I /opt/local/lib/ocaml/site-lib/ocamlgraph nums.cmxa str.cmxa unix.cmxa oUnit.cmxa graph.cmxa BinSearch.cmx ByteInput.cmx ByteOutput.cmx ListUtil.cmx Stringer.cmx Range.cmx Unicode.cmx CaseFold.cmx EditDistance.cmx SourcePosition.cmx Utf8.cmx Grammar.cmx Failures.cmx Opt.cmx StringUtil.cmx Path.cmx UnicodeCategories.cmx UnicodeSeq.cmx GrammarParser.cmx AnnotationChecker.cmx ArrayUtil.cmx BitBucket.cmx CodeUnit.cmx Conv.cmx DefaultProductions.cmx Encodable.cmx Flatten.cmx Trie.cmx FactorLeft.cmx Followers.cmx Inline.cmx PreSimplify.cmx SymmetricBoolMatrix.cmx TailCallOpt.cmx UnionPartition.cmx Simplifier.cmx FileTestSuite.cmx NumberSystem.cmx Regex.cmx PegParser.cmx ScalarCharValue.cmx TestHarnessWrapper.cmx PegParserTest.cmx -o PegParserTest.native
 File "_none_", line 1:
 Error: Files /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmxa
        and /opt/local/lib/ocaml/unix.cmxa
        make inconsistent assumptions over implementation Unix
 Command exited with code 2.
 Compilation unsuccessful after building 154 targets (153 cached) in 00:00:00.
 
 > sudo port selfupdate 
 --->  Updating MacPorts base sources using rsync
 MacPorts base version 2.1.2 installed,
 MacPorts base version 2.1.2 downloaded.
 --->  Updating the ports tree
 --->  MacPorts base is already the latest version
 
 The ports tree has been updated. To upgrade your installed ports, you should run
   port upgrade outdated
 
 > sudo port upgrade outdated
 --->  Computing dependencies for automake
 ELIDED
 --->  Updating database of binaries: 100.0%
 --->  Scanning binaries for linking errors: 100.0%
 --->  No broken files found.
 
 > port contents ocaml | grep -i unix.cm
   /opt/local/lib/ocaml/threads/threadUnix.cmi
   /opt/local/lib/ocaml/threads/threadUnix.cmx
   /opt/local/lib/ocaml/unix.cma
   /opt/local/lib/ocaml/unix.cmi
   /opt/local/lib/ocaml/unix.cmx
   /opt/local/lib/ocaml/unix.cmxa
   /opt/local/lib/ocaml/unix.cmxs
   /opt/local/lib/ocaml/vmthreads/threadUnix.cmi
   /opt/local/lib/ocaml/vmthreads/unix.cma
 
 > port contents ocaml-ounit | egrep '\.cm'
   /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cma
   /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmi
   /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmx
   /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmxa
   /opt/local/lib/ocaml/site-lib/oUnit/oUnit.cmxs
   /opt/local/lib/ocaml/site-lib/oUnit/oUnitDiff.cmi
   /opt/local/lib/ocaml/site-lib/oUnit/oUnitDiff.cmx
 
 > sudo port -f upgrade ocaml-ounit ocaml
 Password:
 --->  Scanning binaries for linking errors: 100.0%
 --->  No broken files found.

Upvotes: 2

Views: 641

Answers (1)

Mike Samuel
Mike Samuel

Reputation: 120576

Going nuclear solved the problem:

Reinstall ports

To reinstall your ports:

  1. Save the list of installed ports:

    port -qv installed > myports.txt

  2. Uninstall all installed ports:

    sudo port -f uninstall installed

  3. Clean any partially-completed builds:

    sudo port clean all

  4. Browse myports.txt and install the ports that you actually want to use (as opposed to those that are only needed as dependencies) one by one, remembering to specify the appropriate variants:

    sudo port install portname +variant1 +variant2 …

Note that if you have specified variants which are not the default, you may need to install ports in an order other than the alphabetical order recorded in myports.txt.

Upvotes: 2

Related Questions