Thread overview
[Issue 18066] duplicate symbol error when symbol is in a ".o" and a ".a" ; linker should accept it to allow partial recompilation
[Issue 18066] regression: duplicate symbol __Dmain : worked in dmd.071.2, fails in dmd.072
Dec 12, 2017
Timothee Cour
Dec 12, 2017
Timothee Cour
Dec 12, 2017
Timothee Cour
Dec 12, 2017
Timothee Cour
Dec 12, 2017
anonymous4
Mar 25, 2022
RazvanN
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18066

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2@gmail.com

--- Comment #1 from Timothee Cour <timothee.cour2@gmail.com> ---
EDIT: fun2.d is not essential and can be removed from this reduced case.

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18066

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|regression: duplicate       |duplicate symbol error when
                   |symbol __Dmain : worked in  |symbol is in a ".o" and a
                   |dmd.071.2, fails in dmd.072 |".a" ; linker should accept
                   |                            |it to allow partial
                   |                            |recompilation

--- Comment #2 from Timothee Cour <timothee.cour2@gmail.com> ---
EDIT: the reason i thought dmd2_071_2 accepted it was because the syntax -of= was introduced in 072, and shell magic made the example work somehow by accident, so reclassified as blocker instead of regression.

Nevertheless, IMO partial recompilation should be accepted. If not what are workarounds?

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18066

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |blocker

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18066

--- Comment #3 from Timothee Cour <timothee.cour2@gmail.com> ---
NOTE: there's also the mystery that "import std.file;" is somehow special and other imports don't have this error.

--
December 12, 2017
https://issues.dlang.org/show_bug.cgi?id=18066

--- Comment #4 from anonymous4 <dfj1esp02@sneakemail.com> ---
Try to compile main_aux separately?
---
dmd -of=./build//app.o -c -g fun1.d fun2.d
dmd -of=./build//main.o -c -g main_aux.d
libtool -static ./build//app.o ./build//main.o -o ./build//libapp.a
dmd -of=./build//app -g -L./build//libapp.a main_aux.d
---
Usually linker can't omit symbols selectively from one object file, so you
should compile to separate object files, what dmd -lib does - that's why it
works.
btw what is // ?

--
March 25, 2022
https://issues.dlang.org/show_bug.cgi?id=18066

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> ---
I can't reproduce this.

--