public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
@ 2024-03-13  6:37 Дилян Палаузов
  2024-03-13  9:13 ` Jakub Jelinek
  0 siblings, 1 reply; 10+ messages in thread
From: Дилян Палаузов @ 2024-03-13  6:37 UTC (permalink / raw)
  To: gcc-patches

Non-parallel build can fail, depending on the ./configure parameters - 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106472 .

The change below does fix the problem.

I do not understand the build system to say, that this is the best 
approach, so if there are questions I might or might not be able to 
answer them.

I tried different things, this worked on the releases/gcc-13 branch.  On 
the master branch last weekend the problem was that stage2 and stage3 
results are not equal, so I have not verified this change there.  
depend= in Makefile.def seem to have only effect if bootstrapping is 
involved and gcc/go/config-lang.in does not have boot_language=yes .  
The lines below are present in the Makefile.in:@unless gcc-bootstrap 
snippet.  Actually I think ./configure --enable-languages=all and then 
serial build work, because this implied D and it does imply 
bootstrapping for libbacktrace and libatomic.  I also do not want to 
invest much more time on this.

I do not know, if 2×`maybe-`  is necessary.


diff --git a/Makefile.in b/Makefile.in
index 06a9398e172..236e5cda942 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66481,6 +66481,7 @@ configure-target-libgfortran: 
maybe-all-target-libquadmath


  @if gcc-bootstrap
+all-target-libgo: maybe-all-target-libbacktrace 
maybe-all-target-libatomic
  configure-gnattools: stage_last
  configure-libcc1: stage_last
  configure-c++tools: stage_last
diff --git a/Makefile.tpl b/Makefile.tpl
index dfbd74b68f8..98160c7626b 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -1952,7 +1952,7 @@ configure-target-[+module+]: maybe-all-gcc[+
     (define dep-maybe (lambda ()
        (if (exist? "hard") "" "maybe-")))

-   ;; dep-kind returns returns "prebootstrap" for configure or build
+   ;; dep-kind returns "prebootstrap" for configure or build
     ;; dependencies of bootstrapped modules on a build module
     ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
     ;; on an "install" target, or if the dependence module is not
@@ -2017,6 +2017,7 @@ configure-target-[+module+]: maybe-all-gcc[+
  [+ ESAC +][+ ENDFOR dependencies +]

  @if gcc-bootstrap
+all-target-libgo: maybe-all-target-libbacktrace 
maybe-all-target-libatomic
  [+ FOR dependencies +][+ CASE (dep-kind) +]
  [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
  ENDFOR dependencies +]@endif gcc-bootstrap



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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-13  6:37 No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472] Дилян Палаузов
@ 2024-03-13  9:13 ` Jakub Jelinek
  2024-03-23 11:31   ` Дилян Палаузов
  2024-04-02  7:39   ` [PATCH] Fix up postboot dependencies [PR106472] Jakub Jelinek
  0 siblings, 2 replies; 10+ messages in thread
From: Jakub Jelinek @ 2024-03-13  9:13 UTC (permalink / raw)
  To: Дилян
	Палаузов,
	Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, Ian Lance Taylor
  Cc: gcc-patches

On Wed, Mar 13, 2024 at 07:37:26AM +0100, Дилян Палаузов wrote:
> Non-parallel build can fail, depending on the ./configure parameters -
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106472 .
> 
> The change below does fix the problem.

CCing build system maintainers and the Go maintainer.

While the first Makefile.tpl hunk looks obviously ok, the others look
completely wrong to me.
There is nothing special about libgo vs. libbacktrace/libatomic
compared to any other target library which is not bootstrapped vs. any
of its dependencies which are in the bootstrapped set.
So, Makefile.tpl shouldn't hardcode such dependencies.

The
all-target-libgo: maybe-all-target-libbacktrace
all-target-libgo: maybe-all-target-libatomic
dependencies which are in Makefile.in already are I believe intentionally
guarded with
@unless gcc-bootstrap
because when bootstrapping, there are the
all-target-libgo: stage_current
configure-target-libgo: stage_last
dependencies instead plus there is always
all-target-libgo: configure-target-libgo
and stage_last should I believe ensure that everything is bootstrapped,
gcc as well as the bootstrapped target libraries like libbacktrace or
libatomic.
Now, if those are built only sometimes depending on configured languages
- I see
grep 'lib\(backtrace\|atomic\)' gcc/*/config-lang.in gcc/ada/gcc-interface/config-lang.in 
gcc/d/config-lang.in:phobos_target_deps="target-zlib target-libbacktrace"
gcc/fortran/config-lang.in:target_libs="target-libgfortran target-libbacktrace"
gcc/go/config-lang.in:target_libs="target-libgo target-libffi target-libbacktrace"
then perhaps Makefile.def should know that it is not a bootstrap=true module
target_modules = { module= libbacktrace; bootstrap=true; };
unconditionally and arrange for the dependencies between non-bootstrap
target modules and these maybe ones to be emitted even if gcc-bootstrap.

> I do not understand the build system to say, that this is the best approach,
> so if there are questions I might or might not be able to answer them.
> 
> I tried different things, this worked on the releases/gcc-13 branch.  On the
> master branch last weekend the problem was that stage2 and stage3 results
> are not equal, so I have not verified this change there.  depend= in
> Makefile.def seem to have only effect if bootstrapping is involved and
> gcc/go/config-lang.in does not have boot_language=yes .  The lines below are
> present in the Makefile.in:@unless gcc-bootstrap snippet.  Actually I think
> ./configure --enable-languages=all and then serial build work, because this
> implied D and it does imply bootstrapping for libbacktrace and libatomic.  I
> also do not want to invest much more time on this.
> 
> I do not know, if 2×`maybe-`  is necessary.
> 
> 
> diff --git a/Makefile.in b/Makefile.in
> index 06a9398e172..236e5cda942 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -66481,6 +66481,7 @@ configure-target-libgfortran:
> maybe-all-target-libquadmath
> 
> 
>  @if gcc-bootstrap
> +all-target-libgo: maybe-all-target-libbacktrace maybe-all-target-libatomic
>  configure-gnattools: stage_last
>  configure-libcc1: stage_last
>  configure-c++tools: stage_last
> diff --git a/Makefile.tpl b/Makefile.tpl
> index dfbd74b68f8..98160c7626b 100644
> --- a/Makefile.tpl
> +++ b/Makefile.tpl
> @@ -1952,7 +1952,7 @@ configure-target-[+module+]: maybe-all-gcc[+
>     (define dep-maybe (lambda ()
>        (if (exist? "hard") "" "maybe-")))
> 
> -   ;; dep-kind returns returns "prebootstrap" for configure or build
> +   ;; dep-kind returns "prebootstrap" for configure or build
>     ;; dependencies of bootstrapped modules on a build module
>     ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
>     ;; on an "install" target, or if the dependence module is not
> @@ -2017,6 +2017,7 @@ configure-target-[+module+]: maybe-all-gcc[+
>  [+ ESAC +][+ ENDFOR dependencies +]
> 
>  @if gcc-bootstrap
> +all-target-libgo: maybe-all-target-libbacktrace maybe-all-target-libatomic
>  [+ FOR dependencies +][+ CASE (dep-kind) +]
>  [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
>  ENDFOR dependencies +]@endif gcc-bootstrap
> 

	Jakub


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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-13  9:13 ` Jakub Jelinek
@ 2024-03-23 11:31   ` Дилян Палаузов
  2024-03-25 23:59     ` Ian Lance Taylor
  2024-04-02  7:39   ` [PATCH] Fix up postboot dependencies [PR106472] Jakub Jelinek
  1 sibling, 1 reply; 10+ messages in thread
From: Дилян Палаузов @ 2024-03-23 11:31 UTC (permalink / raw)
  To: Jakub Jelinek, Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, Ian Lance Taylor
  Cc: gcc-patches

Hello,

Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).

I cannot say if libbacktrace should or should not be a bootstrap=true module.

If there are no better patches, I kindly ask to integrate this patch with a comment, indicating the quality of the patch.  The change proposed by me does fix PR106472.

Kind regards
  Дилян

-----Original Message-----
From: Jakub Jelinek <jakub@redhat.com>
Reply-To: Jakub Jelinek <jakub@redhat.com>
To: Дилян Палаузов <dilyan.palauzov@aegee.org>, Paolo Bonzini <bonzini@gnu.org>, Nathanael Nerode <neroden@gcc.gnu.org>, Alexandre Oliva <aoliva@gcc.gnu.org>, Ralf Wildenhues <Ralf.Wildenhues@gmx.de>, Ian Lance Taylor <iant@golang.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
Date: 03/13/2024 10:13:37 AM

On Wed, Mar 13, 2024 at 07:37:26AM +0100, Дилян Палаузов wrote:
> Non-parallel build can fail, depending on the ./configure parameters -
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106472 .
> 
> The change below does fix the problem.

CCing build system maintainers and the Go maintainer.

While the first Makefile.tpl hunk looks obviously ok, the others look
completely wrong to me.
There is nothing special about libgo vs. libbacktrace/libatomic
compared to any other target library which is not bootstrapped vs. any
of its dependencies which are in the bootstrapped set.
So, Makefile.tpl shouldn't hardcode such dependencies.

The
all-target-libgo: maybe-all-target-libbacktrace
all-target-libgo: maybe-all-target-libatomic
dependencies which are in Makefile.in already are I believe intentionally
guarded with
@unless gcc-bootstrap
because when bootstrapping, there are the
all-target-libgo: stage_current
configure-target-libgo: stage_last
dependencies instead plus there is always
all-target-libgo: configure-target-libgo
and stage_last should I believe ensure that everything is bootstrapped,
gcc as well as the bootstrapped target libraries like libbacktrace or
libatomic.
Now, if those are built only sometimes depending on configured languages
- I see
grep 'lib\(backtrace\|atomic\)' gcc/*/config-lang.in gcc/ada/gcc-interface/config-lang.in 
gcc/d/config-lang.in:phobos_target_deps="target-zlib target-libbacktrace"
gcc/fortran/config-lang.in:target_libs="target-libgfortran target-libbacktrace"
gcc/go/config-lang.in:target_libs="target-libgo target-libffi target-libbacktrace"
then perhaps Makefile.def should know that it is not a bootstrap=true module
target_modules = { module= libbacktrace; bootstrap=true; };
unconditionally and arrange for the dependencies between non-bootstrap
target modules and these maybe ones to be emitted even if gcc-bootstrap.

> I do not understand the build system to say, that this is the best approach,
> so if there are questions I might or might not be able to answer them.
> 
> I tried different things, this worked on the releases/gcc-13 branch.  On the
> master branch last weekend the problem was that stage2 and stage3 results
> are not equal, so I have not verified this change there.  depend= in
> Makefile.def seem to have only effect if bootstrapping is involved and
> gcc/go/config-lang.in does not have boot_language=yes .  The lines below are
> present in the Makefile.in:@unless gcc-bootstrap snippet.  Actually I think
> ./configure --enable-languages=all and then serial build work, because this
> implied D and it does imply bootstrapping for libbacktrace and libatomic.  I
> also do not want to invest much more time on this.
> 
> I do not know, if 2×`maybe-`  is necessary.
> 
> 
> diff --git a/Makefile.in b/Makefile.in
> index 06a9398e172..236e5cda942 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -66481,6 +66481,7 @@ configure-target-libgfortran:
> maybe-all-target-libquadmath
> 
> 
>  @if gcc-bootstrap
> +all-target-libgo: maybe-all-target-libbacktrace maybe-all-target-libatomic
>  configure-gnattools: stage_last
>  configure-libcc1: stage_last
>  configure-c++tools: stage_last
> diff --git a/Makefile.tpl b/Makefile.tpl
> index dfbd74b68f8..98160c7626b 100644
> --- a/Makefile.tpl
> +++ b/Makefile.tpl
> @@ -1952,7 +1952,7 @@ configure-target-[+module+]: maybe-all-gcc[+
>     (define dep-maybe (lambda ()
>        (if (exist? "hard") "" "maybe-")))
> 
> -   ;; dep-kind returns returns "prebootstrap" for configure or build
> +   ;; dep-kind returns "prebootstrap" for configure or build
>     ;; dependencies of bootstrapped modules on a build module
>     ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
>     ;; on an "install" target, or if the dependence module is not
> @@ -2017,6 +2017,7 @@ configure-target-[+module+]: maybe-all-gcc[+
>  [+ ESAC +][+ ENDFOR dependencies +]
> 
>  @if gcc-bootstrap
> +all-target-libgo: maybe-all-target-libbacktrace maybe-all-target-libatomic
>  [+ FOR dependencies +][+ CASE (dep-kind) +]
>  [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
>  ENDFOR dependencies +]@endif gcc-bootstrap
> 

	Jakub



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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-23 11:31   ` Дилян Палаузов
@ 2024-03-25 23:59     ` Ian Lance Taylor
  2024-03-26 16:32       ` Дилян Палаузов
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2024-03-25 23:59 UTC (permalink / raw)
  To: Дилян
	Палаузов
  Cc: Jakub Jelinek, Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, gcc-patches

On Sat, Mar 23, 2024 at 4:32 AM Дилян Палаузов
<dilyan.palauzov@aegee.org> wrote:
>
> Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).
>
> I cannot say if libbacktrace should or should not be a bootstrap=true module.

I don't count as a build expert these days, but since GCC itself links
against libbacktrace, my understanding is that the libbacktrace
host_module should be bootstrap=true, just like, say, libcpp.

Ian

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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-25 23:59     ` Ian Lance Taylor
@ 2024-03-26 16:32       ` Дилян Палаузов
  2024-03-26 16:37         ` Ian Lance Taylor
  0 siblings, 1 reply; 10+ messages in thread
From: Дилян Палаузов @ 2024-03-26 16:32 UTC (permalink / raw)
  To: Ian Lance Taylor
  Cc: Jakub Jelinek, Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, gcc-patches

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

Hello Ian,

Makefile.def contains already:

host_modules= { module= libbacktrace; bootstrap=true; }; // since eff02e4f84 - "libbacktrace/: * Initial implementation" year 2012

host_modules= { module= libcpp; bootstrap=true; }; // since 4f4e53dd8517c0b2 - year 2004

Greetings
  Дилян 

Am 25. März 2024 23:59:52 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>On Sat, Mar 23, 2024 at 4:32 AM Дилян Палаузов
><dilyan.palauzov@aegee.org> wrote:
>>
>> Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).
>>
>> I cannot say if libbacktrace should or should not be a bootstrap=true module.
>
>I don't count as a build expert these days, but since GCC itself links
>against libbacktrace, my understanding is that the libbacktrace
>host_module should be bootstrap=true, just like, say, libcpp.
>
>Ian

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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-26 16:32       ` Дилян Палаузов
@ 2024-03-26 16:37         ` Ian Lance Taylor
  2024-03-28 22:14           ` Дилян Палаузов
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2024-03-26 16:37 UTC (permalink / raw)
  To: Дилян
	Палаузов
  Cc: Jakub Jelinek, Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, gcc-patches

On Tue, Mar 26, 2024 at 9:33 AM Дилян Палаузов
<Dilyan.Palauzov@aegee.org> wrote:
>
> Makefile.def contains already:
>
> host_modules= { module= libbacktrace; bootstrap=true; }; // since eff02e4f84 - "libbacktrace/: * Initial implementation" year 2012
>
> host_modules= { module= libcpp; bootstrap=true; }; // since 4f4e53dd8517c0b2 - year 2004

Yes.  I was just trying to answer your question.

Ian

> Am 25. März 2024 23:59:52 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>>
>> On Sat, Mar 23, 2024 at 4:32 AM Дилян Палаузов
>> <dilyan.palauzov@aegee.org> wrote:
>>>
>>>
>>>  Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).
>>>
>>>  I cannot say if libbacktrace should or should not be a bootstrap=true module.
>>
>>
>> I don't count as a build expert these days, but since GCC itself links
>> against libbacktrace, my understanding is that the libbacktrace
>> host_module should be bootstrap=true, just like, say, libcpp.
>>
>> Ian

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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-26 16:37         ` Ian Lance Taylor
@ 2024-03-28 22:14           ` Дилян Палаузов
  2024-03-28 22:24             ` Andrew Pinski
  0 siblings, 1 reply; 10+ messages in thread
From: Дилян Палаузов @ 2024-03-28 22:14 UTC (permalink / raw)
  To: Ian Lance Taylor
  Cc: Jakub Jelinek, Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, gcc-patches

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

Hello Ian,

when I add in gcc/go/config-lang.in the line
  boot_language=yes

then on stage3 x86_64-pc-linux-gnu/libbacktrace is compiled before x86_64-pc-linux-gnu/libgo and this error is gone.

But then Makefile.def has
  target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; };

