Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am compiling multiple c source which depend on multiple header files.

Makefile

SHELL=cpp2             
SOAPC=/home/amarayya/doc/../linux-lpc-1.9.0/linux-cortexm-1.9.0/projects/solus_test/app/std2.c
LDFLAGS        := -mcpu=cortex-m3 -mthumb -L $(INSTALL_ROOT)/A2F/root/usr/lib
CFLAGS        := -Os -mcpu=cortex-m3 -mthumb -I$(INSTALL_ROOT)/A2F/root/usr/include
CC=$(CROSS_COMPILE_APPS)gcc
LIBS=
COFLAGS=-O2
CWFLAGS=-Wall
CIFLAGS=
CMFLAGS=

out: calc.o spC.o Client.o std2.o
    $(CC) $(LDFLAGS) $(CFLAGS) $(SHELL) -o out calc.o spC.o Client.o std2.o $(LIBS)

calc.o    : calc.c spH.h 
    $(CC) $(LDFLAGS) $(CFLAGS) -c calc.c spH.h $(LIBS)

spC.o    : spC.c soapH.h stdsoap2.h 
    $(CC) $(LDFLAGS) $(CFLAGS) -c spC.c stdsoap2.h $(LIBS)

Client.o    : Client.c 
    $(CC) $(LDFLAGS) $(CFLAGS) -c Client.c $(LIBS)

std2.o    : std2.c
    $(CC) $(LDFLAGS) $(CFLAGS) -c stdsoap2.c $(LIBS)

OBJS= calc.o spC.o Client.o std2.o

all: $(OBJS)
    $(CC) $(LDFLAGS) $(CFLAGS) $(SHELL) -o $@ $(OBJS) $(LDLIBS)


clean:
    -rm -f $(OBJS) *.gdb *.o

I am getting an the error like this:

Critical error: Cannot open file "arm-uclinuxeabi-gcc -mcpu=cortex-m3 -mthumb -L/home/am./../../linux-lpc-1.9.0/linux-cortexm-1.9.0/A2F/root/usr/include -c calc.c spH.h " for reading

I have tried multiple ways but no result.

How can I fix this error?

Is there any problem with compiling multiple source file with arm-ulinucxeabi-gcc -o -c, including options?

For example:

arm-ulinucxeabi-gcc -c -o a a.c b.c c.c d.c

When I used like this I get the above error. Please guide me to solve this.

share|improve this question
    
I rewrote my answer to reflect something Mat noticed. –  goldilocks Mar 18 '13 at 16:45

1 Answer 1

When you run make with that makefile, the default target is out, and the first prerequisite is calc.o, which the build line for that target is what is in your error.

What appears to be happening is that the entire build line is being executed by the shell as if quoted -- which it isn't, and a normal sh will not do that.

But you perhaps are not using something which qualifies as sh compatible:

SHELL=cpp2

Redefining this (it's already defined in the environment) means cpp2 is being used, and evidently it does not behave properly.

share|improve this answer
    
@Mat: Looking at that makefile, I just cannot see how there is a quoting issue -- there's nothing wrong with it. But I agree it looks like a quoting issue. –  goldilocks Mar 18 '13 at 16:19
    
Sure, but is that relevant in this case? I'm presuming the failed command is just make, because the line in the error is the build line for calc.o, which is the first prereq of the default target "out", so that weird $SHELL variable hasn't been used at that point. –  goldilocks Mar 18 '13 at 16:31
    
AH!! Well that explains that then... –  goldilocks Mar 18 '13 at 16:36
    
Yeah, it's definitely SHELL=cpp2 that's causing the problem. Make runs cpp2 with the arguments -c and arm-uclinuxeabi-gcc -mcpu=cortex-m3 -mthumb -L/home/am./../../linux-lpc-1.9.0/linux-cortexm-1.9.0/A2F/root/usr/include -c calc.c spH.h and cpp2, whatever it is, evidently interprets this last argument as a file name. –  Gilles Mar 18 '13 at 22:07
    
out or calc.o is not the issue even when it is out.o also i'm facing the same error. and recently i found this error is due to use of -c and -o both option together arm-uclinuxaebi-gcc. by using the both option together ill get 3files .gdb and Fatfile and .o file.\ –  amar Mar 20 '13 at 12:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.