Skip to content

Commit

Permalink
fix version compare error when gcc version >= 10 (#1016)
Browse files Browse the repository at this point in the history
* fix version compare error when gcc version >= 10
* fix python ci config and compatibility to python3
---------
Co-authored-by: jefferydeng <[email protected]>
  • Loading branch information
noanswer authored Aug 25, 2023
1 parent 7279046 commit 067da77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["2.7", "3.6", "3.9", "3.10"]
python-version: ["3.6", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 7 additions & 1 deletion src/blade/cc_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
import os
from string import Template

try:
from packaging.version import parse as version_parse
except ImportError:
from distutils.version import LooseVersion as version_parse


from blade import build_manager
from blade import build_rules
from blade import config
Expand Down Expand Up @@ -1321,7 +1327,7 @@ def _get_rpath_links(self):
def _generate_cc_binary_link_flags(self, dynamic_link):
linkflags = []
toolchain = self.blade.get_build_toolchain()
if not dynamic_link and toolchain.cc_is('gcc') and toolchain.get_cc_version() > '4.5':
if not dynamic_link and toolchain.cc_is('gcc') and version_parse(toolchain.get_cc_version()) > version_parse('4.5'):
linkflags += ['-static-libgcc', '-static-libstdc++']
if self.attr.get('export_dynamic'):
linkflags.append('-rdynamic')
Expand Down

0 comments on commit 067da77

Please sign in to comment.