Bug 235964 - lang/gcc6: build using base GCC on powerpc64
Summary: lang/gcc6: build using base GCC on powerpc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-23 16:44 UTC by Piotr Kubaj
Modified: 2019-03-12 15:57 UTC (History)
2 users (show)

See Also:


Attachments
patch (810 bytes, patch)
2019-02-23 16:44 UTC, Piotr Kubaj
no flags Details | Diff
patch (1.50 KB, patch)
2019-02-28 12:13 UTC, Piotr Kubaj
no flags Details | Diff
Proposed simpification (700 bytes, patch)
2019-03-01 12:59 UTC, Gerald Pfeifer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2019-02-23 16:44:47 UTC
Created attachment 202292 [details]
patch

GCC 6 can be compiled using base GCC just fine:
https://talos.anongoth.pl/data/powerpc64-default/2019-02-23_12h33m09s/logs/gcc6-6.5.0_3.log

Switch to base GCC, instead of using GCC 5, since GCC 5 is not needed here.

When building with base GCC, it's also necessary to remove ${STAGEDIR}${PREFIX}/lib/lib32 (it's not PLIST anyway).

The next step will be to switch newer GCC to build using GCC 6 instead of GCC 5.

Tested on powerpc64 and amd64.

Hardware sponsored by IntegriCloud.
Comment 1 Gerald Pfeifer freebsd_committer freebsd_triage 2019-02-23 20:58:40 UTC
Thanks for the report and patch, Piotr.

I'd be more than happy to remove the dependency on GCC 5.  Andreas T. added
this when he was doing the original porting work, so let's make sure to give
him a chance to chime in, though.

As for the other change, mind having a look at how lang/gcc7 and lang/gcc8
handle this, including 

