[SOLVED] gcc doesn't compile, no error but gives a directory listing

Issues related to applications and software problems
aegersz
Posts: 73
Joined: 2016/04/04 07:42:58

[SOLVED] gcc doesn't compile, no error but gives a directory listing

Postby aegersz » 2017/11/12 21:25:32

Please, i can't figure this one out on my 32-bit Centos 6.9 system (I have 2 32-bit systems) BUT it works on one system and not the other. This is the output (a directory listing), yet it worked once (?)

Code: Select all

[root@dev sarg-2.3.10]# gcc m32test.c
drwxr-xr-x  3 root root    4096 Nov 13 05:51 ..
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 cfgaux
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 documentation
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 fonts
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 images
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 include
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 po
drwxr-xr-x  2 root wheel   4096 Nov 13 05:51 sorttable
drwxr-xr-x  3 root wheel   4096 Nov 13 05:51 sarg-php
drwxr-xr-x 10 root wheel   4096 Nov 13 08:00 .
Last edited by aegersz on 2017/11/13 14:42:09, edited 1 time in total.

User avatar
avij
Forum Moderator
Posts: 2180
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: gcc doesn't compile, no error but gives a directory listing

Postby avij » 2017/11/12 22:09:32

See which gcc

aegersz
Posts: 73
Joined: 2016/04/04 07:42:58

Re: gcc doesn't compile, no error but gives a directory listing

Postby aegersz » 2017/11/12 23:16:45

I didn't mention it as it's the same across all 3 systems but it is GCC 4.4.7

any ideas as to why it produces an obscure directory listing instead of actual compiling ? that's nuts - no error and i have searched to no avail.

User avatar
TrevorH
Forum Moderator
Posts: 21208
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: gcc doesn't compile, no error but gives a directory listing

Postby TrevorH » 2017/11/13 07:19:56

I'd say you've overwritten the gcc executable with a copy of ls. Run rpm -V gcc and if it reports md5 changes on /usr/bin/gcc then yum reinstall it.

If you build as root, don't.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

aegersz
Posts: 73
Joined: 2016/04/04 07:42:58

Re: gcc doesn't compile, no error but gives a directory listing

Postby aegersz » 2017/11/13 12:41:41

thanks no md5 error but i tried a reinstall, i tried copying the gcc binary from the working system, i tried a new userid to run gcc in, i tried install the Development Tools and in every case, it just produces a directory listing (unless it can't find any .c source).

i can't let it go because i hate not understanding why this is happening.

are there simple tools to trace gcc or even debug it ?

there must be something i can do to figure it out. i looked at SELinux even but it's turned off. I've run out of ideas since the C++ compiler does exactly the same thing ??

User avatar
TrevorH
Forum Moderator
Posts: 21208
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: gcc doesn't compile, no error but gives a directory listing

Postby TrevorH » 2017/11/13 12:53:51

If rpm -V gcc returns no output then you've probably set up either an alias or a shell script called gcc, try avij's suggestion.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

tunk
Posts: 210
Joined: 2017/02/22 15:08:17

Re: gcc doesn't compile, no error but gives a directory listing

Postby tunk » 2017/11/13 12:57:03

Could you also try this:
/usr/bin/gcc m32test.c
gcc --help
alias

aegersz
Posts: 73
Joined: 2016/04/04 07:42:58

Re: gcc doesn't compile, no error but gives a directory listing

Postby aegersz » 2017/11/13 14:41:45

I finally figured it out - I had a "ld" script that listed the directories.

this "ld" function is the dynamic linker/loader that i never knew about but when you think about it, as an old IBM Mainframe Assembler programmer, "linking" (or link edits, as we called them) were a fundamental part of building the core-image program (you call them binaries) or "executable".

everything that you asked me to check looked normal so then i ran my "ld" script (pathed already) to see if the directories listed were all of them and then the penny dropped -- the results were identical !

sorry guys but i had no idea that ld was used internally by gcc so please forgive.

thank you for embracing this somewhat perplexing issue and offering to help ... your clues certainly helped provide me the impetus and ideas to keep searching !