Thread overview | |||||
---|---|---|---|---|---|
|
June 10, 2017 workaround for `The module 'foo.bar' is already defined` when recompiling objects? | ||||
---|---|---|---|---|
| ||||
``` dmd -shared -oflibfoo.so a1.d a2.d dmd -ofmain -L-lfoo a2.d main.d ./main ``` gives runtime error: `The module 'foo.bar' is already defined in 'main'` How would I work around this error? Use case: allow partial recompilation of a binary without rebuilding everything to optimize compile time for fast edit debug cycles. |
June 11, 2017 Re: workaround for `The module 'foo.bar' is already defined` when recompiling objects? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | On Sunday, 11 June 2017 at 05:21:23 UTC, Timothee Cour wrote:
> ```
NOTE: this is on linux, and the above simple case doesn't reproduce
the error, but my test case is similar albeit from a larger program
that's hard to reduce.
the code that crashes is in druntime:
/**
* Check for module collisions. A module in a shared library collides
* with an existing module if it's ModuleInfo is interposed (search
* symbol interposition) by another DSO. Therefor two modules with the
* same name do not collide if their DSOs are in separate symbol resolution
* chains.
*/
void checkModuleCollisions(in ref dl_phdr_info info, in
immutable(ModuleInfo)*[] modules,
in void[] copyRelocSection) nothrow
Could someone please explain:
* what that means
* what's the simplest example that would exhibit this error
* what's a workaround ? (where i want to do partial recompilation)
|
June 11, 2017 Re: workaround for `The module 'foo.bar' is already defined` when recompiling objects? | ||||
---|---|---|---|---|
| ||||
Posted in reply to timotheecour | On Sunday, 11 June 2017 at 07:09:33 UTC, timotheecour wrote:
> On Sunday, 11 June 2017 at 05:21:23 UTC, Timothee Cour wrote:
>> [...]
>
> NOTE: this is on linux, and the above simple case doesn't reproduce
> the error, but my test case is similar albeit from a larger program
> that's hard to reduce.
>
> [...]
On Sunday, 11 June 2017 at 07:09:33 UTC, timotheecour wrote:
Removing `-l:libphobos2.so.0.72` from dub.json "lflags" fixed the issue, but I'd like to understand why?
|
Copyright © 1999-2021 by the D Language Foundation