Page 1 of 1

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

Posted: 2017/11/12 21:25:32
by aegersz
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 .

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

Posted: 2017/11/12 22:09:32
by avij
See which gcc

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

Posted: 2017/11/12 23:16:45
by aegersz
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.

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

Posted: 2017/11/13 07:19:56
by TrevorH
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.

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

Posted: 2017/11/13 12:41:41
by aegersz
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 ??

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

Posted: 2017/11/13 12:53:51
by TrevorH
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.

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

Posted: 2017/11/13 12:57:03
by tunk
Could you also try this:
/usr/bin/gcc m32test.c
gcc --help
alias

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

Posted: 2017/11/13 14:41:45
by aegersz
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 !