Bug 85768 - [9 Regression] FreeBSD bootstrap fails due to undefined reference to 'backtrace'
Summary: [9 Regression] FreeBSD bootstrap fails due to undefined reference to 'backtrace'
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 9.0
: P1 blocker
Target Milestone: 9.0
Assignee: François Dumont
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2018-05-13 20:03 UTC by Andreas Tobler
Modified: 2018-08-08 16:26 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 8.1.0
Known to fail: 9.0
Last reconfirmed: 2018-05-13 00:00:00


Attachments
Remove backtrace usage during bootstrap. (318 bytes, patch)
2018-05-25 16:25 UTC, François Dumont
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Tobler 2018-05-13 20:03:04 UTC
A recent commit (260054) broke bootstrap on FreeBSD. The reason is an undefined reference to 'backtrace'. This function is available on FreeBSD too but not in libc. It is available in libexecinfo. A quick hack to linkage.m4 to add this library if found showed a 37 failure count instead of 7k+ without.

I do not know the right to link an additional library for debug purposes.

Also, this might be applicable to NetBSD too, don't have it here but the man page of backtrace notes that the function appeared in NetBSD 7.0 and FreeBSD 10.
Comment 1 Richard Biener 2018-05-14 08:24:35 UTC
Hmm, I think we are supposed to use libbacktrace instead?
Comment 2 Jonathan Wakely 2018-05-14 10:53:39 UTC
Yes I did suggest that. For now I think we should just disable the use of backtrace anywhere except GNU/Linux.
Comment 3 François Dumont 2018-05-14 18:09:59 UTC
I used this function cause it was already being used by the libstdc++ profile mode so I was expecting it to be quite safe. As profile mode is not used on bootstrap or in general I guess this problem never show up.

I'll move to libbacktrace with proper checks.

Waiting for the fix shall I revert the change ?
Comment 4 François Dumont 2018-05-25 16:25:08 UTC
Created attachment 44187 [details]
Remove backtrace usage during bootstrap.

I wonder if this patch could fix the bootstrap ? I try to avoid the usage of backtrace during bootstrap. The problem will then be limited to usage of debug mode in users code.

I still plan to use libbacktrace but it will take me some time to find out how.
Comment 5 François Dumont 2018-05-25 16:41:27 UTC
Author: fdumont
Date: Fri May 25 16:40:55 2018
New Revision: 260761

URL: https://gcc.gnu.org/viewcvs?rev=260761&root=gcc&view=rev
Log:
2018-05-25  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/85768
	* src/c++11/debug.cc: Remove backtrace usage.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/c++11/debug.cc
Comment 6 Gerald Pfeifer 2018-05-25 16:46:41 UTC
(In reply to François Dumont from comment #4)
> I wonder if this patch could fix the bootstrap ? I try to avoid the usage of
> backtrace during bootstrap. The problem will then be limited to usage of
> debug mode in users code.

In my case, the bootstrap wasn't broken, I just got tons and tons
of testsuites failures -- so many, that the gcc-testresults@ list
refused my mails due to size constraints.

Looking at Andreas' original comment saying "A quick hack to linkage.m4
to add this library if found showed a 37 failure count instead of 7k+
without." he may have experienced the same, not an actual bootstrap
failure?
Comment 7 Jonathan Wakely 2018-08-08 16:26:38 UTC
Let's close this, as the bootstrap problem is fixed.