caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ivan Gotovchits <ivg@ieee.org>
To: Jonathan DiLorenzo <dilorenzo@cs.cornell.edu>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Providing module implementations for Oasis
Date: Thu, 27 Oct 2016 14:24:35 -0400	[thread overview]
Message-ID: <CALdWJ+zOH=MRNTphqWsCjqW=cmq+fm2+tyTqP_hbAPjS6fH-5w@mail.gmail.com> (raw)
In-Reply-To: <CADYFzVZCap-rXtA0CmMhHHk78LsNKeROxJPPj2coL6FritaNjw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5534 bytes --]

The problem is  in a name clashing between
`$opam-switch/lib/ocaml/compiler-libs/parser` and the `parser` library that
is compiled from your internal library named `parser.cmxa`.
The compiler-lib is added to the search path by the `ppx_tools` library,
and when you're trying to link your final executable, it takes the wrong
archive, that definitely doesn't have
`Forest_parser_helper` module.

The reason, why it is still able to see that there is no `bad_func` in
`Forest_parser_helper` is because the interfaces are not contained in the
`cmxa` file, but are looked up directly in
the `cmi`. Compiler is looking for a file named `forest_parser_helper.cmi`
and can see that there are not `bad_func` there.

The solution is to rename your library, e.g., use `Library forest_parser`
instead of `Library parser`

On Thu, Oct 27, 2016 at 1:44 PM, Jonathan DiLorenzo <
dilorenzo@cs.cornell.edu> wrote:

