www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - obscure messages relating to linking and imports in 2.071.1

reply Laeeth Isharc <laeeth-nospam nospamlaeeth.com> writes:
I noticed the problem before - previously it was my fault.

I had a circulator dependency where A imported B, B did a 
selective import of C and C imported A selectively.  That led to 
link problems with module constructors.

Here I noticed it in a different context.  Simple two-page main 
code imports dateparser from code.dlang.org.  dateparser uses 
emsi containers, which use std.experimental.allocator.

If I don't import std.experimental.allocator in main module 
(where it isn't actually used) I get the link errors below.  If I 
import it, it goes away.

Might be fixed in 2.071.2 - will upgrade when I can.

Not certain it's a bug and if it is whether it might be fixed, 
but if you think I should I will report.

I can't share code publicly, but I can share gist privately.

Laeeth.

Linking...
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o):(.bss+0x0): 
multiple definition of 
`_D3std12experimental9allocator12gc_allocator11GCAllocator6__initZ'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b
_42b.o):(.bss+0x0): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o): In function 
`_D3std12experimental9allocator12gc_allocator11GCAllocator8allocateMOFNemZAv':
(.text._D3std12experimental9allocator12gc_allocator11GCAllocator8all
cateMOFNemZAv+0x0): multiple definition of
`_D3std12experimental9allocator12gc_allocator11GCAllocator8allocateMOFNemZAv'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b2_42b.o):../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/gc_allocator.d:(.text._D3std12experimental9allocator12gc_allocator11GCAllocator8all
cateMOFNemZAv+0x0): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o): In function 
`_D3std12experimental9allocator12gc_allocator11GCAllocator10reallocateMOFKAvmZb':
(.text._D3std12experimental9allocator12gc_allocator11GCAllocator10reall
cateMOFKAvmZb+0x0): multiple definition of
`_D3std12experimental9allocator12gc_allocator11GCAllocator10reallocateMOFKAvmZb'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b2_42b.o):../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/gc_allocator.d:(.text._D3std12experimental9allocator12gc_allocator11GCAllocator10reall
cateMOFKAvmZb+0x0): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o): In function 
`_D3std12experimental9allocator12gc_allocator11GCAllocator22resolveInternalPointerMOFPvZAv':
(.text._D3std12experimental9allocator12gc_allocator11GCAllocator22resolveInternalP
interMOFPvZAv+0x0): multiple definition of
`_D3std12experimental9allocator12gc_allocator11GCAllocator22resolveInternalPointerMOFPvZAv'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b2_42b.o):../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/gc_allocator.d:(.text._D3std12experimental9allocator12gc_allocator11GCAllocator22resolveInternalP
interMOFPvZAv+0x0): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o): In function 
`_D3std12experimental9allocator12gc_allocator11GCAllocator10deallocateMOFAvZb':
(.text._D3std12experimental9allocator12gc_allocator11GCAllocator10dea
locateMOFAvZb+0x0): multiple definition of
`_D3std12experimental9allocator12gc_allocator11GCAllocator10deallocateMOFAvZb'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b2_42b.o):../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/gc_allocator.d:(.text._D3std12experimental9allocator12gc_allocator11GCAllocator10dea
locateMOFAvZb+0x0): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o):(.bss+0x1): 
multiple definition of 
`_D3std12experimental9allocator12gc_allocator11GCAllocator8instanceOS3std12experimental9allocator12gc_allocator11GCAllocator'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b
_42b.o):(.bss+0x1): first defined here
/usr/lib/libphobos2.a(gc_allocator_2c45_42b.o): In function 
`_D3std12experimental9allocator12gc_allocator11GCAllocator7collectMOFNeZv':
(.text._D3std12experimental9allocator12gc_allocator11GCAllocator7
ollectMOFNeZv+0x0): multiple definition of
`_D3std12experimental9allocator12gc_allocator11GCAllocator7collectMOFNeZv'
../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/libexperimental_allocator.a(gc_allocator_b2_42b.o):../../../../../../../../home/laeeth/.dub/packages/experimental_allocator-2.70.0-b1/src/std/experimental/allocator/gc_allocator.d:(.text._D3std12experimental9allocator12gc_allocator11GCAllocator7
ollectMOFNeZv+0x0): first defined here
collect2: error: ld returned 1 exit status
--- errorlevel 1
dmd failed with exit code 1.
Oct 05 2016
parent reply Basile B. <b2.temp gmx.com> writes:
On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc wrote:
 I noticed the problem before - previously it was my fault.

 I had a circulator dependency where A imported B, B did a 
 selective import of C and C imported A selectively.  That led 
 to link problems with module constructors.

 [...]
It looks like there's a conflict between HackerPilot's fork and the phobos version. But HackerPilot's fork is not used anymore. Have you pulled the latest versions recently (or dub upgrade if you use DUB) ? (verification: https://github.com/economicmodeling/containers/commit/528cae2880c0e5faa57d192621ad0533b0124b7b)
Oct 05 2016
next sibling parent Basile B. <b2.temp gmx.com> writes:
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote:
 On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc 
 wrote:
 I noticed the problem before - previously it was my fault.

 I had a circulator dependency where A imported B, B did a 
 selective import of C and C imported A selectively.  That led 
 to link problems with module constructors.

 [...]
It looks like there's a conflict between HackerPilot's fork and the phobos version. But HackerPilot's fork is not used anymore. Have you pulled the latest versions recently (or dub upgrade if you use DUB) ? (verification: https://github.com/economicmodeling/containers/commit/528cae2880c0e5faa57d192621ad0533b0124b7b)
Forgot to say but let's say you're not using DUB but rather git modules + script/makefile...git fails to physically delete the submodules when it has to (i.e after "git pull && git submodules update" the content is still there). So you have to delete the content of the folder experimental_allocator manually. Then update your build script or makefile.
Oct 05 2016
prev sibling parent Laeeth Isharc <laeethnospam nospam.laeeth.com> writes:
On Wednesday, 5 October 2016 at 12:12:24 UTC, Basile B. wrote:
 On Wednesday, 5 October 2016 at 11:45:49 UTC, Laeeth Isharc 
 wrote:
 I noticed the problem before - previously it was my fault.

 I had a circulator dependency where A imported B, B did a 
 selective import of C and C imported A selectively.  That led 
 to link problems with module constructors.

 [...]
It looks like there's a conflict between HackerPilot's fork and the phobos version. But HackerPilot's fork is not used anymore. Have you pulled the latest versions recently (or dub upgrade if you use DUB) ? (verification: https://github.com/economicmodeling/containers/commit/528cae2880c0e5faa57d192621ad0533b0124b7b)
Aha, thank you. Obvious after the fact now you point it out, and I guess that must be it. Laeeth
Oct 05 2016