In terminal, I try to convert assembly code to object code
arm-none-eabi-as -o sample.s sample.o
Assembler messages:
Error: can't open main.o for reading: No such file or directory
And deletes sample.s at that directory I was operating in.
-o defines the output file name you need to do
arm-none-eabi-as -o sample.o sample.s
Related
Here's my makefile:
assemblera: main.o parsingA.o parsingC.o symbolTable.o
gcc -o assemblera main.o parsingA.o parsingC.o symbolTable.o
main.o: main.c parsingA.h parsingC.h symbolTable.h
gcc -c main.c
parsingA.o: parsingA.c parsingA.h
gcc -c parsingA.c
parsingC.o: parsingC.c parsingC.h
gcc -c parsingC.c
symbolTable.o: symbolTable.c symbolTable.h
gcc -c symbolTable.c
clean:
rm *.o assemblera
Now for the problem: with Windows command prompt I can easily generate all the .o files and .exe file, and if I run the latter it works as intended. Now, if I use the cygwin terminal, I can give the instructions to generate the object files / the exe, but those do not appear nowhere in the folder and no error is returned. Also, if I use the make command, it returns this error:
gcc -c main.c
make: *** [Makefile:5: main.o] Error 1
(I did put tabs in front of every "gcc" and "rm"). I know next to nothing about makefiles and cygwin.
After running the ./make.exe command (By using GNUWin32), I get the following error:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
After rerunning the command, I get a different error:
mkdir -p results
A subdirectory or file -p already exists.
Error occurred while processing: -p.
make: *** [results] Error 1
Then I get the same error no matter how many times I repeat the make command:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
As I am a beginner, can you please provide detailed instructions on how I can fix the problem?
These problems:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
are caused by the fact that you have asked Make to execute, on Windows,
a makefile that was written to work on Linux or some other Unix-like operating system.
In Unix-like operating systems, the command:
mkdir -p obj
means: Create a directory called obj with no error if it already exists. In
Windows it means: Create a directory called -p and then a directory called obj.
So when mkdir -p obj has created the directories -p and obj, the command:
mkdir -p backup
fails because:
A subdirectory or file -p already exists.
The Unix/Linux makefile has no intention of creating a directory called -p, but on Windows
that is what it does.
There is little point in your attempting to fix this specific error. It is just the
first of indefinitely many errors that will result from attempting to execute a Unix/Linux
makefile on Windows. You need a makefile that was written to run on
Windows, or to write one yourself, or to find a way of building the software on Windows that does not use Make.
This problem:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
is caused by the fact that you have not installed the GCC C compiler
gcc on your computer, or if you have, the directory where it resides is not in your PATH. So Make cannot find
it to perform the essential business of compiling and linking your software.
Here is a popular Windows port of GCC
Your makefile has been written for Linux and is not directly portable to Windows.
The issue is that ‘mkdir’ is conflicting with CMD’s built-in function that doesn’t support the same command line options (as explained by Mike Kinghan).
A simple workaround is to replace any occurrence of mkdir in your makefile with $(MKDIR) and to add at the very beginning:
MKDIR := “$(shell which mkdir)”
Of course this requires that you install which and CoreUtils (that provides mkdir). Note the double quotes to avoid any issues with white space on the path to mkdir.
Last but not least you will also need gcc which you can get here or there for example.
Deal All,
I'm trying to get a map file with arm-none-eabi-gcc.
I came across one error message what "no such file or directory" when I run the below command.
arm-none-eabi-gcc -g hello.c -o hello -Wl,-Map mapfile.txt
arm-none-eabi-gcc: error: mapfile.txt: No such file or directory
Would you please help me how can I get the map file What am I supposed to do to resolve this problem?
I found my fault from http://thehackerworkshop.com/?p=443 ,
arm-none-eabi-gcc -g hello.c -o hello -Wl,-Map=hello.map
$(USER_DEFINE) -T $(LINKER_SCRIPT) -o $(BOOTLOADER).o -Wl,-Map=$(BOOTLOADER).map
it's work
I need help it is bug or I don't understand how compilation options are working ?
I have sample main.c file and try to compile it as:
$ g++ -nostdlib -g -fno-rtti -fno-exceptions -ffreestanding -nostdinc -nostdinc++ -Wl,--build-id=none,-g,-nostdlib,-nostartfiles,-zmax-page-size=0x1000 main.c -o main
and as output I have this:
$ ls
main.c startfiles
I am trying to understand why g++ created file named "startfiles" not "main" ?
If you read the GNU ld official documentation you will see that there is no option named -nostartfiles. What you do pass for arguments to the linker with that is the options -n and -ostartfiles.
If I were you, I would check those other options you try to pass to the linker as well.
-nostartfiles is a compiler flag as far as I know, not a linker flag.
For the linker, it's the same as -n -o startfiles, which is why you're getting that output file name.
I am having trouble compiling using make in windows 7 with gcc and the gsl library. It occurs only when using make (when I type the compilation commands manually into the cmd line, it compiles correctly). I found some posts where people had similar errors from gcc, but none where it worked when typing normally, but not when using make. The contents of my Makefile are shown below:
#Compiler
COMP=gcc
# Compiler Flags. -Wall turns on all warnings
FLAGS=-Wall
# GSL include file dir
INCLUDES=GnuWin32/include
# GSL Libraries directory
LIB=GnuWin32/lib
# Library Flags
LFLAGS=-lgsl -lgslcblas -lm
# Target Program
EXE=ex2.1.exe
# Dependencies needed for $(PROGRAM)
OBJ=ex2.1.o
# List of source files for objects
SRC=ex2.1.c
# List with types of files to be cleared by clean:
TRASH=*.exe *.o
# I/O files to be cleaned with 'very clean' target
#IOFILES= *.dat *.out *.csv *.mod
all: $(SRC) $(EXE)
$(EXE): $(OBJ)
$(COMP) -L/$(LIB) $(OBJ) $(LFLAGS) -o $(EXE)
$(OBJ): $(SRC)
$(COMP) -I/GnuWin32/include -c ex2.1.c
#$(COMP) -I/$(INCLUDES) -c $(SRC)
clean:
del $(TRASH)
If I type make with only the ex2.1.c present in the directory, I get the following output and error:
gcc -I/GnuWin32/include -c ex2.1.c
gcc: error: CreateProcess : No such file or directory
make: *** [ex2.1.o] Error 1
However, if I first type "gcc -I/GnuWiun32/include -c ex2.1.c", ex2.1.o is created successfully with no error. If then type 'make' I get the following output/error:
gcc -L/GnuWin32/lib ex2.1.o -lgsl -lgslcblas -lm -o ex2.1.exe
gcc: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found
compilation terminated
make: *** [ex2.1.exe] Error 1
But if I manually enter "gcc -L/GnuWin32/lib ex2.1.o -lgsl -lgslcblas -lm -o ex2.1.exe" then the executable compiles and runs like it should, so the problem seems to be with how make is calling gcc? My PATH variable contains the paths to both make.exe as well as gcc.exe, so I am not sure what I do not set up correctly. Does anyone have an idea of what may be wrong? Thanks.