public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Please help with `C compiler cannot create executables'
@ 2018-07-30 17:36 Akater
  2018-07-30 17:56 ` Hung Dang
  2018-07-30 18:13 ` [gentoo-user] " Martin Vaeth
  0 siblings, 2 replies; 5+ messages in thread
From: Akater @ 2018-07-30 17:36 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2895 bytes --]

This came unexpectedly. An excerpt from compile.log is posted
below. (I'll post more if necessary of course.) I'm not very experienced
with C compilers in general and gcc in particular so I hope for some
directions on what the cause of the issue might be. I tried removing
CFLAGS settings from make.conf, to no effect.
(CFLAGS is `-march=native -O2 -pipe')

I upgraded GCC recently; world, kernel rebuilt successfully and gcc had
been working just fine for some time since then.

I did not do anything particularly weird with the system that could
cause this. However,
(1) I do use a somewhat old profile:
hardened/linux/amd64 (stable).
(2) I recently had a build conflict with
util-linux and rfkill: the latter had been included in the former but I
was not aware of that at the time and updated some packages (don't
remember which ones) while masking the corresponding util-linux version
and newer versions. Still, it was a normal portage update and no
warnings were issued.
(3) The kernel sources used are non-standard.

A relevant bit from compile.log (the package is sys-apps/file):