> Hey,
>
> Ok, now the next step would be the following. Carefully check that all
>> modules, that you're using in libraries are included in `Modules` or
>> `InternalModules`. It is the case
>> that sometimes when you forgot to include a module, oasis (actually
>> `ocamlbuild`), may produce a strange, and on a first glance, irrelevant
>> error message.
>>
>
> I checked and sadly the modules I'm trying to access are all in `Modules`.
> Perhaps interestingly, it can still clearly detect statically if the
> function exists or not because if I try to use a function that doesn't
> exist it instead gives me this error (which is what I would normally
> expect):
>
> File "ppx/skins.ml", line 39, characters 8-37:
> Error: Unbound value Forest_parser_helper.bad_func
> Command exited with code 2.
>
>
>> If it doesn't help then the `_build/_log` file might help us to debug the
>> issue.
>>
>
> Attached. Thanks so much for helping with this again. I'm at a total loss.
>
>
>>
>> On Thu, Oct 27, 2016 at 10:59 AM, Jonathan DiLorenzo <
>> dilorenzo@cs.cornell.edu> wrote:
>>
>>> Hey Ivan,
>>>
>>> Thanks for your response.
>>>
>>> The first one is that you didn't run `oasis setup` after you made the
>>>> changes, so I would suggest cleaning current state
>>>> and starting from scratch. (I usually just do `git clean -idx` just to
>>>> be sure that I got rid of any generated files, like setup.data, et alas,
>>>> but be careful,
>>>> don't delete something that you need).
>>>>
>>>
>>> I tried cleaning up all the generated files. Same error unfortunately
>>>
>>>
>>>> Another idea is that you're using oasis 0.4.7 with
>>>> ocaml-4.03.0+flambda, they are currently incompatible, and can produce
>>>> weird bugs. If that so, then consider switching
>>>> either a compiler or oasis to different versions.
>>>>
>>>
>>> I am using oasis 0.4.7 and ocaml-4.03.0, but I don't appear to be using
>>> flambda. I tried passing in -config and it said that flambda was false at
>>> least, but I admit, I'm not especially familiar with it, so if there's some
>>> other way I should be checking for this please let me know. Hopefully,
>>> they're compatible sans flambda?
>>>
>>>
>>> On Thu, Oct 27, 2016 at 1:01 AM, Jonathan DiLorenzo <
>>>> dilorenzo@cs.cornell.edu> wrote:
>>>>
>>>>> Hey all,
>>>>>
>>>>> I'm trying to build my system using Oasis and OCamlbuild. I have 3
>>>>> different libraries and for some reason I seem to only be able to refer
>>>>> from one to the other in seemingly random files. For example, I want my
>>>>> 'ppx' library to be able to use functions from my 'parser' library. One
>>>>> file (ppx_forest.ml) can use functions from it, while another in the
>>>>> same library (skins.ml) cannot, giving me this error:
>>>>>
>>>>> File "_none_", line 1:
>>>>> Error: No implementations provided for the following modules:
>>>>>          Forest_parser_helper referenced from ppx/ppx.cmxa(Skins)
>>>>> Command exited with code 2.
>>>>>
>>>>> They can all refer to types I've defined therein though.
>>>>>
>>>>> I'm not fantastic at Oasis so maybe I'm just missing something basic?
>>>>> Any ideas? Any more information I can gather to give more context otherwise?
>>>>>
>>>>> Thanks in advance,
>>>>> Jonathan
>>>>>
>>>>> Excerpt of my Oasis file that may possibly be relevant:
>>>>>
>>>>> Library forest
>>>>>   Path:          lib
>>>>>   BuildTools:    ocamlbuild
>>>>>   BuildDepends:   pads, str, re, re.glob, core, threads, ppx_let
>>>>>   CompiledObject: best
>>>>>   Modules:       Forest, PadsInterface
>>>>>
>>>>> Library parser
>>>>>   Path:           parsing
>>>>>   BuildTools:     ocamlbuild, menhir, ocamllex
>>>>>   Findlibparent:  forest
>>>>>   Findlibname:    parser
>>>>>   BuildDepends:   forest, ppx_deriving.show, compiler-libs.common
>>>>>   CompiledObject: best
>>>>>   Modules:  Forest_parser_helper
>>>>>   InternalModules: Forest_lexer, Forest_parser, Forest_types
>>>>>
>>>>> Library ppx
>>>>>   Path:           ppx
>>>>>   BuildTools:     ocamlbuild
>>>>>   Findlibparent:  forest
>>>>>   Findlibname:    ppx
>>>>>   BuildDepends:   re, re.str, forest.parser, forest, ppx_tools.metaquot
>>>>>   CompiledObject: best
>>>>>   Modules:        Ppx_forest
>>>>>   InternalModules: Ppx_forest_lib, Utility, Skins
>>>>>   XMETAEnable:    true
>>>>>   XMETARequires:   str re core threads ppx_tools.metaquot
>>>>>   XMETAExtraLines:  ppx = "ppx_forest"
>>>>>
>>>>> Executable ppx_forest
>>>>>   Path:           ppx
>>>>>   MainIs:         ppx_forest.ml
>>>>>   BuildDepends:   forest, forest.parser, forest.ppx, pads.ppx,
>>>>> ppx_tools.metaquot
>>>>>   CompiledObject: best
>>>>>
>>>>>
>>>>
>>>
>>
>

[-- Attachment #2: Type: text/html, Size: 9089 bytes --]

  parent reply	other threads:[~2016-10-27 18:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27  5:01 Jonathan DiLorenzo
2016-10-27 11:58 ` Ivan Gotovchits
2016-10-27 14:59   ` Jonathan DiLorenzo
2016-10-27 15:34     ` Ivan Gotovchits
2016-10-27 17:51       ` Jonathan DiLorenzo
     [not found]       ` <CADYFzVZCap-rXtA0CmMhHHk78LsNKeROxJPPj2coL6FritaNjw@mail.gmail.com>
2016-10-27 18:24         ` Ivan Gotovchits [this message]
2016-10-28  6:14           ` Jonathan DiLorenzo
2016-10-28 13:06             ` Ivan Gotovchits
2016-10-28 14:28               ` Jonathan DiLorenzo
2016-10-28 16:19                 ` Nate Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALdWJ+zOH=MRNTphqWsCjqW=cmq+fm2+tyTqP_hbAPjS6fH-5w@mail.gmail.com' \
    --to=ivg@ieee.org \
    --cc=caml-list@inria.fr \
    --cc=dilorenzo@cs.cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).