Stupid.Fat.Cat
Stupid.Fat.Cat

Reputation: 11315

Cross compiling source from windows to linux

This is my make file

EXE     = signsrch
CFLAGS  += -s -O2
PREFIX  = /usr/local
BINDIR  = $(PREFIX)/bin
SRC     = $(EXE).c

all:
    $(CC) $(CFLAGS) -c disasm.c
    $(CC) $(CFLAGS) -c asmserv.c
    $(CC) $(SRC) $(CFLAGS) -o $(EXE) *.o

install:
    install -m 755 -d $(BINDIR)
    install -m 755 $(EXE) $(BINDIR)/$(EXE)

.PHONY:
    install

I want to cross compile it for my ubuntu and I tried:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

but I get unknown type name errors with a bunch of âDWORDâ

Help?

Upvotes: 0

Views: 219

Answers (2)

Joe
Joe

Reputation: 7818

We also need to see some code, but....

Windows has its own types for basic things above the vanilla C ones, as does Linux. It sounds like DWORD as a type is not known in Linux (likely). You'll probably have to create a mytypes.h file that redefines Windows standards like DWORD into Linux speak when building for a Linux platform. Linux has types.h that defines things like int32_t which is the equivalent. See this thread for more about this.

I've assumed you have a working cross compiler set up and you're fighting just with the port. If you haven't, that's your first job. You could have a windows based compiler that targets Linux (the cygwin option, mentioned in another post) or go for a Linux based compiler and targetting windows (crosstool will help here). Though since you seem to be targetting arm, I'm expecting that that Ubuntu install isn't the place you wish to build! :-)

Upvotes: 1

iabdalkader
iabdalkader

Reputation: 17332

to cross compile you need a toolchain for the target platform, not just a Makefile. Check this tutorial and also Cygwin

Upvotes: 1

Related Questions