Bug#704624: Build fails to use -ffreestanding
Package: openhackware
Version: 0.4.1-6
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu raring ubuntu-patch
In Ubuntu, we're getting a build failure like this:
/build/buildd/openhackware-0.4.1/src/bootinfos.c:282: undefined reference to `__stack_chk_fail'
The fix is to build with -ffreestanding to tell the compiler that this
will be standalone object code.
I can't easily test on Debian since it doesn't have a cross-compiler
package for powerpc, but if you can use -ffreestanding I think it may
make sense to do so. Thank you for your consideration.
Patch (you might want to integrate into 001_build.patch):
---8<---
Author: Robie Basak <robie.basak@canonical.com>
Last-Update: 2013-04-03
Description: build with -ffreestanding
The target is independent of system libraries, so tell the compiler to
not assume that standard support libraries are available. This fixes a
link failure on __stack_chk_fail causing an FTBFS.
Index: openhackware-0.4.1/Makefile
===================================================================
--- openhackware-0.4.1.orig/Makefile 2013-04-03 16:53:39.000000000 +0000
+++ openhackware-0.4.1/Makefile 2013-04-03 17:11:18.919446792 +0000
@@ -45,7 +45,7 @@
CC_BASE:= $(shell $(CC) -print-search-dirs | grep install | sed -e 's/.*\ //')
CFLAGS= -Wall -W -Werror -O2 -g
-DEF_CFLAGS= $(CFLAGS) -fno-builtin -fno-common -nostdinc -mregnames
+DEF_CFLAGS= $(CFLAGS) -fno-builtin -fno-common -nostdinc -mregnames -ffreestanding
DEF_CFLAGS+= -DBUILD_DATE=$(BUILD_DATE) -DBUILD_TIME=$(BUILD_TIME)
DEF_CFLAGS+= -I$(SRCDIR)/ -I$(SRCDIR)/libc/include -I$(CC_BASE)/include
DEF_CFLAGS+= -I$(SRCDIR)/dev -I$(SRCDIR)/dev/block -I$(SRCDIR)/dev/char
Reply to: