aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-22 15:26:41 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-06-22 15:26:41 +0300
commit03ae68528a1fca061195bac52f0484f6f54b2582 (patch)
tree4093239f0b89511e8ff2b29fabc76300f5ecd10a /build/scripts
parent250d29abfdc9a2526cac1e0b4b36c5b6e1d58e0c (diff)
downloadydb-03ae68528a1fca061195bac52f0484f6f54b2582.tar.gz
intermediate changes
ref:e5b94b91d513ee8cc2d1610107a4e0b462b9c9db
Diffstat (limited to 'build/scripts')
-rw-r--r--build/scripts/link_dyn_lib.py59
-rw-r--r--build/scripts/run_junit.py3
-rw-r--r--build/scripts/run_msvc_wine.py10
3 files changed, 58 insertions, 14 deletions
diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py
index 23487f5c1ef..e2d04dc4cc9 100644
--- a/build/scripts/link_dyn_lib.py
+++ b/build/scripts/link_dyn_lib.py
@@ -124,10 +124,29 @@ def fix_windows_param(ex):
return ['/DEF:{}'.format(def_file.name)]
-musl_libs = '-lc', '-lcrypt', '-ldl', '-lm', '-lpthread', '-lrt', '-lutil'
-
-
-def fix_cmd(arch, musl, c):
+MUSL_LIBS = '-lc', '-lcrypt', '-ldl', '-lm', '-lpthread', '-lrt', '-lutil'
+
+CUDA_LIBRARIES = {
+ '-lcublas_static': '-lcublas',
+ '-lcublasLt_static': '-lcublasLt',
+ '-lcudart_static': '-lcudart',
+ '-lcudnn_static': '-lcudnn',
+ '-lcufft_static_nocallback': '-lcufft',
+ '-lcurand_static': '-lcurand',
+ '-lcusolver_static': '-lcusolver',
+ '-lcusparse_static': '-lcusparse',
+ '-lmyelin_compiler_static': '-lmyelin',
+ '-lmyelin_executor_static': '-lnvcaffe_parser',
+ '-lmyelin_pattern_library_static': '',
+ '-lmyelin_pattern_runtime_static': '',
+ '-lnvinfer_static': '-lnvinfer',
+ '-lnvinfer_plugin_static': '-lnvinfer_plugin',
+ '-lnvonnxparser_static': '-lnvonnxparser',
+ '-lnvparsers_static': '-lnvparsers'
+}
+
+
+def fix_cmd(arch, c):
if arch == 'WINDOWS':
prefix = '/DEF:'
f = fix_windows_param
@@ -139,9 +158,6 @@ def fix_cmd(arch, musl, c):
f = lambda x: fix_gnu_param(arch, x)
def do_fix(p):
- if musl and p in musl_libs:
- return []
-
if p.startswith(prefix) and p.endswith('.exports'):
fname = p[len(prefix):]
@@ -158,6 +174,24 @@ def fix_cmd(arch, musl, c):
return sum((do_fix(x) for x in c), [])
+def fix_cmd_for_musl(cmd):
+ flags = []
+ for flag in cmd:
+ if flag not in MUSL_LIBS:
+ flags.append(flag)
+ return flags
+
+
+def fix_cmd_for_dynamic_cuda(cmd):
+ flags = []
+ for flag in cmd:
+ if flag in CUDA_LIBRARIES:
+ flags.append(CUDA_LIBRARIES[flag])
+ else:
+ flags.append(flag)
+ return flags
+
+
def parse_args():
parser = optparse.OptionParser()
parser.disable_interspersed_args()
@@ -167,6 +201,7 @@ def parse_args():
parser.add_option('--fix-elf')
parser.add_option('--linker-output')
parser.add_option('--musl', action='store_true')
+ parser.add_option('--dynamic-cuda', action='store_true')
parser.add_option('--whole-archive-peers', action='append')
parser.add_option('--whole-archive-libs', action='append')
return parser.parse_args()
@@ -178,7 +213,13 @@ if __name__ == '__main__':
assert opts.arch
assert opts.target
- cmd = fix_cmd(opts.arch, opts.musl, args)
+ cmd = fix_cmd(opts.arch, args)
+
+ if opts.musl:
+ cmd = fix_cmd_for_musl(cmd)
+ if opts.dynamic_cuda:
+ cmd = fix_cmd_for_dynamic_cuda(cmd)
+
cmd = ProcessWholeArchiveOption(opts.arch, opts.whole_archive_peers, opts.whole_archive_libs).construct_cmd(cmd)
if opts.linker_output:
@@ -226,7 +267,7 @@ C++ geobase5::hardcoded_service
"""
filename = write_temp_file(export_file_content)
args = ['-Wl,--version-script={}'.format(filename)]
- assert fix_cmd('DARWIN', False, args) == [
+ assert fix_cmd('DARWIN', args) == [
'-Wl,-exported_symbol,__ZN8geobase57details11lookup_impl*',
'-Wl,-exported_symbol,__ZTIN8geobase57details11lookup_impl*',
'-Wl,-exported_symbol,__ZTSN8geobase57details11lookup_impl*',
diff --git a/build/scripts/run_junit.py b/build/scripts/run_junit.py
index 1e84934f4de..089f149f723 100644
--- a/build/scripts/run_junit.py
+++ b/build/scripts/run_junit.py
@@ -1,6 +1,3 @@
-import collections
-import json
-import time
import os
import sys
diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py
index cb94c19c5bd..9305db97ee4 100644
--- a/build/scripts/run_msvc_wine.py
+++ b/build/scripts/run_msvc_wine.py
@@ -226,7 +226,7 @@ def is_good_file(p):
if os.path.getsize(p) < 300:
return False
- asm_pattern = re.compile('asm(\.\w+)?\.obj$')
+ asm_pattern = re.compile(r'asm(\.\w+)?\.obj$')
if asm_pattern.search(p):
pass
elif p.endswith('.obj'):
@@ -358,7 +358,10 @@ def trim_path(path, winepath):
check_path = check_path[2:]
if not check_path[1:].startswith((path[1:4], path[1:4].upper())):
- raise Exception('Cannot trim path {}; 1st winepath exit code: {}, stdout:\n{}\n stderr:\n{}\n 2nd winepath exit code: {}, stdout:\n{}\n stderr:\n{}'.format(path, p1.returncode, p1_stdout, p1_stderr, p2.returncode, p2_stdout, p2_stderr))
+ raise Exception(
+ 'Cannot trim path {}; 1st winepath exit code: {}, stdout:\n{}\n stderr:\n{}\n 2nd winepath exit code: {}, stdout:\n{}\n stderr:\n{}'.format(
+ path, p1.returncode, p1_stdout, p1_stderr, p2.returncode, p2_stdout, p2_stderr
+ ))
return short_path
@@ -381,6 +384,7 @@ def make_full_path_arg(arg, bld_root, short_root):
return os.path.join(short_root, arg)
return arg
+
def fix_path(p):
topdirs = ['/%s/' % d for d in os.listdir('/')]
def abs_path_start(path, pos):
@@ -399,6 +403,7 @@ def fix_path(p):
return '/Fo' + p[3:].replace('/', '\\')
return p
+
def process_free_args(args, wine, bld_root, mode):
whole_archive_prefix = '/WHOLEARCHIVE:'
short_names = {}
@@ -430,6 +435,7 @@ def process_free_args(args, wine, bld_root, mode):
result.append(process_arg(arg))
return pwa.ProcessWholeArchiveOption('WINDOWS', wa_peers, wa_libs).construct_cmd(result)
+
def run_main():
parser = argparse.ArgumentParser()
parser.add_argument('wine', action='store')