lua-users home
lua-l archive

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


	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

lua.o: Relocations in generic ELF (EM: 3)
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

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

ifeq ($(CROSS),bfin-uclinux-)
        LDFLAGS = -Wl,-elf2flt


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)

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.