Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit d07a81a

Browse files
Update compiler dialect flags to use C++17 (#970)
* Update compiler dialect flags to use C++17 * More needed debug options * 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. * Updating compiler flags for OSX to resolve build issue
1 parent da14ea0 commit d07a81a

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

buildscripts/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ def build(sdc_utils):
7272
sdc_env_packages += ['conda-verify', 'vc', 'vs2015_runtime', 'vs2015_win-64', 'pywin32=223']
7373
# Install conda-build and other packages from anaconda channel due to issue with wheel
7474
# output build if use intel channels first
75-
sdc_utils.create_environment(sdc_env_packages + ['-c', 'anaconda'])
75+
sdc_utils.create_environment(sdc_env_packages)
7676

7777
build(sdc_utils)

buildscripts/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, python, channels=None, sdc_channel=None):
5151
self.line_single = '-'*80
5252

5353
# Set channels
54-
build_channels = ['-c', 'defaults', '-c', 'conda-forge']
54+
build_channels = ['-c', 'main', '-c', 'conda-forge', '-c', 'defaults']
5555
self.channel_list = build_channels if channels is None else channels.split()
5656
if sdc_channel:
5757
self.sdc_channel = Path(sdc_channel).resolve().as_uri()

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requirements:
1919
build:
2020
- {{ compiler('c') }} # [not osx]
2121
- {{ compiler('cxx') }} # [not osx]
22-
- numba {{ NUMBA_VERSION }}
22+
- sysroot_linux-64 >=2.17 # [linux]
2323

2424
host:
2525
- python

setup.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
np_compile_args = np_misc.get_info('npymath')
4949

5050
is_win = platform.system() == 'Windows'
51+
is_osx = platform.system() == 'Darwin'
5152

5253

5354
def readme():
@@ -108,11 +109,21 @@ def check_file_at_path(path2file):
108109
tbb_root = os.getenv('TBBROOT')
109110
if not tbb_root:
110111
tbb_root = check_file_at_path(['include', 'tbb', 'tbb.h'])
112+
assert tbb_root, "TBB headers required to build SDC not found"
111113

112114
ind = [PREFIX_DIR + '/include', ]
113115
lid = [PREFIX_DIR + '/lib', ]
114-
eca = ['-std=c++11', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1"] # '-g', '-O0']
115-
ela = ['-std=c++11', ]
116+
117+
if is_win:
118+
eca = ['/std:c++17', "/Ox", "/DTBB_PREVIEW_WAITING_FOR_WORKERS=1", ] # "/Zi", "/Od", "/DEBUG:FULL"]
119+
ela = [] # '/DEBUG:FULL', ]
120+
else:
121+
eca = ['-std=c++17', "-O3", "-DTBB_PREVIEW_WAITING_FOR_WORKERS=1", ] # '-g', '-O0']
122+
ela = []
123+
124+
# On macOS, c++17 flag is ignored unless this flag is also passed to distutils
125+
if is_osx:
126+
eca += ["-fno-aligned-allocation"]
116127

117128
io_libs = []
118129

@@ -202,8 +213,8 @@ def check_file_at_path(path2file):
202213
sources=["sdc/_datetime_ext.cpp"],
203214
libraries=np_compile_args['libraries'],
204215
define_macros=np_compile_args['define_macros'],
205-
extra_compile_args=['-std=c++11'],
206-
extra_link_args=['-std=c++11'],
216+
extra_compile_args=eca,
217+
extra_link_args=ela,
207218
include_dirs=np_compile_args['include_dirs'],
208219
library_dirs=np_compile_args['library_dirs'],
209220
language="c++"

0 commit comments

Comments
 (0)