Patchwork Trouble compiling tint payload

login
register
about
Submitter Andrew Guertin
Date 2010-08-23 14:19:17
Message ID <4C728365.7070007@dolphinling.net>
Download mbox | patch
Permalink /patch/1788/
State Not Applicable
Headers show

Comments

Andrew Guertin - 2010-08-23 14:19:17
I'm having trouble compiling the tint payload.

When following the instructions on the wiki at http://www.coreboot.org/Tint, I 
get an error about lpgcc. I've figured out I need to make the following change 
to the Makefile:



After that, I try to compile with
make CC=/.../coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc
and get the following errors:

/.../coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc -Wall -Os -c -o tint.o tint.c
In file included from tint.c:43:
config.h:32:24: error: libpayload.h: No such file or directory
config.h:33:20: error: curses.h: No such file or directory
tint.c: In function 'showstatus':
tint.c:211: warning: implicit declaration of function 'snprintf'
tint.c:211: warning: incompatible implicit declaration of built-in function 
'snprintf'
tint.c:212: warning: implicit declaration of function 'strlen'
tint.c:212: warning: incompatible implicit declaration of built-in function 'strlen'
tint.c: At top level:
tint.c:323: error: expected specifier-qualifier-list before 'time_t'
tint.c: In function 'showplayerstats':
tint.c:361: warning: implicit declaration of function 'printf'
tint.c:361: warning: incompatible implicit declaration of built-in function 'printf'
tint.c: In function 'main':
tint.c:586: warning: implicit declaration of function 'memset'
tint.c:586: warning: incompatible implicit declaration of built-in function 'memset'
tint.c:689: warning: implicit declaration of function 'mvprintw'
tint.c:690: warning: implicit declaration of function 'refresh'
tint.c:691: warning: implicit declaration of function 'halt'
make: *** [tint.o] Error 1



If instead of `make CC=/.../coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc` I 
simply call `make`, I get:

../libpayload/install/libpayload/bin/lpgcc -Wall -Os -c -o tint.o tint.c
basename: missing operand
Try `basename --help' for more information.
../libpayload/install/libpayload/bin/lpgcc -Wall -Os -c -o engine.o engine.c
basename: missing operand
Try `basename --help' for more information.
../libpayload/install/libpayload/bin/lpgcc -Wall -Os -c -o io.o io.c
basename: missing operand
Try `basename --help' for more information.
io.c: In function ‘io_init’:
io.c:102: warning: array subscript is above array bounds
io.c:103: warning: array subscript is above array bounds
../libpayload/install/libpayload/bin/lpgcc -Wall -Os -c -o utils.o utils.c
basename: missing operand
Try `basename --help' for more information.
../libpayload/install/libpayload/bin/lpgcc -o tint.elf tint.o engine.o io.o utils.o
basename: missing operand
Try `basename --help' for more information.
../libpayload/install/libpayload/bin/../lib/libpayload.a(timer.o): In function 
`get_cpu_speed':
timer.c:(.text+0x113): undefined reference to `__udivdi3'
../libpayload/install/libpayload/bin/../lib/libpayload.a(timer.o): In function 
`ndelay':
timer.c:(.text+0x1a5): undefined reference to `__udivdi3'
../libpayload/install/libpayload/bin/../lib/libpayload.a(timer.o): In function 
`udelay':
timer.c:(.text+0x202): undefined reference to `__udivdi3'
../libpayload/install/libpayload/bin/../lib/libpayload.a(printf.o): In function 
`print_number':
printf.c:(.text+0x335): undefined reference to `__umoddi3'
printf.c:(.text+0x370): undefined reference to `__udivdi3'
collect2: ld returned 1 exit status
make: *** [tint.elf] Error 1

...which seems to indicate that the compilation has progressed farther but then 
failed for not having 32bit libgcc (as expected as my system compiler is 64bit).

I'm running Gentoo Linux on an x86_64 machine with no 32-bit libraries, and no 
kernel support for 32-bit binaries. System gcc is 4.4.3, system ld is 
2.20.1.20100303.

Any clues to what I'm doing wrong?
Andrew Guertin - 2010-08-23 14:33:23
I figured out the problem right after sending this: when I set $CC, it 
overwrites the makefile variable that tells it to use lpgcc, so lpgcc isn't 
getting used.

I changed all occurrences of "CC" in the tint makefile to "MYCC", and it 
compiled correctly.

Is there a less hackish way I should solve it, and then submit a patch? Or does 
someone who knows what they're doing better want to take care of it?
Marc Jones - 2010-08-23 18:08:28
On Mon, Aug 23, 2010 at 8:33 AM, Andrew Guertin <lists@dolphinling.net> wrote:
> I figured out the problem right after sending this: when I set $CC, it
> overwrites the makefile variable that tells it to use lpgcc, so lpgcc isn't
> getting used.
>
> I changed all occurrences of "CC" in the tint makefile to "MYCC", and it
> compiled correctly.
>
> Is there a less hackish way I should solve it, and then submit a patch? Or
> does someone who knows what they're doing better want to take care of it?

Hi Andrew,

I have some patches for tint to add xcompile and some other build
changes to match what has gone into libpayload. I'll try to post them
later today.

Marc
Marc Jones - 2010-08-24 00:37:29
On Mon, Aug 23, 2010 at 12:08 PM, Marc Jones <marcj303@gmail.com> wrote:
> On Mon, Aug 23, 2010 at 8:33 AM, Andrew Guertin <lists@dolphinling.net> wrote:
>> I figured out the problem right after sending this: when I set $CC, it
>> overwrites the makefile variable that tells it to use lpgcc, so lpgcc isn't
>> getting used.
>>
>> I changed all occurrences of "CC" in the tint makefile to "MYCC", and it
>> compiled correctly.
>>
>> Is there a less hackish way I should solve it, and then submit a patch? Or
>> does someone who knows what they're doing better want to take care of it?
>
> Hi Andrew,
>
> I have some patches for tint to add xcompile and some other build
> changes to match what has gone into libpayload. I'll try to post them
> later today.

This patch is based on Uwe's, but patching a patch seems odd to me, so
here is a new patch that builds on the previous one. Start with a
clean tint0.03b and put it in the coreboot payloads directory. You no
longer need to build libpayload. The make handles it for you.


Add default libpayload build, xcompile, and lpgcc setup to tint.

Signed-off-by: Marc Jones <marc.jones@gmail.com>

Let me know how it goes.

Marc

Patch

--- Makefile.old        2010-08-23 10:11:33.979039352 -0400
+++ Makefile    2010-08-23 10:11:43.808039821 -0400
@@ -28,7 +28,7 @@ 
  #  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-LIBPAYLOAD_DIR := ../libpayload
+LIBPAYLOAD_DIR := ../libpayload/install/libpayload
  CC := $(LIBPAYLOAD_DIR)/bin/lpgcc
  AS := $(LIBPAYLOAD_DIR)/bin/lpas
  # CFLAGS := -Wall -Werror -Os