Author Topic: GDB "No such file or directory" on NASM file that exists  (Read 1953 times)

Offline paml27

  • Jr. Member
  • *
  • Posts: 33
GDB "No such file or directory" on NASM file that exists
« on: October 25, 2021, 11:14:58 PM »
I created this simple NASM program for Ubuntu 18.04 and compiled it to an exe as shown below.  When I run with gdb I get "No such file or directory" even though the file exists in the current directory

   ; Header Section
   [BITS 64]

   [default rel]

   global _start
   global NLTK_Gutenberg_fn
   extern Lib_Math
     
   section .data align=64
     
   section .rodata align=64
   module_name: db 'nltk',0x00

   ; _________

   section .text

   ; __________
   ; Main Entry
     
   _start:

   push rdi
   push rbp
   push rbx

   lea rdi,[module_name]
   call [rel Lib_Math wrt ..got]

   NLTK_Gutenberg_fn:
   mov rax,0
   mov rbx,0

   pop rbx
   pop rbp
   pop rdi
   ret

Compile and link:

   cd /opt/P01_SH/NLTK_Gutenberg/C_Replica

   sudo nasm -f elf64 -g -F dwarf NLTK_Gutenberg-exec.asm

   sudo ld NLTK_Gutenberg-exec.o /opt/P01_SH/NLTK_Gutenberg/C_Replica/Python_Math.o  -lpython3.8 -ldl -lrt -lpthread -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/ -o NLTK_Gutenberg-exec.exe

   cd /opt/P01_SH/NLTK_Gutenberg/C_Replica
   gdb NLTK_Gutenberg-exec.exe

I usually create shared objects in NASM and I never have any problems, but with this .exe I am getting the "not found" error and I can't see why. 

Thanks. 


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2505
  • Country: us
Re: GDB "No such file or directory" on NASM file that exists
« Reply #1 on: October 26, 2021, 12:07:56 AM »
"   gdb ./NLTK_Gutenberg-exec.exe " ?

Current directory not on your path?

Best,
Frank


Offline paml27

  • Jr. Member
  • *
  • Posts: 33
Re: GDB "No such file or directory" on NASM file that exists
« Reply #2 on: October 30, 2021, 11:13:32 PM »
Hi Frank, and thanks for the reply.  Sorry for the delay.  The problem was the path, and now it's okay.