.if ${ARCH} == powerpc64 && ${PORT_OPTIONS:MMULTILIB}
        ${MKDIR} ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX}
        ${MV} ${STAGEDIR}${PREFIX}/lib/lib32/* ${STAGEDIR}${TARGLIB32}/gcc${SUF
FIX}
.endif

which Andreas added end of December to those newer port (but not lang/gcc6).

Might that be the "righter" fix for this, and provide more consistency?

In any case, would you agree to focus on lang/gcc8(-devel) and 
lang/gcc7(-devel) primarily, which are still actively maintained?
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2019-02-23 22:35:48 UTC
(In reply to Gerald Pfeifer from comment #1)
Yes, the fix you proposed is probably better.

I agree it's better to focus on the currently maintained GCC versions than EOL. But currently in order to install GCC 8 on powerpc64 we need to install anyway GCC 5, which is even more EOL. I think it's better to at least upgrade from GCC 5 to 6.
Comment 3 Andreas Tobler freebsd_committer freebsd_triage 2019-02-25 22:13:44 UTC
Feel free to change what fits you best.
At the time doing the port, it was not possible for me to bootstrap a gcc5/6/7 with base gcc. Maybe it is now possible.

And I'm not sponsored.
Comment 4 Gerald Pfeifer freebsd_committer freebsd_triage 2019-02-26 21:01:35 UTC
Piotr, I understand you can confirm that lang/gcc6 (and lang/gcc6-devel)
build as is with the system compiler, so we can indeed simply remove
USE_GCC=5? 

Just asking to make sure since I cannot reproduce myself and am now
wondering why GCC 6 would build, but GCC 7 still would require GCC 6
instead of the system compiler (per the other patch)?


The other question I have is on the multi-libs.  Do I understand correctly
you agree the approach Andreas has contributed for newer ports should work
here too and be preferrable?  If you, would you be able to share a tested
patch with those changes?  Just to make 100% sure we are aligned and it's
been fully tested?  (I can also give it a try and create a strawman, but
that might be slower.)
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2019-02-28 12:13:53 UTC
Created attachment 202438 [details]
patch

I propose to commit this patch.

The additional RMDIR is necessary, because there's the left out empty directory.
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-03-01 01:12:00 UTC
A commit references this bug:

Author: gerald
Date: Fri Mar  1 01:11:01 UTC 2019
New revision: 494220
URL: https://svnweb.freebsd.org/changeset/ports/494220

Log:
  Backport r488673 | andreast | 2018-12-29 from lang/gcc7:

    Fix build of GCC on powerpc64.

    While building GCC itself we have to use the built GCC libraries to
    configure additional parts of GCC and not the libraires from the host.

    Install the built 32-bit libraries. This was not done up to now.

  And no longer required GCC 5 to build on powerpc64, making this port a
  natural choice of a "base" for newer members of the lang/gcc* family.

  PR:		235964, 231804
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl>

Changes:
  head/lang/gcc6/Makefile
Comment 7 Gerald Pfeifer freebsd_committer freebsd_triage 2019-03-01 01:16:25 UTC
(In reply to Piotr Kubaj from comment #5)
> I propose to commit this patch.

Done!  Thanks for your collaboration and patience working on this, Piotr!

(There was a minor tweak I made, a tab instead of a space before the comment
for TARGLIB32; that showed up when comparing with lang/gcc7.)

> The additional RMDIR is necessary, because there's the left out empty
> directory.

So, two questions: Why hasn't this shown up for lang/gcc7 which has the
very same code by Andreas?  Or do you see it there as well?

And looking at

   ${MKDIR} ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX}
   ${MV} ${STAGEDIR}${PREFIX}/lib/lib32/* ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX}
   ${RMDIR} ${STAGEDIR}${PREFIX}/lib/lib32

isn't that just a bit long for

   ${MV} ${STAGEDIR}${PREFIX}/lib/lib32 ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX}
   
?  Or am I missing something after my long haul flight this night? :-o

(If you could test that change, that would be great!)
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2019-03-01 05:20:35 UTC
(In reply to Gerald Pfeifer from comment #7)
I'm currently testing building gcc7 with base gcc (it looks like -O2 is the reason why base gcc segfaults). The same problem has appeared there, so it looks like it's somehow connected to building with base gcc. I still need to test more, though.

I didn't test it, but ${MV} ${STAGEDIR}${PREFIX}/lib/lib32 ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX} should move the whole lib32 directory, not its contents.
Comment 9 Gerald Pfeifer freebsd_committer freebsd_triage 2019-03-01 12:59:44 UTC
Created attachment 202478 [details]
Proposed simpification

(In reply to Piotr Kubaj from comment #8)
> I didn't test it, but ${MV} ${STAGEDIR}${PREFIX}/lib/lib32
> ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX} should move the whole lib32
> directory, not its contents.

Which is really what's going on here, isn't it?

  % mkdir -p from two
  % touch from/{a,b,c}
  % mv from two/three
  % ll two/three/
  -rw-r--r-- 1 gp users 0 Mär  1 20:50 a
  -rw-r--r-- 1 gp users 0 Mär  1 20:50 b
  -rw-r--r-- 1 gp users 0 Mär  1 20:50 c

Looking into this more, we probably do need to ensure the higher level
directory is present for sure.

Let me propose a concrete patch so that we are on the same page.
Comment 10 Piotr Kubaj freebsd_committer freebsd_triage 2019-03-01 13:55:50 UTC
(In reply to Gerald Pfeifer from comment #9)
You're right, I didn't take into account that gcc${SUFFIX} doesn't exist.

This fix should also be committed to newer GCC versions.
Comment 11 Gerald Pfeifer freebsd_committer freebsd_triage 2019-03-02 06:43:24 UTC
Absolutely, I will do so for all affected ports!

Can you please confirm you successfully tested on powerpc64 with my
proposed patch applied?
Comment 12 commit-hook freebsd_committer freebsd_triage 2019-03-02 18:05:13 UTC
A commit references this bug:

Author: gerald
Date: Sat Mar  2 18:05:04 UTC 2019
New revision: 494448
URL: https://svnweb.freebsd.org/changeset/ports/494448

Log:
  Update to the 20190228 snapshot of GCC 7.4.1.

  Simplify the creation of the multilib-related tree on powerpc64 and
  avoid leaving an empty directory behind on the way. [1]

  PR:		235964, 231804 [1]
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl> [1]

Changes:
  head/lang/gcc7-devel/Makefile
  head/lang/gcc7-devel/distinfo
Comment 14 commit-hook freebsd_committer freebsd_triage 2019-03-04 03:04:28 UTC
A commit references this bug:

Author: gerald
Date: Mon Mar  4 03:01:59 UTC 2019
New revision: 494541
URL: https://svnweb.freebsd.org/changeset/ports/494541

Log:
  Update to the 20180301 snapshot of GCC 8.3.1.

  Simplify the creation of the multilib-related sub-directory tree on
  powerpc64 and avoid leaving an empty directory behind on the way. [1]

  Sync pkg-descr with lang/gcc7-devel, in particular after r442530 there.

  PR:		235964, 231804 [1]
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl> [1]

Changes:
  head/lang/gcc8-devel/Makefile
  head/lang/gcc8-devel/distinfo
Comment 15 Gerald Pfeifer freebsd_committer freebsd_triage 2019-03-04 04:58:48 UTC
(In reply to Piotr Kubaj from comment #13)
> Sure.
> It built:

Great, thank you, Piotr!

As you've seen, I started to apply this last simplification/fix to
lang/gcc7-devel and lang/gcc8-devel and I'll address lang/gcc9-devel
and then others over the next days.  The other changes we discussed
are then covered by PR 235975, so closing this one for now.
Comment 16 commit-hook freebsd_committer freebsd_triage 2019-03-06 11:22:17 UTC
A commit references this bug:

Author: gerald
Date: Wed Mar  6 11:21:15 UTC 2019
New revision: 494789
URL: https://svnweb.freebsd.org/changeset/ports/494789

Log:
  Update to the 20180303 snapshot of GCC 9.0.1.

  Simplify the creation of the multilib-related sub-directory tree on
  powerpc64 and avoid leaving an empty directory behind on the way. [1]

  Sync pkg-descr with lang/gcc7-devel, in particular after r442530 there.

  PR:		235964, 231804 [1]
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl> [1]

Changes:
  head/lang/gcc9-devel/Makefile
  head/lang/gcc9-devel/distinfo
  head/lang/gcc9-devel/pkg-descr
Comment 17 commit-hook freebsd_committer freebsd_triage 2019-03-07 09:56:22 UTC
A commit references this bug:

Author: gerald
Date: Thu Mar  7 09:55:53 UTC 2019
New revision: 494921
URL: https://svnweb.freebsd.org/changeset/ports/494921

Log:
  No longer require a not too old version of GCC to build on powerpc64, but
  rely on the system compiler (even if that means we need to be explicitly
  conservative when it comes to optimizations). [1]

  Simplify the creation of the multilib-related sub-directory tree on
  powerpc64 and avoid leaving an empty directory behind on the way. [2]

  Sync pkg-descr with lang/gcc7-devel, in particular after r442530 there.

  PR:		235975 [1], 235964 [2], 231804 [2]
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl> [1]
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl> [2]

Changes:
  head/lang/gcc8/Makefile
  head/lang/gcc8/pkg-descr
Comment 18 commit-hook freebsd_committer freebsd_triage 2019-03-10 05:23:00 UTC
A commit references this bug:

Author: gerald
Date: Sun Mar 10 05:22:49 UTC 2019
New revision: 495227
URL: https://svnweb.freebsd.org/changeset/ports/495227

Log:
  No longer require a not too old version of GCC to build on powerpc64, but
  rely on the system compiler (even if that means we need to be explicitly
  conservative when it comes to optimizations). [1]

  Simplify the creation of the multilib-related sub-directory tree on
  powerpc64 and avoid leaving an empty directory behind on the way. [2]

  PR:		235975 [1], 235964 [2], 231804 [2]
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl> [1]
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl> [2]

Changes:
  head/lang/gcc7/Makefile
Comment 19 commit-hook freebsd_committer freebsd_triage 2019-03-12 15:57:02 UTC
A commit references this bug:

Author: gerald
Date: Tue Mar 12 15:56:13 UTC 2019
New revision: 495463
URL: https://svnweb.freebsd.org/changeset/ports/495463

Log:
  Simplify the creation of the multilib-related sub-directory tree on
  powerpc64 and avoid leaving an empty directory behind on the way.

  PR:		235964, 231804
  Discussed with:	Piotr Kubaj <pkubaj@anongoth.pl>

Changes:
  head/lang/gcc6/Makefile