You are not logged in.

#1 2010-04-30 04:45:01

Michael C.
Member
From: Vancouver, BC
Registered: 2009-12-16
Posts: 33

[SOLVED] Can't find standard headers

Hello, everyone. I think I broke something fairly badly.

Long story short, I was goofing around with ldconfig and /bin/install, and now, only root can properly compile C programs. The problem is that, on a normal user account (any account, I checked), if you try to compile anything with headers not in /usr/local, it will die. This includes such things as stdio.h and stdlib.h, meaning I can't build any of my projects under my normal account any more.

I checked the output from /bin/env, nothing out of the ordinary there. There are no new dotfiles in my home directory. I tried rebooting, but that didn't fix it. Neither did another several ldconfig invocations.

Exactly what I did prior to the breakage went something like this:

# make install
...
# ldconfig
...
# ldconfig -n /usr/local/lib
...
# exit
$ make
...
test.c:1:19: fatal error: /usr/local/include/stdio.h: Permission denied
...

test.c is nothing out of the ordinary, the line it's complaining about is "#include <stdio.h>". The gcc command line isn't weird either:

/usr/bin/gcc -Wall -Wextra -fPIC -I./include -c -o $@ $<

And the install target just called /bin/install -D ./source/<stuff> /usr/local/<place> and ldconfig.

I've tried looking up the error message on Google, which yielded descriptions of the preprocessor, as well as ldconfig, which only yielded results related to shared object libraries.

Last edited by Michael C. (2010-04-30 22:01:35)

Offline

#2 2010-04-30 09:15:00

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: [SOLVED] Can't find standard headers

Run the compilation command directly from the command line. Same error message?


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

#3 2010-04-30 16:16:39

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: [SOLVED] Can't find standard headers

stdio.h surely shouldn't be in /usr/local/include?
It should be in /usr/include (you can check with 'ls -l /usr/include/stdio.h')
So - something is wrong with your Makefile -or- your compiler doesn't look in the right place?

Offline

#4 2010-04-30 19:52:08

Michael C.
Member
From: Vancouver, BC
Registered: 2009-12-16
Posts: 33

Re: [SOLVED] Can't find standard headers

@grey:

Yeah, I've tried writing a simple program that just #included stdio.h, called puts(), and returned. The most basic gcc command line I could think of, "gcc -o foo foo.c", failed with the same error.

@perbh:

Yeah, I've got nothing in the entire /usr/local hierarchy, gcc is just looking for all the standard headers there. My Makefile was working fine before the breakage, and I haven't changed it, so it must be something with the compiler itself.

Thank you for your responses.

Offline

#5 2010-04-30 20:24:37

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: [SOLVED] Can't find standard headers

Maybe it's not root as root that allows you to compile, but the fact that root is a different user. To test that, create a new user and try to compile.


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

#6 2010-04-30 21:51:39

Michael C.
Member
From: Vancouver, BC
Registered: 2009-12-16
Posts: 33

Re: [SOLVED] Can't find standard headers

I've already tried that, it's a system-wide problem, except for root. Building on a different account yields exactly the same error message.

Offline

#7 2010-04-30 22:01:02

Michael C.
Member
From: Vancouver, BC
Registered: 2009-12-16
Posts: 33

Re: [SOLVED] Can't find standard headers

I figured it out!

Somehow, my /bin/install command changed the permissions on /usr/local/include to 644. I think because gcc couldn't get into that directory, it decided not to try any others, and exited.

Changing /usr/local/include back to 755 fixed the problem.

Thank you both for your replies!

Offline

Board footer

Powered by FluxBB