> gcc version 7.3.0 (Gentoo Hardened 7.3.0-r3 p1.4) 
> configure:3711: $? = 0
> configure:3700: x86_64-pc-linux-gnu-gcc -V >&5
> x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-V'
> x86_64-pc-linux-gnu-gcc: fatal error: no input files
> compilation terminated.
> configure:3711: $? = 1
> configure:3700: x86_64-pc-linux-gnu-gcc -qversion >&5
> x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
> x86_64-pc-linux-gnu-gcc: fatal error: no input files
> compilation terminated.
> configure:3711: $? = 1
> configure:3731: checking whether the C compiler works
> configure:3753: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe  -Wl,-O1 -Wl,--as-needed conftest.c  >&5
> cc1: fatal error: /usr/local/include/stdc-predef.h: Permission denied
> compilation terminated.
> configure:3757: $? = 1
> configure:3795: result: no
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "file"
> | #define PACKAGE_TARNAME "file"
> | #define PACKAGE_VERSION "5.33"
> | #define PACKAGE_STRING "file 5.33"
> | #define PACKAGE_BUGREPORT "christos@astron.com"
> | #define PACKAGE_URL ""
> | #define PACKAGE "file"
> | #define VERSION "5.33"
> | #define BUILTIN_ELF 1
> | #define ELFCORE 1
> | /* end confdefs.h.  */
> | 
> | int
> | main ()
> | {
> | 
> |   ;
> |   return 0;
> | }
> configure:3800: error: in `/var/tmp/portage/sys-apps/file-5.33-r4/work/file-5.33-abi_x86_64.amd64':
> configure:3802: error: C compiler cannot create executables

Note:

> ~ $ sudo ls -la /usr/local/include
> total 12
> drwxr-x--- 3 root root 4096 Jul 24 02:12 .
> drwxr-xr-x 8 root root 4096 Jul 24 02:12 ..
> drwxr-x--- 2 root root 4096 Jul 24 02:12 ykpers-1

Thank you.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Please help with `C compiler cannot create executables'
  2018-07-30 17:36 [gentoo-user] Please help with `C compiler cannot create executables' Akater
@ 2018-07-30 17:56 ` Hung Dang
  2018-07-30 18:13 ` [gentoo-user] " Martin Vaeth
  1 sibling, 0 replies; 5+ messages in thread
From: Hung Dang @ 2018-07-30 17:56 UTC (permalink / raw
  To: Gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3197 bytes --]

There are typos/errors in the configure script. From your error log I can
see that -V and -qversion are passed into gcc instead of -v and  --version.

Hung

On Mon, Jul 30, 2018 at 1:40 PM Akater <nuclearspace@gmail.com> wrote:

> This came unexpectedly. An excerpt from compile.log is posted
> below. (I'll post more if necessary of course.) I'm not very experienced
> with C compilers in general and gcc in particular so I hope for some
> directions on what the cause of the issue might be. I tried removing
> CFLAGS settings from make.conf, to no effect.
> (CFLAGS is `-march=native -O2 -pipe')
>
> I upgraded GCC recently; world, kernel rebuilt successfully and gcc had
> been working just fine for some time since then.
>
> I did not do anything particularly weird with the system that could
> cause this. However,
> (1) I do use a somewhat old profile:
> hardened/linux/amd64 (stable).
> (2) I recently had a build conflict with
> util-linux and rfkill: the latter had been included in the former but I
> was not aware of that at the time and updated some packages (don't
> remember which ones) while masking the corresponding util-linux version
> and newer versions. Still, it was a normal portage update and no
> warnings were issued.
> (3) The kernel sources used are non-standard.
>
> A relevant bit from compile.log (the package is sys-apps/file):
>
> > gcc version 7.3.0 (Gentoo Hardened 7.3.0-r3 p1.4)
> > configure:3711: $? = 0
> > configure:3700: x86_64-pc-linux-gnu-gcc -V >&5
> > x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-V'
> > x86_64-pc-linux-gnu-gcc: fatal error: no input files
> > compilation terminated.
> > configure:3711: $? = 1
> > configure:3700: x86_64-pc-linux-gnu-gcc -qversion >&5
> > x86_64-pc-linux-gnu-gcc: error: unrecognized command line option
> '-qversion'; did you mean '--version'?
> > x86_64-pc-linux-gnu-gcc: fatal error: no input files
> > compilation terminated.
> > configure:3711: $? = 1
> > configure:3731: checking whether the C compiler works
> > configure:3753: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe  -Wl,-O1
> -Wl,--as-needed conftest.c  >&5
> > cc1: fatal error: /usr/local/include/stdc-predef.h: Permission denied
> > compilation terminated.
> > configure:3757: $? = 1
> > configure:3795: result: no
> > configure: failed program was:
> > | /* confdefs.h */
> > | #define PACKAGE_NAME "file"
> > | #define PACKAGE_TARNAME "file"
> > | #define PACKAGE_VERSION "5.33"
> > | #define PACKAGE_STRING "file 5.33"
> > | #define PACKAGE_BUGREPORT "christos@astron.com"
> > | #define PACKAGE_URL ""
> > | #define PACKAGE "file"
> > | #define VERSION "5.33"
> > | #define BUILTIN_ELF 1
> > | #define ELFCORE 1
> > | /* end confdefs.h.  */
> > |
> > | int
> > | main ()
> > | {
> > |
> > |   ;
> > |   return 0;
> > | }
> > configure:3800: error: in
> `/var/tmp/portage/sys-apps/file-5.33-r4/work/file-5.33-abi_x86_64.amd64':
> > configure:3802: error: C compiler cannot create executables
>
> Note:
>
> > ~ $ sudo ls -la /usr/local/include
> > total 12
> > drwxr-x--- 3 root root 4096 Jul 24 02:12 .
> > drwxr-xr-x 8 root root 4096 Jul 24 02:12 ..
> > drwxr-x--- 2 root root 4096 Jul 24 02:12 ykpers-1
>
> Thank you.
>

[-- Attachment #2: Type: text/html, Size: 4086 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: Please help with `C compiler cannot create executables'
  2018-07-30 17:36 [gentoo-user] Please help with `C compiler cannot create executables' Akater
  2018-07-30 17:56 ` Hung Dang
@ 2018-07-30 18:13 ` Martin Vaeth
  2018-07-30 18:18   ` Shea Alterio
  2018-07-30 20:45   ` [gentoo-user] [SOLVED] " Akater
  1 sibling, 2 replies; 5+ messages in thread
From: Martin Vaeth @ 2018-07-30 18:13 UTC (permalink / raw
  To: gentoo-user

Akater <nuclearspace@gmail.com> wrote:
>
>> configure:3753: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe
>> -Wl,-O1 -Wl,--as-needed conftest.c  >&5

This should succeed. So the problem is probably this:

>> cc1: fatal error: /usr/local/include/stdc-predef.h: Permission denied

It seems that you have this file but that it is not readable
by user/group portage:portage.

The main question is: Why do you have something in /usr/local/ at all?
If you did not install anything outside of portage, this directory
should be empty (up to some perhaps empty directories).

So "normally" the correct solution would be to clean up /usr/local/.
Of course, if you intentionally installed something there, this
might be wrong. But your problem is very likely caused by this.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Re: Please help with `C compiler cannot create executables'
  2018-07-30 18:13 ` [gentoo-user] " Martin Vaeth
@ 2018-07-30 18:18   ` Shea Alterio
  2018-07-30 20:45   ` [gentoo-user] [SOLVED] " Akater
  1 sibling, 0 replies; 5+ messages in thread
From: Shea Alterio @ 2018-07-30 18:18 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

You did do

sudo chown -R $(whoami) /usr/local
?

On Mon, Jul 30, 2018 at 2:13 PM, Martin Vaeth <martin@mvath.de> wrote:

> Akater <nuclearspace@gmail.com> wrote:
> >
> >> configure:3753: x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe
> >> -Wl,-O1 -Wl,--as-needed conftest.c  >&5
>
> This should succeed. So the problem is probably this:
>
> >> cc1: fatal error: /usr/local/include/stdc-predef.h: Permission denied
>
> It seems that you have this file but that it is not readable
> by user/group portage:portage.
>
> The main question is: Why do you have something in /usr/local/ at all?
> If you did not install anything outside of portage, this directory
> should be empty (up to some perhaps empty directories).
>
> So "normally" the correct solution would be to clean up /usr/local/.
> Of course, if you intentionally installed something there, this
> might be wrong. But your problem is very likely caused by this.
>
>
>

[-- Attachment #2: Type: text/html, Size: 1730 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] [SOLVED] Please help with `C compiler cannot create executables'
  2018-07-30 18:13 ` [gentoo-user] " Martin Vaeth
  2018-07-30 18:18   ` Shea Alterio
@ 2018-07-30 20:45   ` Akater
  1 sibling, 0 replies; 5+ messages in thread
From: Akater @ 2018-07-30 20:45 UTC (permalink / raw
  To: Martin Vaeth, gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]

Martin Vaeth <martin@mvath.de> writes:

> So "normally" the correct solution would be to clean up /usr/local/.
> Of course, if you intentionally installed something there, this
> might be wrong. But your problem is very likely caused by this.
This was indeed the cause, thank you.

Further comments made for the
reference, in case someone has the same issue.

>>> cc1: fatal error: /usr/local/include/stdc-predef.h: Permission denied
>
> It seems that you have this file but that it is not readable
> by user/group portage:portage.
There is no such file. I posted the relevant ls output in the original
message.

> The main question is: Why do you have something in /usr/local/ at all?
> If you did not install anything outside of portage, this directory
> should be empty (up to some perhaps empty directories).
Indeed, I did install something outside of portage. Found no appropriate
ebuilds (ebuild repositories included); instead of writing my own,
just followed the procedure as described upstream. This was likely a bad idea.

Gentoo keeps /usr/local in the list of paths for gcc. If /usr/local is
missing something crucial, gcc becomes broken, I guess. In my case, I
removed directories and symlinks
/usr/local/include
/usr/local/lib
/usr/local/lib64
/usr/local/share
that were all created at the time of outside-portage installation. GCC
works fine now.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-30 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30 17:36 [gentoo-user] Please help with `C compiler cannot create executables' Akater
2018-07-30 17:56 ` Hung Dang
2018-07-30 18:13 ` [gentoo-user] " Martin Vaeth
2018-07-30 18:18   ` Shea Alterio
2018-07-30 20:45   ` [gentoo-user] [SOLVED] " Akater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox