Project

General

Profile

Actions

Bug #6462

closed

Broken build under MinGW due undefined references

Added by luislavena (Luis Lavena) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p194
Backport:
[ruby-core:45140]

Description

Attempt to compile latest trunk (r35721) result in the following errors:

linking shared-library msvcrt-ruby200.dll
Creating library file: libmsvcrt-ruby200.dll.a
dln.o: In function `rb_w32_check_imported':
C:\Users\Worker\Code\ruby\ruby\build32/../dln.c:1212: undefined reference to `_imp__ImageDirectoryEntryToData@16'
vm_dump.o: In function `dump_thread':
C:\Users\Worker\Code\ruby\ruby\build32/../vm_dump.c:696: undefined reference to `_imp__SymSetOptions@4'
win32/win32.o: In function `StartSockets':
C:\Users\Worker\Code\ruby\ruby\build32/../win32/win32.c:670: undefined reference to `_imp__WSAStartup@8'

Full output:
https://gist.github.com/2731272

Build was done with GCC 4.6.3 (mingw-w64) under Windows 7 x64. Base Ruby was 1.9.3-p194

The top output from make was:

CC = gcc
LD = ld
LDSHARED = gcc -shared -s
CFLAGS = -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration
XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -DFD_SETSIZE=32767 -D_WIN32_WINNT=0x0501   -I. -I.ext/include/i386-mingw32 -I../include -I..
DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-implib=libmsvcrt-ruby200.dll.a msvcrt-ruby200.def -Wl,--stack,0x00200000,--enable-auto-import
SOLIBS = msvcrt-ruby200.res.o -lshell32 -lws2_32 -limagehlp

I'm running git-bisect right now, but things were fine at r35648

I believe this is caused by static-link-ext, so I'm assigning to Nobu

Updated by luislavena (Luis Lavena) almost 12 years ago

=begin
After git bisect was done, I can confirm that r35709 (SHA1 0e60b2c6a3c5152fc4ff06054a4ae79edadf9276) introduced the breakage:

commit 0e60b2c6a3c5152fc4ff06054a4ae79edadf9276
Author: nobu
Date: Sat May 19 02:37:21 2012 +0000

static-linked-ext: into libruby

  • Makefile.in, common.mk (PROGRAM): no extension libraries.
  • common.mk (build-ext): pass macros for libruby.so.
  • ext/extmk.rb (command_output): link extension libraries and encoding
    libraries into libruby.so, not ruby executable.

=end

Updated by luislavena (Luis Lavena) almost 12 years ago

=begin

The issue seems to be caused by the override of SOLIBS when --enable-shared is used to build Ruby:

https://github.com/ruby/ruby/blob/trunk/ext/extmk.rb#L665-668

By doing that, system libraries defined by LIBS (which later are used as SOLIBS) like ws2_32, shell32 and others are gone.

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

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

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


Bug #6462: EXTSOLIBS

  • Makefile.in (LIBRUBY_SO): link EXTSOLIBS too.
  • ext/extmk.rb (mf.macro): use EXTSOLIBS instead of SOLIBS to get rid
    of discard libraries needed by default. [Bug #6462]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0