lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello

	My work host is an x86 Ubuntu, and I'm trying to rewrite the
src/Makefile to cross-compile Lua 5.1.4 for the Blackfin CPU with the
uClinux distro.

I can successfully cross-compile the usual "Hello, world" C test
source, but I get the following error when running "make generic":

==========
/usr/src/lua-5.1.4# make generic

make all MYCFLAGS=
make[1]: Entering directory `/usr/src/lua-5.1.4'

bfin-uclinux-gcc -o lua  lua.o liblua.a -lm

/opt/uClinux/bfin-uclinux/lib/gcc/bfin-uclinux/4.1.1/../../../../bfin-uclinux/bin/ld.real:
lua.o: Relocations in generic ELF (EM: 3)
/opt/uClinux/bfin-uclinux/lib/gcc/bfin-uclinux/4.1.1/../../../../bfin-uclinux/bin/ld.real:
lua.o: Relocations in generic ELF (EM: 3)
lua.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status

make[1]: *** [lua] Error 1
make[1]: Leaving directory `/usr/src/lua-5.1.4'
make: *** [generic] Error 2
==========

FWIW, the toolchain is located under /opt, and I'm trying to compile
everything as FLAT instead of FDPIC ELF.

Here's the beginning of the Makefile:
==========
/usr/src/lua-5.1.4# cat Makefile
TOPDIR:=/
TOOLCHAIN_PATH=$(TOPDIR)/opt/uClinux/bfin-linux-uclibc/bin:$(TOPDIR)/opt/uClinux/bfin-uclinux/bin
export PATH:= $(TOOLCHAIN_PATH):$(PATH)

PLAT= none

CROSS  = bfin-linux-uclibc-
CROSS  = bfin-uclinux-
STRIP  = $(CROSS)strip
CC     = $(CROSS)gcc
AR     = $(CROSS)ar rcu
RANLIB = $(CROSS)ranlib
RM = rm -f

LIBS= -lm $(MYLIBS)
CFLAGS += -Wall -O2 $(MYCFLAGS)
#FLAT
ifeq ($(CROSS),bfin-uclinux-)
        LDFLAGS = -Wl,-elf2flt
#FDPIC ELF
#else
endif

MYCFLAGS=
MYLDFLAGS=
MYLIBS=

PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

LUA_A=  liblua.a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o
lmem.o \
        lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o
ltm.o  \
        lundump.o lvm.o lzio.o
LIB_O=  lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o
ltablib.o \
        lstrlib.o loadlib.o linit.o

LUA_T=  lua
LUA_O=  lua.o

LUAC_T= luac
LUAC_O= luac.o print.o

ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)

default: $(PLAT)

all:    $(ALL_T)

o:      $(ALL_O)

a:      $(ALL_A)

$(LUA_A): $(CORE_O) $(LIB_O)
        $(AR) $@ $?
        $(RANLIB) $@

# ------------ BOOM -----------------------
$(LUA_T): $(LUA_O) $(LUA_A)
        $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)

$(LUAC_T): $(LUAC_O) $(LUA_A)
        $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
==========

As far as I can tell, make can successfully compile liblua.a, but
fails when trying to compile the lua interpreter in the next step.

It's probably something basic, but I'm still no expert with "make" and
cross-compiling, so can't tell if it's a lua thing or something to do
with the cross-compiling.

Thank you for any help.