Issue #5676 has been updated by Jon Forums. Thanks for checking. Trunk builds fine using the old default gcc 4.2.1 and configure adds `-fstack-protector` to Makefile. I think you're right on runtime library mismatch, but shouldn't it fail when miniruby is used later in the build process, not at miniruby link time? The following sequence definitely looks like a library mismatch... ldconfig -rv | grep gcc search directories: /lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg:/usr/local/lib/gcc46:/usr/local/lib/nss:/usr/local/lib/pth:/usr/local/lib/qt4:/usr/local/lib/zsh 33:-lgcc_s.1 => /lib/libgcc_s.so.1 ... 475:-lssp.0 => /usr/local/lib/gcc46/libssp.so.0 ldconfig -rv | grep ssp 35:-lssp.0 => /lib/libssp.so.0 475:-lssp.0 => /usr/local/lib/gcc46/libssp.so.0 diff -q /lib/libssp.so.0 /usr/local/lib/gcc46/libssp.so.0 Files /lib/libssp.so.0 and /usr/local/lib/gcc46/libssp.so.0 differ stat -f '%z' /lib/libssp.so.0 /usr/local/lib/gcc46/libssp.so.0 6828 26880 objdump -tT /usr/local/lib/gcc46/libssp.so.0 | grep __stack_chk_fail 00000ba0 l F .text 00000019 __stack_chk_fail_local 00000b40 g F .text 00000028 __stack_chk_fail 00000b40 g DF .text 00000028 LIBSSP_1.0 __stack_chk_fail objdump -tT /lib/libssp.so.0 | grep __stack_chk_fail 00000fc0 g DF .text 00000027 LIBSSP_1.0 __stack_chk_fail But shouldn't gcc46's default search dirs save the link like it appears to be happening when configure (using `--with-gcc=gcc46`) executes `RUBY_TRY_CFLAGS(-fstack-protector, ...)`? gcc46 -print-search-dirs install: /usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/ programs: =/usr/local/libexec/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/:/usr/local/libexec/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/:/usr/local/libexec/gcc46/gcc/i386-portbld-freebsd9.0/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../../../i386-portbld-freebsd9.0/bin/i386-portbld-freebsd9.0/4.6.2/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../../../i386-portbld-freebsd9.0/bin/ libraries: =/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../../../i386-portbld-freebsd9.0/lib/i386-portbld-freebsd9.0/4.6.2/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../../../i386-portbld-freebsd9.0/lib/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../i386-portbld-freebsd9.0/4.6.2/:/usr/local/lib/gcc46/gcc/i386-portbld-freebsd9.0/4.6.2/../../../:/lib/i386-portbld-freebsd9.0/4.6.2/:/lib/:/usr/lib/i386-portbld-freebsd9.0/4.6.2/:/usr/lib/ I've overlooked something important or a FreeBSD post-install step after running `sudo pkg_add -r gcc-4.6.2`. Back to the RTFM-a-thon unless you guys spot my mistake. ---------------------------------------- Bug #5676: miniruby linking error: undefined reference to ___stack_chk_guard https://bugs.ruby-lang.org/issues/5676 Author: Martin Dürst Status: Feedback Priority: Normal Assignee: Motohiro KOSAKI Category: build Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2011-11-27 trunk 33861) [i386-cygwin] I get what I think is a linking error when linking miniruby. Below is a (shortened) copy of the output I get. This is on a clean checkout of trunk (using Ruby 1.8.7 as baseruby). duerst@jougashima /cygdrive/c/Data/ruby-public $ make CC = gcc LD = ld LDSHARED = gcc -shared -s CFLAGS = -O3 -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 -fstack-protector -DRUBY_EXPORT CPPFLAGS = -I. -I.ext/include/i386-cygwin -I./include -I. DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-implib=libruby191.dll.a cygruby191.def -Xlinker --no-undefined SOLIBS = cygruby191.res.o -lpthread -lrt -ldl -lcrypt linking miniruby.exe dmyencoding.o: In function `set_encoding_const': /cygdrive/c/Data/ruby-public/encoding.c:1473: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/encoding.c:1520: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/encoding.c:1520: undefined reference to `___stack_chk_fail' bignum.o: In function `rb_str_to_inum': /cygdrive/c/Data/ruby-public/bignum.c:763: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/bignum.c:790: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/bignum.c:790: undefined reference to `___stack_chk_fail' dir.o: In function `dir_read': /cygdrive/c/Data/ruby-public/dir.c:569: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/dir.c:586: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/dir.c:586: undefined reference to `___stack_chk_fail' [... many more like these ...] vm_dump.o: In function `control_frame_dump': /cygdrive/c/Data/ruby-public/vm_dump.c:27: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/vm_dump.c:148: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/vm_dump.c:148: undefined reference to `___stack_chk_fail' cont.o: In function `cont_restore_0': /cygdrive/c/Data/ruby-public/cont.c:733: undefined reference to `___stack_chk_guard' unicode.o: In function `onigenc_unicode_property_name_to_ctype': /cygdrive/c/Data/ruby-public/./enc/unicode.c:2087: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/./enc/unicode.c:2114: undefined reference to `___stack_chk_guard' /cygdrive/c/Data/ruby-public/./enc/unicode.c:2114: undefined reference to `___stack_chk_fail' collect2: ld returned 1 exit status make: *** [miniruby.exe] Error 1 duerst@jougashima /cygdrive/c/Data/ruby-public $ -- http://bugs.ruby-lang.org/