Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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

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)

    -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

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:


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


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.