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

Allow compilation with clang-7 #3663

Merged
merged 1 commit into from
Nov 28, 2021
Merged

Allow compilation with clang-7 #3663

merged 1 commit into from
Nov 28, 2021

Conversation

stweil
Copy link
Member

@stweil stweil commented Nov 28, 2021

Signed-off-by: Stefan Weil sw@weilnetz.de

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil
Copy link
Member Author

stweil commented Nov 28, 2021

These small modifications allow building Tesseract 5 with clang-7 on Debian stretch. They are not sufficient for g++ 6.3 (see issue #3255).

@egorpugin
Copy link
Contributor

This happens when no C++17 available in stdlib.
Do we require C++17 support still?

(Compilers port some core language (not std) features into older standards. Like such if constexpr into c++14, c++11 and probably even c++98.)

@stweil
Copy link
Member Author

stweil commented Nov 28, 2021

configure accepts g++ and clang++ on Debian stretch, so both compilers should formally support C++17. Nevertheless both fail to compile the current code because their C++17 support has deficits.

Therefore I think that it's good to check for C++17 to get at least a compiler which nearly supports it. If we would lower the requirements and only check C++14, we might risk getting more reports for old compilers which are nearly compatible with C++14.

Maybe we also want to use more C++17 features (which may then break builds with clang from Debian stretch, too) in later 5.x.y releases.

@egorpugin
Copy link
Contributor

egorpugin commented Nov 28, 2021

5.x.x releases won't get too much attention and code changes, so they could live with current "semi-C++17" standard.


As always I propose to move forward with the next 6,7... main branch (C++20/23).

@egorpugin egorpugin merged commit bb155a1 into tesseract-ocr:main Nov 28, 2021
@egorpugin
Copy link
Contributor

By the way, do we have v5 branch already? Such fixes could land exactly there.
But main will keep moving forward.

@stweil stweil deleted the clang7 branch November 28, 2021 21:08
@amitdo
Copy link
Collaborator

amitdo commented Nov 29, 2021

Before applying this patch, did you try to install libc++-7-dev, and tell clang to use it: clang-7 -std=c++17 -stdlib=libc++-7(or maybe it should be -stdlib=libc++7, I don't remember...) ?

@amitdo
Copy link
Collaborator

amitdo commented Nov 30, 2021

Also note that Debiain Stretch is not maintained by the Debian project anymore.

https://wiki.debian.org/LTS

Debian Long Term Support (LTS) is a project to extend the lifetime of all Debian stable releases to (at least) 5 years. Debian LTS is not handled by the Debian security team, but by a separate group of volunteers and companies interested in making it a success.

EOL of Debian Stretch LTS: June 30, 2022.

Personally, I don't think we should support it in 5.0.0.

@amitdo
Copy link
Collaborator

amitdo commented Nov 30, 2021

Compilers port some core language (not std) features into older standards. Like such if constexpr into c++14, c++11 and probably even c++98.

https://gcc.gnu.org/gcc-12/changes.html

New warning options for C++ language mismatches: -Wc++11-extensions, -Wc++14-extensions, -Wc++17-extensions, -Wc++20-extensions, and -Wc++23-extensions. They are enabled by default and can be used to control existing pedwarns about occurences of new C++ constructs in code using an old C++ standard dialect.

@amitdo
Copy link
Collaborator

amitdo commented Nov 30, 2021

These warnings are also available in Clang:

https://clang.llvm.org/docs/DiagnosticsReference.html#wc-17-extensions

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