Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 735628 - bootstrap on RHEL6: bison and compiler version
Summary: bootstrap on RHEL6: bison and compiler version
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-02 23:32 UTC by Maoyin Sun
Modified: 2020-12-21 15:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maoyin Sun 2020-08-02 23:32:28 UTC
Hi, 

I am trying to bootstrap Gentoo Prefix on a quite old RHEL machine. When building bison 3.7 it yields:

```
src/parse-simulation.c:64: error: redefinition of typedef 'parse_state'
src/parse-simulation.h:74: note: previous declaration of 'parse_state' was here
```

The complete log: 

* [build.log](https://gist.github.com/simonmysun/a148a0dbf001192fdd147fec948a30a0#file-build-log )
* [stage2.log]( https://gist.github.com/simonmysun/a148a0dbf001192fdd147fec948a30a0#file-stage2-log )
* [environment]( https://gist.github.com/simonmysun/a148a0dbf001192fdd147fec948a30a0#file-environment )

System and hardware information:
```
$ lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.10 (Santiago)
Release:        6.10
Codename:       Santiago
$ uname -a
Linux xxxxx 2.6.32-754.6.3.el6.x86_64 #1 SMP Tue Sep 18 10:29:08 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
```

I have also reported this to bug-bison mail list because I believe this should either fail on `./configure` check or avoid using typedef redefinition to be compatible with old compilers. 

It seems that it is trying to compile with 4.4.7. Can I use a newer version of gcc? Do I have to modify the source code of bison before compiling?

Thank you in advance.
Comment 1 Maoyin Sun 2020-08-03 08:52:14 UTC
Update from bison:

https://lists.gnu.org/r/bug-bison/2020-08/msg00007.html

Except waiting for the patch propagates, is it possible to manually modify the code before compiling? 

btw: gentoo-alt@gentoo.org seems not available and I don't know where to report. It appears in logs and wikis, if abandoned it needs be removed in documentation.
Comment 2 Fabian Groffen gentoo-dev 2020-08-03 08:59:38 UTC
I think it's easier at this point to try using bison-3.6 instead.  As part of stage2 you'll get a new(er) compiler, so later you will be able to compile bison-3.7.

Try appending >=sys-devel/bison-3.7 in /opt/risk/tmp/xz4a0b2/gentoo/var/db/repos/gentoo/profiles/package.mask, e.g. by:

$ echo ">=sys-devel/bison-3.7" >> /opt/risk/tmp/xz4a0b2/gentoo/var/db/repos/gentoo/profiles/package.mask

and just resuming the bootstrap by running the script again -- it should continue where it failed before.
Comment 3 Fabian Groffen gentoo-dev 2020-08-03 09:01:03 UTC
gentoo-alt@lists.gentoo.org should work, how did you determine it's not available?
Comment 4 Maoyin Sun 2020-08-03 20:50:52 UTC
Hi Fabian, 

thank you very much for guiding me through. Now I am stuck on somewhere else (someone shouts `emerge: there are no ebuilds to satisfy "<sys-devel/gcc-4.8".`). If I find it a bug I will report it. 

I checked again and found that the rejected mail was sent to gentoo-alt@gentoo.org which was found on https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap , maybe this link was wrong.
Comment 5 Benda Xu gentoo-dev 2020-08-04 06:38:37 UTC
gcc-4.8 has been tree-cleaned.  It's time to require c++ compiler to be available  from the host.
Comment 6 Fabian Groffen gentoo-dev 2020-08-04 06:47:25 UTC
(In reply to Benda Xu from comment #5)
> gcc-4.8 has been tree-cleaned.  It's time to require c++ compiler to be
> available  from the host.

That sulks.

Guess it means we'd first have to check for c++ compiler to lift any gcc version restriction, and if there isn't a c++ compiler either bootstrap gcc 4.8 manually or abort the process

@Maoyin Sun: you can try to continue by modifying the bootstrap-prefix script.  Find the lines that look like this:

        #elif defined(__GNUC__) && __GNUC__ >= 4
          compiler_stage1+=" <sys-devel/gcc-4.8"
        #else

and change it into:

        #elif defined(__GNUC__) && __GNUC__ >= 4
          compiler_stage1+=" sys-devel/gcc"
        #else

That should pull in gcc-9 or 10 (whichever is in the tree).
Comment 7 Maoyin Sun 2020-08-04 08:10:27 UTC
@Fabian, thanks a lot. I was looking for this in packages. I'm sorry I'm totally new for gentoo. 

Now I have finished stage2 but failed on compiling glibc:


```
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.
 * ERROR: sys-libs/glibc-2.25-r11::gentoo failed (configure phase):
 *   failed to configure glibc
 *
 * Call stack:
 *     ebuild.sh, line  125:  Called src_configure
 *   environment, line 3122:  Called toolchain-glibc_src_configure
 *   environment, line 4599:  Called foreach_abi 'toolchain-glibc_do_src_configure'
 *   environment, line 1288:  Called toolchain-glibc_do_src_configure
 *   environment, line 4293:  Called glibc_do_configure 'nptl'
 *   environment, line 1891:  Called die
 * The specific snippet of code:
 *       "$@" || die "failed to configure glibc";
 * 
```

Can I request the bootstrap script to build a gcc first?
Comment 8 Maoyin Sun 2020-08-04 08:17:53 UTC
I checked the log again and found out that it did not install any newer gcc. So I modified the same place as you mentioned to `compiler_stage1+=" sys-devel/gcc-10.2.0"`. Let's hope that works!
Comment 9 Maoyin Sun 2020-08-04 09:07:29 UTC
In order not to mislead later visitors:

> I checked the log again and found out that it did not install any newer gcc. So I modified the same place as you mentioned to `compiler_stage1+=" sys-devel/gcc-10.2.0"`. Let's hope that works!

This is not a solution! 

The problem is that I coincidentally put a space between. I removed it and deleted `.state2-finished` it starts to install the latest gcc.
Comment 10 Benda Xu gentoo-dev 2020-08-04 10:01:36 UTC
(In reply to Maoyin Sun from comment #8)
> I checked the log again and found out that it did not install any newer gcc.
> So I modified the same place as you mentioned to `compiler_stage1+="
> sys-devel/gcc-10.2.0"`. Let's hope that works!

No need to specify version here, just use sys-devel/gcc.
Comment 11 Maoyin Sun 2020-08-06 12:45:01 UTC
In addition to this RHEL6 thread, I am now stuck on stage 3 facing internal collision of coreutils:

```
 * Messages for package sys-apps/coreutils-8.32-r1:
 * Package 'sys-apps/coreutils-8.32-r1' has internal collisions between
 * non-identical files (located in separate directories in the
 * installation image (${D}) corresponding to merged directories in the
 * target filesystem (${ROOT})):
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/basename
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/basename
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/basename
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/chroot
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/chroot
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/chroot
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/cut
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/cut
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/cut
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/dir
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/dir
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/dir
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/dirname
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/dirname
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/dirname
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/du
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/du
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/du
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/env
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/env
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/env
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/expr
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/expr
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/expr
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/head
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/head
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/head
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/mkfifo
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/mkfifo
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/mkfifo
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/mktemp
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/mktemp
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/mktemp
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/readlink
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/readlink
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/readlink
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/seq
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/seq
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/seq
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/sleep
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/sleep
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/sleep
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/sort
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/sort
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/sort
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tail
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/tail
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tail
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/touch
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/touch
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/touch
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tr
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/tr
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tr
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tty
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/tty
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/tty
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/uname
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/uname
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/uname
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/vdir
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/vdir
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/vdir
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/wc
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/wc
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/wc
 * 			Differences: type, mode
 * 
 * 	/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/yes
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/bin/yes
 * 		/opt/risk/tmp/xz4a0b2/gentoo/tmp/usr/bin/yes
 * 			Differences: type, mode
 * 
 * Package 'sys-apps/coreutils-8.32-r1' NOT merged due to internal
 * collisions between non-identical files. If necessary, refer to your
 * elog messages for the whole content of the above message.











```

However I looked through the log and found that it has been merged once before:

```
>>> sys-apps/coreutils-8.32-r1 merged.
```

I tried other version of coreutils by masking but there was no hope. Is this a new bug or did I operate falsely?


(In reply to Benda Xu from comment #10)

> No need to specify version here, just use sys-devel/gcc.

Yes indeed. I made other mistakes which lead to no gcc installed. I have fixed them and now gcc is successfully compiled and installed.
Comment 12 Maoyin Sun 2020-08-06 22:02:05 UTC
Some updates:

By removing symlink ${EPREFIX}/tmp/bin as mentioned in https://bugs.gentoo.org/728986#c6 the coreutils problem is solved. I don't think it's good, just gave a try. 

Now I'm stuck on:

```
 * Messages for package sys-apps/portage-3.0.1:
 * Unable to find kernel sources at /usr/src/linux
 * Unable to calculate Linux Kernel version for build, attempting to use running version
 * Messages for package app-arch/zstd-1.4.5:
 * ERROR: app-arch/zstd-1.4.5::gentoo failed (compile phase):
 *   emake failed
```

what I have:

```
/usr/src/kernels/2.6.32-696.30.1.el6.rcu_exp_69.x86_64
/usr/src/kernels/2.6.32-754.6.3.el6.x86_64
```

However the workaround I found (https://forums.gentoo.org/viewtopic-t-319776-start-0.html) is not applyable because I don't have the permission. I don't think this follows the princeple of Gentoo Prefix, either.
Comment 13 Fabian Groffen gentoo-dev 2020-08-07 06:44:11 UTC
It feels like portage just installed (despite the warnings), but zstd really has an issue in your case.  Can you find the buildlog for zstd and/or the error it had?
Comment 14 Maoyin Sun 2020-08-07 09:42:07 UTC
Yes zstd failed to build

https://gist.github.com/simonmysun/d53cfd5c6cf4011e4959adb33439ad85

```
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__libc_pread@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__recv@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__pthread_barrier_wait@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__pthread_barrier_init@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__clock_getcpuclockid@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__clock_nanosleep@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__clock_settime@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__shm_directory@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__socket@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__clock_getres@GLIBC_PRIVATE'
/opt/risk/tmp/xz4a0b2/gentoo/usr/bin/ld: /opt/risk/tmp/xz4a0b2/gentoo/lib64/librt.so.1: undefined reference to `__clock_gettime@GLIBC_PRIVATE'

```

The version of this ld is GNU ld (Gentoo 2.34 p6) 2.34.0, the gcc in use should be 10.2.0.
Comment 15 Maoyin Sun 2020-08-10 14:16:15 UTC
I copied the work directory and run make mannually inside. It builds smoothly and successfully. The generated binary also works fine. What could be missing in prefix?
Comment 16 Fabian Groffen gentoo-dev 2020-12-21 15:50:52 UTC
I think this needs a re-try with the current state of things.  Non-RAP could help here, but a lot has changed since this bug.