and in x86_64-pc-linux-gnu libatomic is not compiled before x86_64-pc-linux-gnu/libgo .  Linking the latter fails

make[2]: Entering directory '/git/gcc/build/x86_64-pc-linux-gnu/libgo'
/bin/sh ./libtool --tag=CC --mode=link /git/gcc/build/./gcc/xgcc -B/git/gcc/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ …long text… golang.org/x/sys/cpu_gccgo_x86.lo ../libbacktrace/libbacktrace.la ../libatomic/libatomic_convenience.la ../libffi/libffi_convenience.la -lpthread -lm
./libtool: line 5195: cd: ../libatomic/.libs: No such file or directory
libtool: link: cannot determine absolute directory name of `../libatomic/.libs'

So either lib_path=.libs interferes (when gcc/go/config-lang.in contains “boot_language=yes”), I have made the semi-serial build, trying to save a lot of time waiting to get on stage3, somehow wrong, or libatomic must be mentioned in gcc/go/config-lang.in . I have the feeling that ./configure --enable-langugage=all works, because gcc/d/config-lang.in contains boot_language=yes, and then in some way libphobos or d depend on libatomic.

That said bootstrap=true might only be relevant when boot_langugages=yes is present.

In addition gcc/go/config-lang.in:boot_language=yes implies that on stage2 (thus in prev-x86_64-pc-linux-gnu/) libbacktrace is built, which I do not want this, as libbacktrace is needed only by libgo on stage3.

Can someone explain, why is libbacktrace built once in the built-root, as stage1-libbacktrace, prev-libbacktrace and libbacktrace (for stage3) and once again in stage1-x86_64-pc-linux-gnu/libbacktrace, prev-x86_64-pc-linux-gnu/libbacktrace/ and in x86_64-pc-linux-gnu/libbacktrace ? My precise question is why libbacktrace is built once in the build-root directory and once in the x86_64-pc-linux-gnu directory?

Kind regards Дилян

Am 26. März 2024 16:37:40 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>On Tue, Mar 26, 2024 at 9:33 AM Дилян Палаузов
><Dilyan.Palauzov@aegee.org> wrote:
>>
>> Makefile.def contains already:
>>
>> host_modules= { module= libbacktrace; bootstrap=true; }; // since eff02e4f84 - "libbacktrace/: * Initial implementation" year 2012
>>
>> host_modules= { module= libcpp; bootstrap=true; }; // since 4f4e53dd8517c0b2 - year 2004
>
>Yes.  I was just trying to answer your question.
>
>Ian
>
>> Am 25. März 2024 23:59:52 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>>>
>>> On Sat, Mar 23, 2024 at 4:32 AM Дилян Палаузов
>>> <dilyan.palauzov@aegee.org> wrote:
>>>>
>>>>
>>>>  Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).
>>>>
>>>>  I cannot say if libbacktrace should or should not be a bootstrap=true module.
>>>
>>>
>>> I don't count as a build expert these days, but since GCC itself links
>>> against libbacktrace, my understanding is that the libbacktrace
>>> host_module should be bootstrap=true, just like, say, libcpp.
>>>
>>> Ian

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

* Re: No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472]
  2024-03-28 22:14           ` Дилян Палаузов
@ 2024-03-28 22:24             ` Andrew Pinski
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Pinski @ 2024-03-28 22:24 UTC (permalink / raw)
  To: Дилян
	Палаузов
  Cc: Ian Lance Taylor, Jakub Jelinek, Paolo Bonzini, Nathanael Nerode,
	Alexandre Oliva, Ralf Wildenhues, gcc-patches

On Thu, Mar 28, 2024 at 3:15 PM Дилян Палаузов
<Dilyan.Palauzov@aegee.org> wrote:
>
> Hello Ian,
>
> when I add in gcc/go/config-lang.in the line
>   boot_language=yes
>
> then on stage3 x86_64-pc-linux-gnu/libbacktrace is compiled before x86_64-pc-linux-gnu/libgo and this error is gone.
>
> But then Makefile.def has
>   target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; };
>
> and in x86_64-pc-linux-gnu libatomic is not compiled before x86_64-pc-linux-gnu/libgo .  Linking the latter fails
>
> make[2]: Entering directory '/git/gcc/build/x86_64-pc-linux-gnu/libgo'
> /bin/sh ./libtool --tag=CC --mode=link /git/gcc/build/./gcc/xgcc -B/git/gcc/build/./gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ …long text… golang.org/x/sys/cpu_gccgo_x86.lo ../libbacktrace/libbacktrace.la ../libatomic/libatomic_convenience.la ../libffi/libffi_convenience.la -lpthread -lm
> ./libtool: line 5195: cd: ../libatomic/.libs: No such file or directory
> libtool: link: cannot determine absolute directory name of `../libatomic/.libs'
>
> So either lib_path=.libs interferes (when gcc/go/config-lang.in contains “boot_language=yes”), I have made the semi-serial build, trying to save a lot of time waiting to get on stage3, somehow wrong, or libatomic must be mentioned in gcc/go/config-lang.in . I have the feeling that ./configure --enable-langugage=all works, because gcc/d/config-lang.in contains boot_language=yes, and then in some way libphobos or d depend on libatomic.
>
> That said bootstrap=true might only be relevant when boot_langugages=yes is present.
>
> In addition gcc/go/config-lang.in:boot_language=yes implies that on stage2 (thus in prev-x86_64-pc-linux-gnu/) libbacktrace is built, which I do not want this, as libbacktrace is needed only by libgo on stage3.
>
> Can someone explain, why is libbacktrace built once in the built-root, as stage1-libbacktrace, prev-libbacktrace and libbacktrace (for stage3) and once again in stage1-x86_64-pc-linux-gnu/libbacktrace, prev-x86_64-pc-linux-gnu/libbacktrace/ and in x86_64-pc-linux-gnu/libbacktrace ? My precise question is why libbacktrace is built once in the build-root directory and once in the x86_64-pc-linux-gnu directory?

Because it is both a target library and a host library. Take a cross
compiler that is being built on say target A and targeting target B.
It will be built as a host library to be included as part of the
cc1/cc1plus/etc. and be a target library that will be used for
libsanitizer (and libgo). The GCC build does not use the target
library to link cc1/cc1plus with it; only the host library version.
Does that make sense now?

Thanks,
Andrew Pinski

>
> Kind regards Дилян
>
>
> Am 26. März 2024 16:37:40 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>>
>> On Tue, Mar 26, 2024 at 9:33 AM Дилян Палаузов
>> <Dilyan.Palauzov@aegee.org> wrote:
>>>
>>>
>>>  Makefile.def contains already:
>>>
>>>  host_modules= { module= libbacktrace; bootstrap=true; }; // since eff02e4f84 - "libbacktrace/: * Initial implementation" year 2012
>>>
>>>  host_modules= { module= libcpp; bootstrap=true; }; // since 4f4e53dd8517c0b2 - year 2004
>>
>>
>> Yes.  I was just trying to answer your question.
>>
>> Ian
>>
>>> Am 25. März 2024 23:59:52 UTC schrieb Ian Lance Taylor <iant@golang.org>:
>>>>
>>>>
>>>>  On Sat, Mar 23, 2024 at 4:32 AM Дилян Палаузов
>>>>  <dilyan.palauzov@aegee.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>>   Can the build experts say what needs to be changed?  The dependencies I added are missing in the build configuration (@if gcc-bootstrap).
>>>>>
>>>>>   I cannot say if libbacktrace should or should not be a bootstrap=true module.
>>>>
>>>>
>>>>
>>>>  I don't count as a build expert these days, but since GCC itself links
>>>>  against libbacktrace, my understanding is that the libbacktrace
>>>>  host_module should be bootstrap=true, just like, say, libcpp.
>>>>
>>>>  Ian

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

* [PATCH] Fix up postboot dependencies [PR106472]
  2024-03-13  9:13 ` Jakub Jelinek
  2024-03-23 11:31   ` Дилян Палаузов
@ 2024-04-02  7:39   ` Jakub Jelinek
  2024-04-02 11:21     ` Richard Biener
  1 sibling, 1 reply; 10+ messages in thread
From: Jakub Jelinek @ 2024-04-02  7:39 UTC (permalink / raw)
  To: Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, Ian Lance Taylor, Richard Biener, Jeff Law
  Cc: gcc-patches,
	Дилян
	Палаузов

On Wed, Mar 13, 2024 at 10:13:37AM +0100, Jakub Jelinek wrote:
> While the first Makefile.tpl hunk looks obviously ok, the others look
> completely wrong to me.
> There is nothing special about libgo vs. libbacktrace/libatomic
> compared to any other target library which is not bootstrapped vs. any
> of its dependencies which are in the bootstrapped set.
> So, Makefile.tpl shouldn't hardcode such dependencies.

Here is my version of the fix.
The dependencies in the toplevel Makefile simply didn't take into account
that some target modules could be in a bootstrapped build built in some
configurations as bootstrap modules (typically as dependencies of other
target bootstrap modules), while in other configurations just as
dependencies of non-bootstrap target modules and so not built during the
bootstrap, but after it.
Makefile.tpl arranges for those postboot target module -> target module
dependencies to be emitted only inside of an @unless gcc-bootstrap block,
while for @if gcc-bootstrap it just emits
configure-target-whatever: stage_last
dependencies which ensure those postbootstrap target modules are only built
after everything that is bootstrapped has been.

Now, the libbacktrace/libatomic target modules have bootstrap=true
target_modules = { module= libbacktrace; bootstrap=true; };
target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; };
because those modules are dependencies of libphobos target module, so
when d is included among bootstrapped languages, those are all bootstrapped
and everything works correctly.
While if d is not included, libphobos target module is disabled,
libbacktrace/libatomic target modules aren't bootstrapped, nothing during
bootstrap needs them, but post bootstrap libgo target module depends on
the libatomic and libbacktrace target modules, libgfortran target module
depends on the libbacktrace target module and libgm2 target module depends
on the libatomic target module, but those dependencies were emitted only
@unless gcc-bootstrap.  There is a similar theoretical problem for zlib
target module if GCJ would be ressurected, libphobos as bootstrap target
module depends on the zlib target module, but if d is not configured,
fastjar also depends on it.

The following patch arranges for the @if gcc-bootstrap case to emit also
target module -> target module dependencies, but conditionally on the
on dependency not being bootstrapped.

In the generated Makefile.in you can see what the Makefile.tpl change
produces and that it just adds extra dependencies which weren't there
before in the @if gcc-bootstrap case.

I've bootstrapped without this patch with
../configure --enable-languages=c,c++,go; make
on x86_64-linux (note, make -j2 or higher usually worked) which failed
as described in the PR, then with this patch with the same command which
built fine and the Makefile difference between the two builds being
diff -up obj40{a,b}/Makefile
--- obj40a/Makefile	2024-03-31 00:35:22.243791499 +0100
+++ obj40b/Makefile	2024-03-31 22:40:38.143299144 +0200
@@ -29376,6 +29376,14 @@ configure-bison: stage_last
 configure-flex: stage_last
 configure-m4: stage_last
 
+configure-target-fastjar: maybe-configure-target-zlib
+all-target-fastjar: maybe-all-target-zlib
+all-target-libgo: maybe-all-target-libbacktrace
+all-target-libgo: maybe-all-target-libatomic
+all-target-libgm2: maybe-all-target-libatomic
+configure-target-libgfortran: maybe-all-target-libbacktrace
+configure-target-libgo: maybe-all-target-libbacktrace
+
 
 # Dependencies for target modules on other target modules are
 # described by lang_env_dependencies; the defaults apply to anything

which I believe are exactly the extra dependencies we want.
Plus I've done normal x86_64-linux and i686-linux bootstraps/regtests
which in my case include --enable-languages=default,ada,obj-c++,lto,go,d,rust,m2
for x86_64 and the same except ada for i686; those with my usual make -j32.
The Makefile difference in those builds vs. unpatched case
is just an extra empty line.

Ok for trunk?

2024-04-02  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/106472
	* Makefile.tpl (make-postboot-target-dep): New lambda.
	Use it to add --enable-bootstrap dependencies of target modules
	on other target modules if the latter aren't bootstrapped.
	* Makefile.in: Regenerate.

--- Makefile.tpl.jj	2024-01-09 22:40:16.812824317 +0100
+++ Makefile.tpl	2024-03-30 14:23:51.985398859 +0100
@@ -2013,6 +2013,25 @@ configure-target-[+module+]: maybe-all-g
 	 (unless (=* target "target-")
            (string-append "configure-" target ": " dep "\n"))))))
 
+   ;; Dependencies in between target modules if the dependencies
+   ;; are bootstrap target modules and the target modules which
+   ;; depend on them are emitted inside of @unless gcc-bootstrap.
+   ;; Unfortunately, some target modules like libatomic or libbacktrace
+   ;; have bootstrap flag set, but whether they are actually built
+   ;; during bootstrap or after bootstrap depends on e.g. enabled languages;
+   ;; if d is enabled, libphobos is built as target module and depends
+   ;; on libatomic and libbacktrace, which are therefore also built as
+   ;; bootstrap modules.  If d is not enabled but go is, libatomic and
+   ;; libbacktrace are just dependencies of libgo which is not a bootstrap
+   ;; target module, but we need dependencies on libatomic and libbacktrace
+   ;; in that case even when gcc-bootstrap.  This lambda emits those.
+   (define make-postboot-target-dep (lambda ()
+     (let ((target (dep-module "module")) (on (dep-module "on")))
+       (when (=* on "target-")
+	 (when (=* target "target-")
+	   (string-append "@unless " on "-bootstrap\n" (make-dep "" "")
+			  "\n@endunless " on "-bootstrap\n"))))))
+
    ;; We now build the hash table that is used by dep-kind.
    (define boot-modules (make-hash-table 113))
    (define postboot-targets (make-hash-table 113))
@@ -2045,6 +2064,11 @@ configure-target-[+module+]: maybe-all-g
 [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
 ENDFOR dependencies +]@endif gcc-bootstrap
 
+@if gcc-bootstrap
+[+ FOR dependencies +][+ CASE (dep-kind) +]
+[+ == "postbootstrap" +][+ (make-postboot-target-dep) +][+ ESAC +][+
+ENDFOR dependencies +]@endif gcc-bootstrap
+
 @unless gcc-bootstrap
 [+ FOR dependencies +][+ CASE (dep-kind) +]
 [+ == "postbootstrap" +][+ (make-dep "" "") +]
--- Makefile.in.jj	2024-01-16 22:51:10.233410651 +0100
+++ Makefile.in	2024-03-29 15:50:34.676632723 +0100
@@ -68677,6 +68677,39 @@ configure-flex: stage_last
 configure-m4: stage_last
 @endif gcc-bootstrap
 
+@if gcc-bootstrap
+@unless target-zlib-bootstrap
+configure-target-fastjar: maybe-configure-target-zlib
+@endunless target-zlib-bootstrap
+@unless target-zlib-bootstrap
+all-target-fastjar: maybe-all-target-zlib
+@endunless target-zlib-bootstrap
+@unless target-libstdc++-v3-bootstrap
+configure-target-libgo: maybe-all-target-libstdc++-v3
+@endunless target-libstdc++-v3-bootstrap
+@unless target-libbacktrace-bootstrap
+all-target-libgo: maybe-all-target-libbacktrace
+@endunless target-libbacktrace-bootstrap
+@unless target-libatomic-bootstrap
+all-target-libgo: maybe-all-target-libatomic
+@endunless target-libatomic-bootstrap
+@unless target-libstdc++-v3-bootstrap
+configure-target-libgm2: maybe-all-target-libstdc++-v3
+@endunless target-libstdc++-v3-bootstrap
+@unless target-libatomic-bootstrap
+all-target-libgm2: maybe-all-target-libatomic
+@endunless target-libatomic-bootstrap
+@unless target-libstdc++-v3-bootstrap
+configure-target-libgrust: maybe-all-target-libstdc++-v3
+@endunless target-libstdc++-v3-bootstrap
+@unless target-libbacktrace-bootstrap
+configure-target-libgfortran: maybe-all-target-libbacktrace
+@endunless target-libbacktrace-bootstrap
+@unless target-libbacktrace-bootstrap
+configure-target-libgo: maybe-all-target-libbacktrace
+@endunless target-libbacktrace-bootstrap
+@endif gcc-bootstrap
+
 @unless gcc-bootstrap
 all-gnattools: maybe-all-target-libstdc++-v3
 configure-libcc1: maybe-configure-gcc


	Jakub


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

