www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Multiple definition of .../std/regex.d.912_ModuleInfoZ

reply =?ISO-8859-15?Q?Andr=E9?= <andre s-e-a-p.de> writes:
Hi,

I have a project compiled as libary and a seccond example project using 
this library. The library is compiled without errors.

The example project has 1 main module with an empty main function and 
imports two modules of the library.

The errors following is given back from the compiler. If comment one
of the two import statements, then it is working.

I know there is no error in /std/regex.d. I do not even use this module.
But how to find out the root cause of this issue?

Kind regards
André


dmd -c "main.d" -of"..proj_dir../F/FExample/FExample/obj/Debug/main.o" 
-I"/usr/include/d/dmd/phobos" -I"/usr/include/d/dmd/druntime/import" 
-I"/usr/include/d/dmd/gtkd" -I"..proj_dir../F/FEngine/FEngine"  -gc -debug

dmd -gc -debug -of"..proj_dir../F/FExample/FExample/bin/Debug/FExample" 
"obj/Debug/main.o"  "/usr/lib/libphobos2.a" 
-L"..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a" -L-lgtkd  -L-ldl

..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o):(.data+0x0): 
multiple definition of 
`_D39/usr/include/d/dmd/phobos/std/regex.d.912__ModuleInfoZ'
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.data+0x0): 
first defined here
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In 
function `_D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ':
(.text._D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ+0x0): 
multiple definition of 
`_D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ'
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/rege
.d.97__arrayZ+0x0): 
first defined here
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In 
function `_D39/usr/include/d/dmd/phobos/std/regex.d.98__ass--- errorlevel 1
ertFiZv':
(.text._D39/usr/include/d/dmd/phobos/std/regex.d.98__assertFiZv+0x0): 
multiple definition of 
`_D39/usr/include/d/dmd/phobos/std/regex.d.98__assertFiZv'
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/regex.d.
8__assertFiZv+0x0): 
first defined here
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In 
function `_D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv':
(.text._D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv+0x0): 
multiple definition of 
`_D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv'
..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/regex.d.915__uni
test_failFiZv+0x0): 
first defined here
collect2: ld gab 1 als Ende-Status zurück
Exit code 1
Mar 04 2012
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 04.03.2012 14:49, André wrote:
 Hi,

 I have a project compiled as libary and a seccond example project using
 this library. The library is compiled without errors.

As it's a linker error I'd recommend checking that phobos and library are built using the same compiler. Basically recompile and update phobos library, then do clean rebuild of your lib.
 The example project has 1 main module with an empty main function and
 imports two modules of the library.

 The errors following is given back from the compiler. If comment one
 of the two import statements, then it is working.

 I know there is no error in /std/regex.d. I do not even use this module.
 But how to find out the root cause of this issue?

 Kind regards
 André


 dmd -c "main.d" -of"..proj_dir../F/FExample/FExample/obj/Debug/main.o"
 -I"/usr/include/d/dmd/phobos" -I"/usr/include/d/dmd/druntime/import"
 -I"/usr/include/d/dmd/gtkd" -I"..proj_dir../F/FEngine/FEngine" -gc -debug

 dmd -gc -debug -of"..proj_dir../F/FExample/FExample/bin/Debug/FExample"
 "obj/Debug/main.o" "/usr/lib/libphobos2.a"
 -L"..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a" -L-lgtkd -L-ldl

 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o):(.data+0x0):
 multiple definition of
 `_D39/usr/include/d/dmd/phobos/std/regex.d.912__ModuleInfoZ'
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.data+0x0):
 first defined here
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In
 function `_D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ':
 (.text._D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ+0x0):
 multiple definition of
 `_D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ'
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/regex.d.97__arrayZ+0x0):
 first defined here
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In
 function `_D39/usr/include/d/dmd/phobos/std/regex.d.98__ass--- errorlevel 1
 ertFiZv':
 (.text._D39/usr/include/d/dmd/phobos/std/regex.d.98__assertFiZv+0x0):
 multiple definition of
 `_D39/usr/include/d/dmd/phobos/std/regex.d.98__assertFiZv'
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/regex.d.98__assertFiZv+0x0):
 first defined here
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13a4.o): In
 function
 `_D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv':
 (.text._D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv+0x0):
 multiple definition of
 `_D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv'
 ..proj_dir../F/FEngine/FEngine/bin/Debug/FEngine.a(regex_9_13d8.o):(.text._D39/usr/include/d/dmd/phobos/std/regex.d.915__unittest_failFiZv+0x0):
 first defined here
 collect2: ld gab 1 als Ende-Status zurück
 Exit code 1

-- Dmitry Olshansky
Mar 04 2012
parent =?ISO-8859-15?Q?Andr=E9?= <andre s-e-a-p.de> writes:
Am 04.03.2012 16:27, schrieb Dmitry Olshansky:
 On 04.03.2012 14:49, André wrote:
 Hi,

 I have a project compiled as libary and a seccond example project using
 this library. The library is compiled without errors.

As it's a linker error I'd recommend checking that phobos and library are built using the same compiler. Basically recompile and update phobos library, then do clean rebuild of your lib.
 The example project has 1 main module with an empty main function and
 imports two modules of the library.

 The errors following is given back from the compiler. If comment one
 of the two import statements, then it is working.

 I know there is no error in /std/regex.d. I do not even use this module.
 But how to find out the root cause of this issue?

 Kind regards
 André


Hi Dmitry, thanks for the help. I found out, the compiler/linker parameter for the library project were wrong and caused the error while linking the example project. Kind regards André
Mar 05 2012