| 1 |
This test showcases that although libraries can technically have non overlapping |
| 2 |
stubs names, things are still broken if their .o files overlap: |
| 3 |
|
| 4 |
$ cat >dune <<EOF |
| 5 |
> (library |
| 6 |
> (name foo) |
| 7 |
> (c_names foo sub/foo)) |
| 8 |
> EOF |
| 9 |
|
| 10 |
Another form of this bug is if the same source is present in different |
| 11 |
directories. In this case, the rules are fine, but this is probably not what the |
| 12 |
user intended. |
| 13 |
|
| 14 |
$ dune build @all |
| 15 |
File "dune", line 3, characters 14-21: |
| 16 |
3 | (c_names foo sub/foo)) |
| 17 |
^^^^^^^ |
| 18 |
Error: Relative part of stub is not necessary and should be removed. To |
| 19 |
include sources in subdirectories, use the (include_subdirs ...) stanza. |
| 20 |
[1] |
| 21 |
|
| 22 |
$ cat >dune <<EOF |
| 23 |
> (include_subdirs unqualified) |
| 24 |
> (library |
| 25 |
> (name foo) |
| 26 |
> (c_names foo)) |
| 27 |
> EOF |
| 28 |
|
| 29 |
$ dune build @all |
| 30 |
File "dune", line 4, characters 10-13: |
| 31 |
4 | (c_names foo)) |
| 32 |
^^^ |
| 33 |
Error: Multiple sources map to the same object name "foo": |
| 34 |
- foo.c |
| 35 |
- sub/foo.c |
| 36 |
This is not allowed; please rename them or remove "foo" from object names. |
| 37 |
Hint: You can also avoid the name clash by placing the objects into different |
| 38 |
foreign archives and building them in different directories. Foreign archives |
| 39 |
can be defined using the (foreign_library ...) stanza. |
| 40 |
[1] |