Unverified Commit ed1771c3 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] add docs and specific error messages in check_dynamic_dependencies.py (#5582)

parent 24af9fa5
...@@ -2,13 +2,22 @@ ...@@ -2,13 +2,22 @@
"""Helper script for checking versions in the dynamic symbol table. """Helper script for checking versions in the dynamic symbol table.
This script checks that LightGBM library is linked to the appropriate symbol versions. This script checks that LightGBM library is linked to the appropriate symbol versions.
Linking to newer symbol versions at compile time is problematic because it could result
in built artifacts being unusable on older platforms.
Version history for these symbols can be found at the following:
* GLIBC: https://sourceware.org/glibc/wiki/Glibc%20Timeline
* GLIBCXX: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
* OMP/GOMP: https://github.com/gcc-mirror/gcc/blob/master/libgomp/libgomp.map
""" """
import re import re
import sys import sys
from pathlib import Path from pathlib import Path
def check_dependicies(objdump_string: str) -> None: def check_dependencies(objdump_string: str) -> None:
"""Check the dynamic symbol versions. """Check the dynamic symbol versions.
Parameters Parameters
...@@ -20,24 +29,27 @@ def check_dependicies(objdump_string: str) -> None: ...@@ -20,24 +29,27 @@ def check_dependicies(objdump_string: str) -> None:
versions = GLIBC_version.findall(objdump_string) versions = GLIBC_version.findall(objdump_string)
assert len(versions) > 1 assert len(versions) > 1
for major, minor in versions: for major, minor in versions:
assert int(major) <= 2 error_msg = f"found unexpected GLIBC version: '{major}.{minor}'"
assert int(minor) <= 28 assert int(major) <= 2, error_msg
assert int(minor) <= 28, error_msg
GLIBCXX_version = re.compile(r'0{16}[ \t]+GLIBCXX_(\d{1,2})[.](\d{1,2})[.]?(\d{,3})[ \t]+') GLIBCXX_version = re.compile(r'0{16}[ \t]+GLIBCXX_(\d{1,2})[.](\d{1,2})[.]?(\d{,3})[ \t]+')
versions = GLIBCXX_version.findall(objdump_string) versions = GLIBCXX_version.findall(objdump_string)
assert len(versions) > 1 assert len(versions) > 1
for major, minor, patch in versions: for major, minor, patch in versions:
assert int(major) == 3 error_msg = f"found unexpected GLIBCXX version: '{major}.{minor}.{patch}'"
assert int(minor) == 4 assert int(major) == 3, error_msg
assert patch == '' or int(patch) <= 22 assert int(minor) == 4, error_msg
assert patch == '' or int(patch) <= 22, error_msg
GOMP_version = re.compile(r'0{16}[ \t]+G?OMP_(\d{1,2})[.](\d{1,2})[.]?\d{,3}[ \t]+') GOMP_version = re.compile(r'0{16}[ \t]+G?OMP_(\d{1,2})[.](\d{1,2})[.]?\d{,3}[ \t]+')
versions = GOMP_version.findall(objdump_string) versions = GOMP_version.findall(objdump_string)
assert len(versions) > 1 assert len(versions) > 1
for major, minor in versions: for major, minor in versions:
assert int(major) <= 4 error_msg = f"found unexpected OMP/GOMP version: '{major}.{minor}'"
assert int(minor) <= 5 assert int(major) <= 4, error_msg
assert int(minor) <= 5, error_msg
if __name__ == "__main__": if __name__ == "__main__":
check_dependicies(Path(sys.argv[1]).read_text(encoding='utf-8')) check_dependencies(Path(sys.argv[1]).read_text(encoding='utf-8'))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment