简体   繁体   中英

how to run this assembly code on nasm?

I have a game source code but I could not assemble it on nasm , I could not understand where is the problem .

here is the makefile :

# Makefile for the nibbles game.

all: nibbles_asm nibbles_asm_start

# Rule for compiling C source
.c.o:
    gcc -Os -march=i686 -Wall -g -c $<

# Rule for compiling assembly source
.S.o:
    as -gstabs $^ -o $@



# ASM game
nibbles_asm: main.o nibbles.o helpers.o
    gcc -lcurses $^ -o -V $@

# ASM game
nibbles_asm_start: start.o nibbles.o helpers.o workaround.o
    gcc -lcurses -lc -nostdlib $^ -o $@

clean:
    rm -f *~
    rm -f *.o
    rm -f nibbles nibbles_asm

and here is the error :

as   -o nibbles.o nibbles.s
gcc -lcurses main.o nibbles.o helpers.o -o -V nibbles_asm
gcc: nibbles_asm: No such file or directory
make: *** [nibbles_asm] Error 1

it seems that as -gstabs $^ -o $@ do not build the nibbles_asm file ! I also typed the command by myself in terminal but it gave me alot of errors . my friend run this code on his computer , so the code does not have any problem .

There is no dependency to get from nibbles.S to nibbles.o . Also, helpers.o and workaround.o don't have associated source file relations. Add those relationship and it should work.

You have a stray -V at the wrong place (as argument to -o ) in your gcc command. Remove it or put it at the beginning.

Your second error trying to exec 'i686-linux-gnu-gcc--lcurses': No such file means that you are missing a space between gcc and -lcurses somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM