Forum: Ruby-core [ruby-trunk - Bug #7960][Open] Ruby fails to build static under mswin linker error: multiple definit

Posted by Ryexander (Benjamin Powers) (Guest)
on 2013-02-25 21:52
(Received via mailing list)
Issue #7960 has been reported by Ryexander (Benjamin Powers).

----------------------------------------
Bug #7960: Ruby fails to build static under mswin linker error: multiple 
definitions of _Init_ext
https://bugs.ruby-lang.org/issues/7960

Author: Ryexander (Benjamin Powers)
Status: Open
Priority: Normal
Assignee:
Category: build
Target version: 2.0.0
ruby -v: 1.9.3


after the depend errors were fixed I obtained r39490 and attempted to 
build it

after nearly completing it failed with

ruby200.dll : fatal error LNK1169: one or more multiply defined symbols 
found

searching through the output found only one line with a "already 
defined"

ruby200-static.lib(dmyext.obj) : error LNK2005: _Init_ext already 
defined in ext
init.obj

attached is the full output of the configure.bat and nmake commands run 
with arguments
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-26 00:30
(Received via mailing list)
Issue #7960 has been updated by ko1 (Koichi Sasada).

Assignee set to usa (Usaku NAKAMURA)
Target version changed from 2.0.0 to 2.1.0


----------------------------------------
Bug #7960: Ruby fails to build static under mswin linker error: multiple 
definitions of _Init_ext
https://bugs.ruby-lang.org/issues/7960#change-37011

Author: Ryexander (Benjamin Powers)
Status: Open
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category: build
Target version: 2.1.0
ruby -v: 1.9.3


after the depend errors were fixed I obtained r39490 and attempted to 
build it

after nearly completing it failed with

ruby200.dll : fatal error LNK1169: one or more multiply defined symbols 
found

searching through the output found only one line with a "already 
defined"

ruby200-static.lib(dmyext.obj) : error LNK2005: _Init_ext already 
defined in ext
init.obj

attached is the full output of the configure.bat and nmake commands run 
with arguments
Posted by usa (Usaku NAKAMURA) (Guest)
on 2013-02-26 01:33
(Received via mailing list)
Issue #7960 has been updated by usa (Usaku NAKAMURA).

Status changed from Open to Assigned
Assignee changed from usa (Usaku NAKAMURA) to nobu (Nobuyoshi Nakada)


----------------------------------------
Bug #7960: Ruby fails to build static under mswin linker error: multiple 
definitions of _Init_ext
https://bugs.ruby-lang.org/issues/7960#change-37014

Author: Ryexander (Benjamin Powers)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: 2.1.0
ruby -v: 1.9.3


after the depend errors were fixed I obtained r39490 and attempted to 
build it

after nearly completing it failed with

ruby200.dll : fatal error LNK1169: one or more multiply defined symbols 
found

searching through the output found only one line with a "already 
defined"

ruby200-static.lib(dmyext.obj) : error LNK2005: _Init_ext already 
defined in ext
init.obj

attached is the full output of the configure.bat and nmake commands run 
with arguments
Posted by Ryexander (Benjamin Powers) (Guest)
on 2013-02-28 03:51
(Received via mailing list)
Issue #7960 has been updated by Ryexander (Benjamin Powers).


I've been trying to resolve this on my own. is dmyext.c even required 
when linking exts statically? it semes to be just a prototype for 
extentions which gets redefined in extinit
----------------------------------------
Bug #7960: Ruby fails to build static under mswin linker error: multiple 
definitions of _Init_ext
https://bugs.ruby-lang.org/issues/7960#change-37176

Author: Ryexander (Benjamin Powers)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: current: 2.1.0
ruby -v: 1.9.3


after the depend errors were fixed I obtained r39490 and attempted to 
build it

after nearly completing it failed with

ruby200.dll : fatal error LNK1169: one or more multiply defined symbols 
found

searching through the output found only one line with a "already 
defined"

ruby200-static.lib(dmyext.obj) : error LNK2005: _Init_ext already 
defined in ext
init.obj

attached is the full output of the configure.bat and nmake commands run 
with arguments
Posted by Ryexander (Benjamin Powers) (Guest)
on 2013-03-02 10:00
(Received via mailing list)
Issue #7960 has been updated by Ryexander (Benjamin Powers).


infact I think I'm right, it's right here in the 2.0 change log

 ext/extmk.rb (command_output): dmyext is needed as DLDOBJS if no static 
linked extensions.

this would seem to imply that is there were statically linked extentions 
it is not needed

the error happens as it is linking in the shared dll and considering 
that dmyext is included in both the static lib and the shared lib inside 
$(DMYEXT) and $(DLDOBJS) respectively

    relevant lines from common.mk

    $(LIBRUBY_A):  $(OBJS) $(MAINOBJ) $(DTRACE_OBJ) 
$(DTRACE_GLOMMED_OBJ) $(DMYEXT) $(ARCHFILE)

    $(LIBRUBY_SO):  $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) 
$(LIBRUBY_SO_UPDATE) $(BUILTIN_ENCOBJS)


i'm pretty sure that the inclusion of dmyext is what is causing the 
error.

not sure how to solve it though. I suspect it needs to be removed as a 
link somewhere under the condition of there being statically linked 
extensions.
----------------------------------------
Bug #7960: Ruby fails to build static under mswin linker error: multiple 
definitions of _Init_ext
https://bugs.ruby-lang.org/issues/7960#change-37249

Author: Ryexander (Benjamin Powers)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: build
Target version: current: 2.1.0
ruby -v: 1.9.3


after the depend errors were fixed I obtained r39490 and attempted to 
build it

after nearly completing it failed with

ruby200.dll : fatal error LNK1169: one or more multiply defined symbols 
found

searching through the output found only one line with a "already 
defined"

ruby200-static.lib(dmyext.obj) : error LNK2005: _Init_ext already 
defined in ext
init.obj

attached is the full output of the configure.bat and nmake commands run 
with arguments
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.