I am getting vk: command not found
when running vk
, and getting bash: ./vk: No such file or directory
when executing ./vk
.
I did some research and the cause is usually that it isa 32bit exe on a 64bit machine
make builds the output to vk/_target
. I cd
to _target
When I run file vk
I get this back.
vk: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld6, not stripped
I have tried executing chmod +x vk
and chmod u+x vk
. I have tried every combination of typing ./vk
and vk
with chmod
. I'm at a loss here. I have passed -m64
as an option to gcc
, but that seems to be the default.
Here is my makefile
CFLAGS = -m64 -Wall -O3
CC = gcc
LINKER = ld -lc --entry main
DUMP = objdump
COPY = objcopy
TARGET_DIR = _target
SRCS := $(shell find ./ -name \*.c)
VPATH := $(sort $(dir $(SRCS)))
OBJS := $(patsubst %.c,$(TARGET_DIR)/%.o,$(notdir $(SRCS)))
$(TARGET_DIR)/vk : $(OBJS)
$(LINKER) $^ -o $@
$(DUMP) -D $@ > $(@:=.list)
$(TARGET_DIR)/%.o : %.c folders
@echo "compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
@echo "assembly dump $@"
$(DUMP) -D $@ > $@.list
.PHONY: folders
folders:
mkdir -p $(TARGET_DIR)
.PHONY: clean
clean:
rm -rf $(TARGET_DIR)