* Re: [PATCH] Fix up postboot dependencies [PR106472]
  2024-04-02  7:39   ` [PATCH] Fix up postboot dependencies [PR106472] Jakub Jelinek
@ 2024-04-02 11:21     ` Richard Biener
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Biener @ 2024-04-02 11:21 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Paolo Bonzini, Nathanael Nerode, Alexandre Oliva,
	Ralf Wildenhues, Ian Lance Taylor, Jeff Law, gcc-patches,
	Дилян
	Палаузов

On Tue, 2 Apr 2024, Jakub Jelinek wrote:

> On Wed, Mar 13, 2024 at 10:13:37AM +0100, Jakub Jelinek wrote:
> > While the first Makefile.tpl hunk looks obviously ok, the others look
> > completely wrong to me.
> > There is nothing special about libgo vs. libbacktrace/libatomic
> > compared to any other target library which is not bootstrapped vs. any
> > of its dependencies which are in the bootstrapped set.
> > So, Makefile.tpl shouldn't hardcode such dependencies.
> 
> Here is my version of the fix.
> The dependencies in the toplevel Makefile simply didn't take into account
> that some target modules could be in a bootstrapped build built in some
> configurations as bootstrap modules (typically as dependencies of other
> target bootstrap modules), while in other configurations just as
> dependencies of non-bootstrap target modules and so not built during the
> bootstrap, but after it.
> Makefile.tpl arranges for those postboot target module -> target module
> dependencies to be emitted only inside of an @unless gcc-bootstrap block,
> while for @if gcc-bootstrap it just emits
> configure-target-whatever: stage_last
> dependencies which ensure those postbootstrap target modules are only built
> after everything that is bootstrapped has been.
> 
> Now, the libbacktrace/libatomic target modules have bootstrap=true
> target_modules = { module= libbacktrace; bootstrap=true; };
> target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; };
> because those modules are dependencies of libphobos target module, so
> when d is included among bootstrapped languages, those are all bootstrapped
> and everything works correctly.
> While if d is not included, libphobos target module is disabled,
> libbacktrace/libatomic target modules aren't bootstrapped, nothing during
> bootstrap needs them, but post bootstrap libgo target module depends on
> the libatomic and libbacktrace target modules, libgfortran target module
> depends on the libbacktrace target module and libgm2 target module depends
> on the libatomic target module, but those dependencies were emitted only
> @unless gcc-bootstrap.  There is a similar theoretical problem for zlib
> target module if GCJ would be ressurected, libphobos as bootstrap target
> module depends on the zlib target module, but if d is not configured,
> fastjar also depends on it.
> 
> The following patch arranges for the @if gcc-bootstrap case to emit also
> target module -> target module dependencies, but conditionally on the
> on dependency not being bootstrapped.
> 
> In the generated Makefile.in you can see what the Makefile.tpl change
> produces and that it just adds extra dependencies which weren't there
> before in the @if gcc-bootstrap case.
> 
> I've bootstrapped without this patch with
> ../configure --enable-languages=c,c++,go; make
> on x86_64-linux (note, make -j2 or higher usually worked) which failed
> as described in the PR, then with this patch with the same command which
> built fine and the Makefile difference between the two builds being
> diff -up obj40{a,b}/Makefile
> --- obj40a/Makefile	2024-03-31 00:35:22.243791499 +0100
> +++ obj40b/Makefile	2024-03-31 22:40:38.143299144 +0200
> @@ -29376,6 +29376,14 @@ configure-bison: stage_last
>  configure-flex: stage_last
>  configure-m4: stage_last
>  
> +configure-target-fastjar: maybe-configure-target-zlib
> +all-target-fastjar: maybe-all-target-zlib
> +all-target-libgo: maybe-all-target-libbacktrace
> +all-target-libgo: maybe-all-target-libatomic
> +all-target-libgm2: maybe-all-target-libatomic
> +configure-target-libgfortran: maybe-all-target-libbacktrace
> +configure-target-libgo: maybe-all-target-libbacktrace
> +
>  
>  # Dependencies for target modules on other target modules are
>  # described by lang_env_dependencies; the defaults apply to anything
> 
> which I believe are exactly the extra dependencies we want.
> Plus I've done normal x86_64-linux and i686-linux bootstraps/regtests
> which in my case include --enable-languages=default,ada,obj-c++,lto,go,d,rust,m2
> for x86_64 and the same except ada for i686; those with my usual make -j32.
> The Makefile difference in those builds vs. unpatched case
> is just an extra empty line.
> 
> Ok for trunk?

OK.

Richard.

