Project

General

Profile

Actions

Bug #5675

closed

[mingw] static build fails due to socket extension build failure

Added by jonforums (Jon Forums) about 13 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
-
Backport:
[ruby-core:41314]

Description

I get the following failure on my Win7 32bit system while trying to build ruby_1_9_3@33661 The problem likely exists on trunk@33852 but #5674 blocks me from trying to replicate.

Providing --with-out-ext=socket to ./configure is a one (undesirable) workaround. No failure when building on Arch.

C:\Users\Jon\Documents\RubyDev\ruby-git\build>sh -c "../configure --disable-shared --disable-install-doc && make"
...
make[2]: Entering directory /c/Users/Jon/Documents/RubyDev/ruby-git/build/ext/socket' generating socket-i386-mingw32.def generating constant definitions compiling ../../../ext/socket/init.c compiling ../../../ext/socket/constants.c compiling ../../../ext/socket/basicsocket.c compiling ../../../ext/socket/socket.c ../../../ext/socket/socket.c: In function 'rsock_sock_s_socketpair': ../../../ext/socket/socket.c:114:5: warning: implicit declaration of function 'socketpair' compiling ../../../ext/socket/ipsocket.c compiling ../../../ext/socket/tcpsocket.c compiling ../../../ext/socket/tcpserver.c compiling ../../../ext/socket/sockssocket.c compiling ../../../ext/socket/udpsocket.c compiling ../../../ext/socket/unixsocket.c compiling ../../../ext/socket/unixserver.c compiling ../../../ext/socket/option.c compiling ../../../ext/socket/ancdata.c compiling ../../../ext/socket/raddrinfo.c linking shared-object socket.so socket.o: In function rsock_sock_s_socketpair':
c:\Users\Jon\Documents\RubyDev\ruby-git\build\ext\socket/../../../ext/socket/socket.c:114: undefined reference to socketpair' c:\Users\Jon\Documents\RubyDev\ruby-git\build\ext\socket/../../../ext/socket/socket.c:117: undefined reference to socketpair'
collect2: ld returned 1 exit status
make[2]: *** [../../.ext/i386-mingw32/socket.so] Error 1
make[2]: Leaving directory /c/Users/Jon/Documents/RubyDev/ruby-git/build/ext/socket' make[1]: *** [ext/socket/all] Error 2 make[1]: Leaving directory /c/Users/Jon/Documents/RubyDev/ruby-git/build'
make: *** [build-ext] Error 2

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

  • ruby -v changed from ruby 1.9.3p0 (2011-11-08 revision 33661) [i386-mingw32] to -

compiling ../../../ext/socket/socket.c
../../../ext/socket/socket.c: In function 'rsock_sock_s_socketpair':
../../../ext/socket/socket.c:114:5: warning: implicit declaration of function 'socketpair'

This warning shouldn't be happen. But I'm wondering it because many
people did success mingw32 build. Hmm..

Luis, do you have any opinion? (note: this is head of ruby_1_9_3 branch).

Updated by phasis68 (Heesob Park) about 13 years ago

Configuring with --disable-shared option caused failure on mingw32 build.

As a workaround, inserting following 4 lines at line #12 of socket.c solves the problem.

#ifdef _WIN32
#undef socketpair
#define socketpair(a, t, p, s) rb_w32_socketpair(a, t, p, s)
#endif

Updated by luislavena (Luis Lavena) about 13 years ago

On Sun, Nov 27, 2011 at 4:11 AM, KOSAKI Motohiro
wrote:

This warning shouldn't be happen. But I'm wondering it because many
people did success mingw32 build. Hmm..

Build with --enable-shared does work, but doesn't work when build with
--disable-shared.

I think Heesob's patch does the trick, will test in a little bit.

--
Luis Lavena
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

2011/11/27 Luis Lavena :

On Sun, Nov 27, 2011 at 4:11 AM, KOSAKI Motohiro
wrote:

This warning shouldn't be happen. But I'm wondering it because many
people did success mingw32 build. Hmm..

Build with --enable-shared does work, but doesn't work when build with
--disable-shared.

I think Heesob's patch does the trick, will test in a little bit.

Why doesn't socket.c include "ruby/win32.h"? I apologize if I ask
dumb question.

Updated by luislavena (Luis Lavena) about 13 years ago

On Sun, Nov 27, 2011 at 12:41 PM, KOSAKI Motohiro
wrote:

Why doesn't socket.c include "ruby/win32.h"?  I apologize if I ask
dumb question.

Not a dumb question, a very valid one...

ruby.h includes ruby/ruby.h
ruby/ruby.h includes ruby/defines.h
ruby/defines.h does include ruby/win32.h

socket.c is including rubysocket.h which includes ruby/ruby.h, so it
should be resolving properly, right?

--
Luis Lavena
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

Why doesn't socket.c include "ruby/win32.h"?  I apologize if I ask
dumb question.

Not a dumb question, a very valid one...

ruby.h includes ruby/ruby.h
ruby/ruby.h includes ruby/defines.h
ruby/defines.h does include ruby/win32.h

socket.c is including rubysocket.h which includes ruby/ruby.h, so it
should be resolving properly, right?

I thought so. But I can't think Jon told lie....

Actions #7

Updated by nobu (Nobuyoshi Nakada) about 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33876.
Jon, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • include/ruby/subst.h: moved Windows specific substitions from
    win32.h.
  • ext/socket/rubysocket.h: include ruby/subst.h. [Bug #5675]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0