Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link failure with module alias to module without implementation #6923

Closed
vicuna opened this issue Jul 7, 2015 · 4 comments
Closed

Link failure with module alias to module without implementation #6923

vicuna opened this issue Jul 7, 2015 · 4 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 7, 2015

Original bug ID: 6923
Reporter: @let-def
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:15:10Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.02.2
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche @diml

Bug description

When a module is defined only with an mli file (no implementation) and then referred to with a module alias, compilation fails at linking step with message:

Error: No implementations provided for the following modules:
Parsetree referenced from src/ocaml/raw_compat.cmx

Steps to reproduce

b.mli : type t
a.ml : module B = B

$ ocamlopt b.mli a.ml
File "a.ml", line 1:
Error: No implementations provided for the following modules:
B referenced from a.cmx

@vicuna
Copy link
Author

vicuna commented Jul 7, 2015

Comment author: @sliquister

The error is your small example is correct. You need to use -no-alias-deps.

@vicuna
Copy link
Author

vicuna commented Jul 7, 2015

Comment author: @let-def

I disagree: turning on -no-alias-deps will affect all other module aliases.

@vicuna
Copy link
Author

vicuna commented Jul 7, 2015

Comment author: @garrigue

The point is that you will see the same behavior with old versions of ocaml.
Without -no-alias-deps, module aliases behave just like real modules, and making a copy of a module requires an implementation.

Note however that the old workaround to create a module from a signature does work:

module rec M : module type of struct include B end = M

@vicuna
Copy link
Author

vicuna commented Jul 7, 2015

Comment author: @let-def

Yes, old versions of ocaml have the same behavior, but what is worrying in the current situation is that I have to know how a module is implemented to be able to reexport it.

In the case of compiler-libs,

module Ast_helper = Ast_helper

module rec Parsetree0 : module type of struct include Parsetree end = Parsetree0

And the workaround doesn't seem to work: after changing a.ml from my example with the line you gave, I still get the same error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants