Bug 279692 - '#include <csetjmp>' is broken: error: "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
Summary: '#include <csetjmp>' is broken: error: "If libc++ starts defining <setjmp.h>,...
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
: 281257 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-12 08:46 UTC by Yuri Victorovich
Modified: 2024-09-09 17:54 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2024-06-12 08:46:16 UTC
This simple program can't be compiled on 14.1:
#include <csetjmp>

int main() {
}

$ c++ x.cpp 
In file included from x.cpp:2:
/usr/include/c++/v1/csetjmp:40:6: error: "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
   40 | #    error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
      |      ^
1 error generated.


The error message doesn't explain what is wrong with the program.

The C++ standard says that <csetjmp> should be included for the C++ feature std::jmp_buf.

See here: https://en.cppreference.com/w/cpp/utility/program/jmp_buf
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-06-12 09:30:27 UTC
I can't reproduce this on freshly installed 14.1-RELEASE. The program compiles just fine. How have you installed your system?
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-06-12 09:32:07 UTC
I had a similar issue recently on CURRENT. In my case the cause was that I had built base from sources forgetting to run "make delete-old". After running it everything was fixed.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2024-06-12 09:35:31 UTC
(In reply to Lorenzo Salvadore from comment #2)
Ah yes, this is because the old copy of /usr/include/c++/v1/setjmp.h must be deleted upon an upgrade. A fresh install will never have this issue.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2024-09-05 08:33:21 UTC
*** Bug 281257 has been marked as a duplicate of this bug. ***
Comment 5 Bob Frazier 2024-09-05 18:55:35 UTC
Thanks, deleting the above mentioned file appears to fix everything related to csetjmp

please add this info to UPDATING regarding setjmp.h and csetjmp

also there are two setjmp.h files in "/usr/include/c++/v1" - shouldn't BOTH be deleted?
(/usr/include/c++/v1/tr1/setjmp.h is a symlink to /usr/include/c++/v1/setjmp.h)

NOTE:  in some cases, like a massive ports upgrade, using "make delete-old" might not be desirable until after many ports have already been re-built.  I did not use 'portupgrade' but it could very likely break something (so I do this step last).  But this is a nit as long as UPDATING covers the topic, I'd think.
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2024-09-05 19:31:27 UTC
(In reply to Bob Frazier from comment #5)

$ grep setjmp.h ObsoleteFiles.inc
OLD_FILES+=usr/include/c++/v1/setjmp.h
OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h

Both of these are in ObsoleteFiles.inc, the latter has been there for quite a long time, since the tr1 directory was cleaned up.

Everybody should run make delete-old after upgrading, this is the only supported mechanism. Adding notes to UPDATING might work, but if people don't follow instructions then it might not make much difference. :)
Comment 7 Mark Millard 2024-09-05 20:02:02 UTC
(In reply to Bob Frazier from comment #5)

QUOTE
NOTE:  in some cases, like a massive ports upgrade, using
"make delete-old" might not be desirable until after many
ports have already been re-built.
END QUOTE

Avoiding running "make delete-old" leads to the risk of silently
finding and using out-of-date content in some of the upgrade's
build activity. Such can make it harder to discover that there
are problems to fix to be sure that the right content is used.

"make delete-old-libs" is somewhat different for the criteria
relative to keeping programs that do not yet have updated
installs operational (still using old .so files and such).
"make delete-old-libs" is appropriate after the upgrades to
versions that use the newer .so libraries are in use instead.
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-09-05 20:12:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=157802238b5aa7722aff40317fe6d05f5c975d71

commit 157802238b5aa7722aff40317fe6d05f5c975d71
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-05 19:55:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-05 19:58:51 +0000

    Add UPDATING note about running make delete-old after libc++ 18 upgrade

    PR:             279692
    MFC after:      3 days

 UPDATING | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 9 commit-hook freebsd_committer freebsd_triage 2024-09-08 07:55:16 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=28ff3ab2ab064224cd1fc0885040c3c47ed5ef4d

commit 28ff3ab2ab064224cd1fc0885040c3c47ed5ef4d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-05 19:55:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-08 07:48:57 +0000

    Add UPDATING note about running make delete-old after libc++ 18 upgrade

    PR:             279692
    MFC after:      3 days

    (cherry picked from commit 157802238b5aa7722aff40317fe6d05f5c975d71)

 UPDATING | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-09-08 07:56:20 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b147f693b91f16db7ba6193611f6f4d2ed762a5

commit 6b147f693b91f16db7ba6193611f6f4d2ed762a5
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-05 19:55:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-08 07:51:37 +0000

    Add UPDATING note about running make delete-old after libc++ 18 upgrade

    PR:             279692
    MFC after:      3 days

    (cherry picked from commit 157802238b5aa7722aff40317fe6d05f5c975d71)

 UPDATING | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 11 commit-hook freebsd_committer freebsd_triage 2024-09-09 17:54:16 UTC
A commit in branch releng/13.4 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5096328dd7cbe79628098f10ab92eb4ab70d5fce

commit 5096328dd7cbe79628098f10ab92eb4ab70d5fce
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-05 19:55:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-09 17:49:39 +0000

    Add UPDATING note about running make delete-old after libc++ 18 upgrade

    PR:             279692
    MFC after:      3 days

    (cherry picked from commit 157802238b5aa7722aff40317fe6d05f5c975d71)
    (cherry picked from commit 6b147f693b91f16db7ba6193611f6f4d2ed762a5)

    Approved by:    re (cperciva)

 UPDATING | 7 +++++++
 1 file changed, 7 insertions(+)