[flac-dev] Can't cross-compile from git now.

Erik de Castro Lopo mle+la at mega-nerd.com
Tue Mar 12 12:39:07 PDT 2013


JonY wrote:

> What is your link test checking and how does it fail?

My m4 macro is really simple, TRY_LINK a simple program with the
stack protect CFLAGS:

    AC_DEFUN([XIPH_GCC_STACK_PROTECTOR],
    [AC_LANG_ASSERT(C)
	AC_MSG_CHECKING([if $CC supports stack smash protection])
	xiph_stack_check_old_cflags="$CFLAGS"
	SSP_FLAGS="-fstack-protector --param ssp-buffer-size=4"
	CFLAGS=$SSP_FLAGS
	AC_TRY_LINK([
			#include <stdio.h>
			],
		[puts("Hello, World!"); return 0;],
		AC_MSG_RESULT([yes])
			CFLAGS="$xiph_stack_check_old_cflags $SSP_FLAGS",
		AC_MSG_RESULT([no])
			CFLAGS="$xiph_stack_check_old_cflags"
		)
    ])# XIPH_GCC_STACK_PROTECTOR

For the Linux -> Windows cross compile for instance, this detects
SSP as working, but when I compile it fails with:

    CC     stream_encoder_framing.lo
    CC     window.lo
    CCLD   libFLAC.la
  Creating library file: .libs/libFLAC.dll.a
  .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x8d): undefined reference to `___stack_chk_guard'
  .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x121): undefined reference to `___stack_chk_guard'
  .libs/metadata_iterators.o:metadata_iterators.c:(.text+0x14f): undefined reference to `___stack_chk_fail'

The odd thinh is, if I use this MinGW cross-compiler to compile a small
program, it works perfectly. The problem aboce is related to building
a Windows DLL.

On FreeBSD everything goes fine until it tries to link test_libFLAC++:

    Making all in test_libFLAC++
      CXX      decoders.o
      CXX      encoders.o
      CXX      main.o
      CXX      metadata.o
      CXX      metadata_manip.o
      CXX      metadata_object.o
      CXXLD    test_libFLAC++
    /usr/home/erikd/flac/src/libFLAC/.libs/libFLAC.so: undefined reference to `__stack_chk_fail_local'
    *** [test_libFLAC++] Error code 1


Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the flac-dev mailing list