From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28775 invoked by alias); 12 Aug 2010 10:18:46 -0000 Received: (qmail 28766 invoked by uid 22791); 12 Aug 2010 10:18:46 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Aug 2010 10:18:38 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7CAIack023578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Aug 2010 06:18:36 -0400 Received: from zebedee.pink (ovpn-113-67.phx2.redhat.com [10.3.113.67]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7CAIZk4030008; Thu, 12 Aug 2010 06:18:35 -0400 Message-ID: <4C63CA77.5070701@redhat.com> Date: Thu, 12 Aug 2010 10:18:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Thunderbird/3.0 MIME-Version: 1.0 To: "gcc-help@gcc.gnu.org" Subject: Re: Link error References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00084.txt.bz2 On 08/09/2010 02:59 PM, Phung Nguyen wrote: > Dear all, > > I am trying to build cross compiler for xc16x. I built successfully > binutils 2.18; gcc 4.0 and newlib 1.18. Everything is fine when > compiling a simple C file without any library call. It is also fine > when making a simple call to printf like printf("Hello world"). > However, i got error message from linker when call printf("i=%i",i); > The error message is as follows > > /home/guest/xc16x/lib/gcc/xc16x-elf/lib/xc16xl/libc.a(lib_a-sbrkr.o): > In function _sbrk_r: > /home/guest/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60: undefined > reference to __sbrk > /home/guest/fromKpit/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60: > undefined reference to __sbrk > .... > > collect2: ld returned 1 exit status > make: *** [bubble.out] Error 1 > > > Is there any idea how to solve the problem? I highly appreciate any help. You have to provide sbrk. See http://sca.uwaterloo.ca/coldfire/gcc-doc/docs/porting_3.html Andrew.