Discussion:
EXE not found
(too old to reply)
Xavier Maillard
2019-12-01 22:55:06 UTC
Permalink
Heya,

I wrote a fibonacci program in x86_64.

My code uses a call to libc printf function (just to test hwo that works).

I assebled it with nasm and linked it using ld with '-lc' switch.

So far, so good.

I have an executable but, calling it right into the shell, it returns:

no such file or directory.

Just to show:

total 20
-rwxrwxrwx 1 xavier xavier 15216 Dec 1 06:47 fibo
-rw-rw-rw- 1 xavier xavier 2304 Dec 1 06:47 fibo.o
-rw-rw-rw- 1 xavier xavier 353 Nov 29 13:11 fibo.s
-rw-rw-rw- 1 xavier xavier 513 Dec 1 06:44 Makefile

when calling it, I am in ~/devel/asm/fibo directory and I am calling it with:
::> ./fibo
zsh:1: no such file or directory: ./fibo

Is there something wrong here (again) ? :)
--
- xma

GPG: BA4909B7 8F04DE1B
David W Noon
2019-12-02 00:00:11 UTC
Permalink
On Sun, 1 Dec 2019 23:55:06 +0100, Xavier Maillard
<***@nospicedham.maillard.im> wrote about EXE not found:

[snip]
Post by Xavier Maillard
when calling it, I am in ~/devel/asm/fibo directory and I am
./fibo
Is there something wrong here (again) ? :)
Is the filesystem on which your directory is located mounted with the
"exec" option?
- --
Regards,

Dave [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
***@spamtrap.ntlworld.com (David W Noon)
Remove spam trap to reply by e-mail.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Xavier Maillard
2019-12-02 22:24:37 UTC
Permalink
Post by David W Noon
On Sun, 1 Dec 2019 23:55:06 +0100, Xavier Maillard
[snip]
Post by Xavier Maillard
when calling it, I am in ~/devel/asm/fibo directory and I am
./fibo
Is there something wrong here (again) ? :)
Is the filesystem on which your directory is located mounted with the
"exec" option?
Affirmative and I made a simple test with exe with no problem.

Regards
--
- xma

GPG: BA4909B7 8F04DE1B
Rod Pemberton
2019-12-04 13:28:05 UTC
Permalink
On Sun, 1 Dec 2019 23:55:06 +0100
Post by David W Noon
[snip]
<technically, off-topic>
Post by David W Noon
total 20
-rwxrwxrwx 1 xavier xavier 15216 Dec 1 06:47 fibo
-rw-rw-rw- 1 xavier xavier 2304 Dec 1 06:47 fibo.o
-rw-rw-rw- 1 xavier xavier 353 Nov 29 13:11 fibo.s
-rw-rw-rw- 1 xavier xavier 513 Dec 1 06:44 Makefile
The file privileges look fine, except they're usually 755 for
an executable and 644 for a non-executable.

-rwxr-xr-x <-- 755
-rw-r--r-- <-- 644
Post by David W Noon
when calling it, I am in ~/devel/asm/fibo directory and I am calling
it with: ::> ./fibo
zsh:1: no such file or directory: ./fibo
Is there something wrong here (again) ? :)
Do other Linux utilities see the file? e.g., ls, vi, emacs, file, etc.

Maybe, you only have read privileges but no execute on the _directory_?
i.e., 644 instead of 755. (man chmod)

Who is the owner on the fibo directory? i.e., maybe xavier isn't
the directory owner. (man chown, or man su)

Do you need to be logged in as root on your system to execute files?
(man su)

Also have you tried just executing fibo without the ./ in front of
fibo? e.g., perhaps you already have a . on your directory path.

Does renaming the file allow it to execute? (man mv) i.e., maybe
selecting the directory to exec instead of the file somehow or etc ...

Finally, what happens with a different shell (bash)? e.g., zsh bug.


Rod Pemberton
--
"It's OK to be White." <-- investigated by FBI as a hate crime
"Black Lives Matter." <-- not being investigated ...
Xavier Maillard
2019-12-04 15:23:50 UTC
Permalink
Post by David W Noon
On Sun, 1 Dec 2019 23:55:06 +0100
Post by David W Noon
[snip]
<technically, off-topic>
Post by David W Noon
total 20
-rwxrwxrwx 1 xavier xavier 15216 Dec 1 06:47 fibo
-rw-rw-rw- 1 xavier xavier 2304 Dec 1 06:47 fibo.o
-rw-rw-rw- 1 xavier xavier 353 Nov 29 13:11 fibo.s
-rw-rw-rw- 1 xavier xavier 513 Dec 1 06:44 Makefile
The file privileges look fine, except they're usually 755 for
an executable and 644 for a non-executable.
Yuo. Dunno why it is different on this system. This is a secondary
subject but I'll have to sort out at some point.
Post by David W Noon
Do other Linux utilities see the file? e.g., ls, vi, emacs, file, etc.
Indeed, yes.

I could hexdump, readelf, ldd or even gdb it with no problem.

I tested all I could and it turned out to be something wrong with LD.

Linking my executable was done via a call to ld.

Got a good lecture on the Internet and I finally fiexed my problem by
linking it with gcc -no-pie.

Not sure why I would have needed this but, hey, that worked. I will read
about this PIE later.
--
- xma

GPG: BA4909B7 8F04DE1B
Loading...