www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - "make std/concurrency.test" fails but others don't... why?

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Martin Nowak added recently a nice feature to the Phobos makefile: by 
specifying e.g.

make std/stdio.test

only the unittests for std/stdio.d would build and run. This greatly 
improves development turnaround for Phobos.

I've used this feature regularly since introduction, but it seems to not 
work with at least std.concurrency. Running

make std/concurrency.test

produces:

duplicate symbol _D3std11concurrency10MessageBox6__initZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
duplicate symbol _D3std11concurrency10MessageBox7__ClassZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
duplicate symbol _D3std11concurrency10MessageBox6__vtblZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

What makes MessageBox special?


Andrei
Apr 10 2015
next sibling parent "weaselcat" <weaselcat gmail.com> writes:
On Friday, 10 April 2015 at 23:04:44 UTC, Andrei Alexandrescu 
wrote:
 Martin Nowak added recently a nice feature to the Phobos 
 makefile: by specifying e.g.

 make std/stdio.test

 only the unittests for std/stdio.d would build and run. This 
 greatly improves development turnaround for Phobos.

 I've used this feature regularly since introduction, but it 
 seems to not work with at least std.concurrency. Running

 make std/concurrency.test

 produces:

 duplicate symbol _D3std11concurrency10MessageBox6__initZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 duplicate symbol _D3std11concurrency10MessageBox7__ClassZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 duplicate symbol _D3std11concurrency10MessageBox6__vtblZ in:
     concurrency.o
     generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 ld: 3 duplicate symbols for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to 
 see invocation)

 What makes MessageBox special?


 Andrei
works for me, might be an issue with clang being your C compiler? try with CC=gcc make -f posix.mak std/concurrency.test
Apr 10 2015
prev sibling next sibling parent reply Martin Nowak <code+news.digitalmars dawg.eu> writes:
On 04/11/2015 01:04 AM, Andrei Alexandrescu wrote:
 What makes MessageBox special?
 
 
 Andrei
For some reason the linker drags in another copy of the concurrency module (part of it to be precise concurrency_329_3ee.o). That collides with concurrency.o the to be tested module. I don't have time to debug this on OSX, but looking at the verbose linker output or at the symbols in both object files might give you an idea, why it was pulled in. ar x generated/osx/release/64/libphobos2.a concurrency_329_3ee.o nm concurrency_329_3ee.o ../dmd/src/dmd -conf= -I../druntime/import -w -dip25 -m64 -O -release -main -unittest -c std/concurrency.d nm concurrency.o | grep ' U ' It's probably because of some undefined ModuleInfoZ or InitZ symbol in the concurrency.o object.
Apr 10 2015
parent "weaselcat" <weaselcat gmail.com> writes:
On Friday, 10 April 2015 at 23:29:04 UTC, Martin Nowak wrote:
 On 04/11/2015 01:04 AM, Andrei Alexandrescu wrote:
 What makes MessageBox special?
 
 
 Andrei
For some reason the linker drags in another copy of the concurrency module (part of it to be precise concurrency_329_3ee.o). That collides with concurrency.o the to be tested module. I don't have time to debug this on OSX, but looking at the verbose linker output or at the symbols in both object files might give you an idea, why it was pulled in. ar x generated/osx/release/64/libphobos2.a concurrency_329_3ee.o nm concurrency_329_3ee.o ../dmd/src/dmd -conf= -I../druntime/import -w -dip25 -m64 -O -release -main -unittest -c std/concurrency.d nm concurrency.o | grep ' U ' It's probably because of some undefined ModuleInfoZ or InitZ symbol in the concurrency.o object.
d'oh, thought he was on linux - been a while since I've seen anyone use a non-linux POSIX system. Sorry!
Apr 10 2015
prev sibling next sibling parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 4/10/15 7:04 PM, Andrei Alexandrescu wrote:
 Martin Nowak added recently a nice feature to the Phobos makefile: by
 specifying e.g.

 make std/stdio.test

 only the unittests for std/stdio.d would build and run. This greatly
 improves development turnaround for Phobos.

 I've used this feature regularly since introduction, but it seems to not
 work with at least std.concurrency. Running

 make std/concurrency.test

 produces:

 duplicate symbol _D3std11concurrency10MessageBox6__initZ in:
      concurrency.o
      generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 duplicate symbol _D3std11concurrency10MessageBox7__ClassZ in:
      concurrency.o
      generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 duplicate symbol _D3std11concurrency10MessageBox6__vtblZ in:
      concurrency.o
      generated/osx/release/64/libphobos2.a(concurrency_329_3ee.o)
 ld: 3 duplicate symbols for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see
 invocation)

 What makes MessageBox special?


 Andrei
There is a bug somewhere that causes issues with dmd compiled with clang on OSX. I've had to disable a test in dmd test suite before. If this problem could be solved, we could switch default build on the auto tester to use clang (it currently uses gcc). FWIW, I never had an issue with phobos unit tests. -Steve
Apr 10 2015
prev sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Friday, 10 April 2015 at 23:04:44 UTC, Andrei Alexandrescu 
wrote:
 Martin Nowak added recently a nice feature to the Phobos 
 makefile: by specifying e.g.

 make std/stdio.test

 only the unittests for std/stdio.d would build and run. This 
 greatly improves development turnaround for Phobos.
FWIW, in most cases you can also do this simply by running: dmd -unittest -main -run stdio.d It won't work if other modules have changed (compared to the dmd in your PATH).
Apr 11 2015
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 4/11/15 12:25 AM, Vladimir Panteleev wrote:
 On Friday, 10 April 2015 at 23:04:44 UTC, Andrei Alexandrescu wrote:
 Martin Nowak added recently a nice feature to the Phobos makefile: by
 specifying e.g.

 make std/stdio.test

 only the unittests for std/stdio.d would build and run. This greatly
 improves development turnaround for Phobos.
FWIW, in most cases you can also do this simply by running: dmd -unittest -main -run stdio.d It won't work if other modules have changed (compared to the dmd in your PATH).
The actual command line generated by is: ../dmd/src/dmd -conf= -I../druntime/import -w -dip25 -m64 -g -debug -main -unittest generated/osx/debug/64/libphobos2.a -defaultlib= -debuglib= -L-lcurl -run std/stdio.d So having this in the makefile: * makes sure the library is built automatically * links the right external libs * makes sure command line options such as -dip25 are not omitted * makes sure there's no interference from dmd.conf files * links the correct library * ... So if your point was it can be done just worse, sure. Andrei
Apr 11 2015
parent "timotheecour" <timothee.cour2 gmail.com> writes:
On Sunday, 12 April 2015 at 04:08:47 UTC, Andrei Alexandrescu 
wrote:
 On 4/11/15 12:25 AM, Vladimir Panteleev wrote:
 [...]
The actual command line generated by is: ../dmd/src/dmd -conf= -I../druntime/import -w -dip25 -m64 -g -debug -main -unittest generated/osx/debug/64/libphobos2.a -defaultlib= -debuglib= -L-lcurl -run std/stdio.d So having this in the makefile: * makes sure the library is built automatically * links the right external libs * makes sure command line options such as -dip25 are not omitted * makes sure there's no interference from dmd.conf files * links the correct library * ... So if your point was it can be done just worse, sure. Andrei
just posted this regression: https://issues.dlang.org/show_bug.cgi?id=14828 could this be related?
Jul 26 2015