From 9301c0b36e1a189549a44aefc14febab220ba87d Mon Sep 17 00:00:00 2001 From: "Kozlov, Alexey" Date: Fri, 2 Apr 2021 19:00:58 +0300 Subject: [PATCH 1/4] Update compiler dialect flags to use C++17 --- setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 0bccb26fc..fa6724d1a 100644 --- a/setup.py +++ b/setup.py @@ -111,8 +111,13 @@ def check_file_at_path(path2file): ind = [PREFIX_DIR + '/include', ] lid = [PREFIX_DIR + '/lib', ] -eca = ['-std=c++11', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '-g', '-O0'] -ela = ['-std=c++11', ] + +if is_win: + eca = ['/std:c++17', "/Ox", "/DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '/ZI', '/Od'] + ela = ['/std:c++17', ] +else: + eca = ['-std=c++17', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '-g', '-O0'] + ela = ['-std=c++17', ] io_libs = [] @@ -202,8 +207,8 @@ def check_file_at_path(path2file): sources=["sdc/_datetime_ext.cpp"], libraries=np_compile_args['libraries'], define_macros=np_compile_args['define_macros'], - extra_compile_args=['-std=c++11'], - extra_link_args=['-std=c++11'], + extra_compile_args=eca, + extra_link_args=ela, include_dirs=np_compile_args['include_dirs'], library_dirs=np_compile_args['library_dirs'], language="c++" From 6e9d174dca7722b98a7cf0ae1f0ea811bd5eb97e Mon Sep 17 00:00:00 2001 From: "Kozlov, Alexey" Date: Tue, 18 May 2021 15:11:26 +0300 Subject: [PATCH 2/4] More needed debug options --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index fa6724d1a..b8d6047df 100644 --- a/setup.py +++ b/setup.py @@ -113,11 +113,11 @@ def check_file_at_path(path2file): lid = [PREFIX_DIR + '/lib', ] if is_win: - eca = ['/std:c++17', "/Ox", "/DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '/ZI', '/Od'] - ela = ['/std:c++17', ] + eca = ['/std:c++17', "/Ox", "/DTBB_PREVIEW_WAITING_FOR_WORKERS=1", ] # "/Zi", "/Od", "/DEBUG:FULL"] + ela = ['/DEBUG:FULL'] else: - eca = ['-std=c++17', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '-g', '-O0'] - ela = ['-std=c++17', ] + eca = ['-std=c++17', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1", ] # '-g', '-O0'] + ela = [] io_libs = [] From db85f259fe307d21fa70813bdc7fbe2b5243635e Mon Sep 17 00:00:00 2001 From: "Kozlov, Alexey" Date: Wed, 10 Nov 2021 21:29:13 +0300 Subject: [PATCH 3/4] Fixing build issue on Linux Details: using multiple channels (main, anaconda, conda-forge) in a conda build, causes older version of kernel-headers_linux-64 to be resolved, as newer version fails dependency resolution to meet glibc >=2.17 requirement (that seems to be deps resolution problem). As a result 'old' system headers used together with c++17 flag leads to broken build due to not declared '::timespec_get' in ctime.h. --- buildscripts/build.py | 2 +- buildscripts/utilities.py | 2 +- conda-recipe/meta.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildscripts/build.py b/buildscripts/build.py index 51ea35e5f..1dbc8e13b 100644 --- a/buildscripts/build.py +++ b/buildscripts/build.py @@ -72,6 +72,6 @@ def build(sdc_utils): sdc_env_packages += ['conda-verify', 'vc', 'vs2015_runtime', 'vs2015_win-64', 'pywin32=223'] # Install conda-build and other packages from anaconda channel due to issue with wheel # output build if use intel channels first - sdc_utils.create_environment(sdc_env_packages + ['-c', 'anaconda']) + sdc_utils.create_environment(sdc_env_packages) build(sdc_utils) diff --git a/buildscripts/utilities.py b/buildscripts/utilities.py index cf770b6dd..6b5cff2d8 100644 --- a/buildscripts/utilities.py +++ b/buildscripts/utilities.py @@ -51,7 +51,7 @@ def __init__(self, python, channels=None, sdc_channel=None): self.line_single = '-'*80 # Set channels - build_channels = ['-c', 'defaults', '-c', 'conda-forge'] + build_channels = ['-c', 'main', '-c', 'conda-forge', '-c', 'defaults'] self.channel_list = build_channels if channels is None else channels.split() if sdc_channel: self.sdc_channel = Path(sdc_channel).resolve().as_uri() diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 20b9894e8..f2740d92a 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -19,7 +19,7 @@ requirements: build: - {{ compiler('c') }} # [not osx] - {{ compiler('cxx') }} # [not osx] - - numba {{ NUMBA_VERSION }} + - sysroot_linux-64 >=2.17 # [linux] host: - python From b631d149c55ba5cfc2405aca012748f017103dd3 Mon Sep 17 00:00:00 2001 From: "Kozlov, Alexey" Date: Sat, 13 Nov 2021 18:58:38 +0300 Subject: [PATCH 4/4] Updating compiler flags for OSX to resolve build issue --- setup.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.py b/setup.py index d5ecdfa86..f3c8abbfb 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,7 @@ np_compile_args = np_misc.get_info('npymath') is_win = platform.system() == 'Windows' +is_osx = platform.system() == 'Darwin' def readme(): @@ -108,6 +109,7 @@ def check_file_at_path(path2file): tbb_root = os.getenv('TBBROOT') if not tbb_root: tbb_root = check_file_at_path(['include', 'tbb', 'tbb.h']) + assert tbb_root, "TBB headers required to build SDC not found" ind = [PREFIX_DIR + '/include', ] lid = [PREFIX_DIR + '/lib', ] @@ -119,6 +121,10 @@ def check_file_at_path(path2file): eca = ['-std=c++17', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1", ] # '-g', '-O0'] ela = [] + # On macOS, c++17 flag is ignored unless this flag is also passed to distutils + if is_osx: + eca += ["-fno-aligned-allocation"] + io_libs = [] ext_io = Extension(name="sdc.hio",