> 2024-04-02  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR bootstrap/106472
> 	* Makefile.tpl (make-postboot-target-dep): New lambda.
> 	Use it to add --enable-bootstrap dependencies of target modules
> 	on other target modules if the latter aren't bootstrapped.
> 	* Makefile.in: Regenerate.
> 
> --- Makefile.tpl.jj	2024-01-09 22:40:16.812824317 +0100
> +++ Makefile.tpl	2024-03-30 14:23:51.985398859 +0100
> @@ -2013,6 +2013,25 @@ configure-target-[+module+]: maybe-all-g
>  	 (unless (=* target "target-")
>             (string-append "configure-" target ": " dep "\n"))))))
>  
> +   ;; Dependencies in between target modules if the dependencies
> +   ;; are bootstrap target modules and the target modules which
> +   ;; depend on them are emitted inside of @unless gcc-bootstrap.
> +   ;; Unfortunately, some target modules like libatomic or libbacktrace
> +   ;; have bootstrap flag set, but whether they are actually built
> +   ;; during bootstrap or after bootstrap depends on e.g. enabled languages;
> +   ;; if d is enabled, libphobos is built as target module and depends
> +   ;; on libatomic and libbacktrace, which are therefore also built as
> +   ;; bootstrap modules.  If d is not enabled but go is, libatomic and
> +   ;; libbacktrace are just dependencies of libgo which is not a bootstrap
> +   ;; target module, but we need dependencies on libatomic and libbacktrace
> +   ;; in that case even when gcc-bootstrap.  This lambda emits those.
> +   (define make-postboot-target-dep (lambda ()
> +     (let ((target (dep-module "module")) (on (dep-module "on")))
> +       (when (=* on "target-")
> +	 (when (=* target "target-")
> +	   (string-append "@unless " on "-bootstrap\n" (make-dep "" "")
> +			  "\n@endunless " on "-bootstrap\n"))))))
> +
>     ;; We now build the hash table that is used by dep-kind.
>     (define boot-modules (make-hash-table 113))
>     (define postboot-targets (make-hash-table 113))
> @@ -2045,6 +2064,11 @@ configure-target-[+module+]: maybe-all-g
>  [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
>  ENDFOR dependencies +]@endif gcc-bootstrap
>  
> +@if gcc-bootstrap
> +[+ FOR dependencies +][+ CASE (dep-kind) +]
> +[+ == "postbootstrap" +][+ (make-postboot-target-dep) +][+ ESAC +][+
> +ENDFOR dependencies +]@endif gcc-bootstrap
> +
>  @unless gcc-bootstrap
>  [+ FOR dependencies +][+ CASE (dep-kind) +]
>  [+ == "postbootstrap" +][+ (make-dep "" "") +]
> --- Makefile.in.jj	2024-01-16 22:51:10.233410651 +0100
> +++ Makefile.in	2024-03-29 15:50:34.676632723 +0100
> @@ -68677,6 +68677,39 @@ configure-flex: stage_last
>  configure-m4: stage_last
>  @endif gcc-bootstrap
>  
> +@if gcc-bootstrap
> +@unless target-zlib-bootstrap
> +configure-target-fastjar: maybe-configure-target-zlib
> +@endunless target-zlib-bootstrap
> +@unless target-zlib-bootstrap
> +all-target-fastjar: maybe-all-target-zlib
> +@endunless target-zlib-bootstrap
> +@unless target-libstdc++-v3-bootstrap
> +configure-target-libgo: maybe-all-target-libstdc++-v3
> +@endunless target-libstdc++-v3-bootstrap
> +@unless target-libbacktrace-bootstrap
> +all-target-libgo: maybe-all-target-libbacktrace
> +@endunless target-libbacktrace-bootstrap
> +@unless target-libatomic-bootstrap
> +all-target-libgo: maybe-all-target-libatomic
> +@endunless target-libatomic-bootstrap
> +@unless target-libstdc++-v3-bootstrap
> +configure-target-libgm2: maybe-all-target-libstdc++-v3
> +@endunless target-libstdc++-v3-bootstrap
> +@unless target-libatomic-bootstrap
> +all-target-libgm2: maybe-all-target-libatomic
> +@endunless target-libatomic-bootstrap
> +@unless target-libstdc++-v3-bootstrap
> +configure-target-libgrust: maybe-all-target-libstdc++-v3
> +@endunless target-libstdc++-v3-bootstrap
> +@unless target-libbacktrace-bootstrap
> +configure-target-libgfortran: maybe-all-target-libbacktrace
> +@endunless target-libbacktrace-bootstrap
> +@unless target-libbacktrace-bootstrap
> +configure-target-libgo: maybe-all-target-libbacktrace
> +@endunless target-libbacktrace-bootstrap
> +@endif gcc-bootstrap
> +
>  @unless gcc-bootstrap
>  all-gnattools: maybe-all-target-libstdc++-v3
>  configure-libcc1: maybe-configure-gcc
> 
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

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

end of thread, other threads:[~2024-04-02 11:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13  6:37 No rule to make target '../libbacktrace/libbacktrace.la', needed by 'libgo.la'. [PR106472] Дилян Палаузов
2024-03-13  9:13 ` Jakub Jelinek
2024-03-23 11:31   ` Дилян Палаузов
2024-03-25 23:59     ` Ian Lance Taylor
2024-03-26 16:32       ` Дилян Палаузов
2024-03-26 16:37         ` Ian Lance Taylor
2024-03-28 22:14           ` Дилян Палаузов
2024-03-28 22:24             ` Andrew Pinski
2024-04-02  7:39   ` [PATCH] Fix up postboot dependencies [PR106472] Jakub Jelinek
2024-04-02 11:21     ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).