Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: begin using -std=c++17 and c17 in Makefile builds #2648

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

rkuester
Copy link
Contributor

@rkuester rkuester commented Jul 29, 2024

Begin using -std=c++17 and -std=c17 in Makefile builds on
all platforms. Bazel builds have been using C++17 since 52c9568.

Set -stdlib=libc++ on xt-clang on Xtensa to add C++17 library
support in addition to compiler support. From the xt-clang docs:

Starting with the RI-2019.1 release, XT-CLANG has included support
for C++14 and C++17 language features. The compiler support for
C++14 and C++17 is accompanied by the C++ library from the LLVM
project. This library can be selected with the -stdlib=libc++
option, and this is strongly recommended when compiling with
-std=c++14 or - std=c++17. Starting with the RI-2021.6 release, two
additional versions of this C++ library are provided— one that
excludes support for exception handling, and one that excludes both
exception handling and run-time type identification. These libraries
can be selected with -stdlib=libc ++-e and -stdlib=libc++-re options
respectively.

Based on the docker run command in
tflite-micro/.github/workflows/xtensa_presubmit.yml, our CI is
currently using RI-2020.4.

Refactor the make/ext_libs/xtensa_download.sh script to make it eaiser
to patch downloads for all Xtensa platforms. The old script made overly
strict assumptions about the name of the patch.

Patch the Xtensa vision_p6 platform download xi_tflmlib_vision_p6 for
compatibility with the C++ library standard. Use the header to
access constants such as INT_MAX.

BUG=#2650

@rkuester rkuester requested a review from a team as a code owner July 29, 2024 21:59
@rkuester rkuester marked this pull request as draft July 29, 2024 21:59
@rkuester
Copy link
Contributor Author

Closing and punting, for now, to issue #2650.

Begin using -std=c++17 and -std=c17 in Makefile builds on all
platforms. Bazel builds have been using C++17 since 52c9568.
Fix C++17 support on Xtensa by adding C++17 library support in addition
to compiler support. From the xt-clang docs:

    Starting with the RI-2019.1 release, XT-CLANG has included support
    for C++14 and C++17 language features. The compiler support for
    C++14 and C++17 is accompanied by the C++ library from the LLVM
    project. This library can be selected with the -stdlib=libc++
    option, and this is strongly recommended when compiling with
    -std=c++14 or - std=c++17. Starting with the RI-2021.6 release, two
    additional versions of this C++ library are provided— one that
    excludes support for exception handling, and one that excludes both
    exception handling and run-time type identification. These libraries
    can be selected with -stdlib=libc ++-e and -stdlib=libc++-re options
    respectively.

Based on the `docker run` command in
tflite-micro/.github/workflows/xtensa_presubmit.yml), our CI is
currently using RI-2020.4.
Refactor the make/ext_libs/xtensa_download.sh script to make it eaiser
to patch downloads for all Xtensa platforms. The old script made overly
strict assumptions about the name of the patch.
Patch the Xtensa vision_p6 platform download xi_tflmlib_vision_p6 for
compatibility with the C++ library standard. Use the header <climits> to
access constants such as INT_MAX.
@rkuester rkuester marked this pull request as ready for review August 1, 2024 20:36
@rkuester rkuester requested a review from rascani August 1, 2024 20:36
@mergify mergify bot merged commit 6c6e9b3 into tensorflow:main Aug 1, 2024
46 of 47 checks passed
@rkuester rkuester deleted the feature-makefile-c++17 branch August 19, 2024 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants