Get version number using GCC Micros

Source: Internet
Author: User


Recently attempted to compile dpdk-2.2.0 on OpenSUSE tumbleweed,mk/toolchain/gcc/rte.toolchain-compat.mk error, said GCC version is less than 4.X; look, gcc. Version is 5.X. And the upstream version does not have this problem


Compare upstream changes and learn how to use gcc micros directly in Makefile to get version number information :

Commit A5c5b9f76767badb3f198326bd5cbbebba803e36
Author:markos Chandras <[email protected]>
Date:tue Mar A -: -: $ . +0000

Mk:fixGCC-5version on Suse

In OpenSUSE tumbleweed ( andinchAny other SUSE distributionwhich
uses (or would use)GCC>=5), GCC-dumpversionreturns'5'. on
Purpose as discussedinchhttps://bugzilla.opensuse.org/show_bug.cgi?id=941428
As a result ofwhich, theGCC-4. x comparison ( +against5) does not
Work leading to tons of warnings and failures during build.

ThisPatchaims to change theGCCversion is obtained by U Sing
the GCC macros directly.

This is similar's being used in the Linux kernel. Querying the
GCC macros directly gives Moreaccurate results compared to-dumpversion
whichcould vary across distributions.

Signed-off-by:markos Chandras <[email protected]>
acked-by:thomas Monjalon <[email protected]>

diff--git a/mk/toolchain/GCC/rte.toolchain-compat.mk b/mk/toolchain/GCC/rte.toolchain-compat.mk
Index e144216: 6eed20c100644
---a/mk/toolchain/GCC/rte.toolchain-compat.mk
+ + b/mk/toolchain/GCC/rte.toolchain-compat.mk
@@ - -,7 + -,9 @@

 #FindOut GCC version

-gcc_version = $ (subst.,, $ (Shell $ (CC)-dumpversion |Cut-f1-2-D.))
+gcc_major = $ (ShellEcho __gnuc__| $ (CC)-e-x C-|Tail- N1)
+gcc_minor = $ (ShellEcho __gnuc_minor__| $ (CC)-e-x C-|Tail- N1)
+gcc_version = $ (gcc_major) $ (gcc_minor)

Get version number using GCC Micros

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.