From 3ff483a1bb11c95a68b632c0bc4d58bbae3bcb30 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 10 Feb 2021 08:58:21 -0800 Subject: [PATCH 1/4] install old g++ --- .github/workflows/build-and-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 61512db..3e54b69 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -66,9 +66,12 @@ jobs: - uses: actions/checkout@v2 - name: "apt-get install ${{ matrix.cmp }}" run: | + export GCC_NAME="${{ matrix.cmp }}" + sudo apt-get update sudo apt-get -y install software-properties-common sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get -y install ${{ matrix.cmp }} + sudo apt-get update + sudo apt-get -y install g++-${GCC_NAME#gcc-} - name: Prepare and compile dependencies run: python cue.py prepare - name: Build main module (example app) From 9183238f9dd72452db5e93c4c4d6778f000ccdb7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 10 Feb 2021 09:18:43 -0800 Subject: [PATCH 2/4] Revert "test: fix test_HostArchConfiguration on Windows" This reverts commit e7b1214d09115d200e16b683c262f0e371f9d7b3. --- cue-test.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/cue-test.py b/cue-test.py index edeea05..562a6bd 100644 --- a/cue-test.py +++ b/cue-test.py @@ -725,11 +725,7 @@ class TestSetupForBuild(unittest.TestCase): @unittest.skipIf(ci_os != 'windows', 'HostArchConfiguration test only applies to windows') def test_HostArchConfiguration(self): - # there is no combined static and debug EPICS_HOST_ARCH target, - # so a combined debug and static target will appear to be just static - # but debug will have been specified in CONFIG_SITE by prepare() cue.ci['compiler'] = 'vs2017' - cue.ci['compiler-class'] = 'vs' for cue.ci['debug'] in [True, False]: for cue.ci['static'] in [True, False]: config_st = {True: 'static', False: 'shared'} @@ -739,15 +735,11 @@ class TestSetupForBuild(unittest.TestCase): self.assertTrue('EPICS_HOST_ARCH' in os.environ, 'EPICS_HOST_ARCH is not set for Configuration={0}'.format(config)) if cue.ci['static']: - # static plus anything must be *-static and not *-debug self.assertTrue(re.search('-static$', os.environ['EPICS_HOST_ARCH']), - 'EPICS_HOST_ARCH (found {0}) is not -static for Configuration={1}' - .format(os.environ['EPICS_HOST_ARCH'], config)) + 'EPICS_HOST_ARCH is not -static for Configuration={0}'.format(config)) self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']), - 'EPICS_HOST_ARCH (found {0}) is -debug for Configuration={1}' - .format(os.environ['EPICS_HOST_ARCH'], config)) + 'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config)) elif cue.ci['debug']: - # debug (and not static) must be *-debug and not *-static self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is -static for Configuration={1}' .format(os.environ['EPICS_HOST_ARCH'], config)) @@ -755,7 +747,6 @@ class TestSetupForBuild(unittest.TestCase): 'EPICS_HOST_ARCH (found {0}) is not -debug for Configuration={1}' .format(os.environ['EPICS_HOST_ARCH'], config)) else: - # not debug and not static self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH is -static for Configuration={0}'.format(config)) self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']), From b047a6c641cb4473ba8c2484efcf3640009e7f9a Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 10 Feb 2021 09:18:45 -0800 Subject: [PATCH 3/4] Revert "Add compiler-class and compiler-suffix as config" This reverts commit 2016cb2ae721256ff685533a55039b6143040686. --- cue.py | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/cue.py b/cue.py index 798b75d..a94da2a 100644 --- a/cue.py +++ b/cue.py @@ -98,9 +98,6 @@ def detect_context(): if 'BCFG' in os.environ: buildconfig = os.environ['BCFG'].lower() - ci['compiler-suffix'] = re.sub(r'^.*?(-[0-9.]+|)$', r'\1', ci['compiler']) - ci['compiler-class'] = re.sub(r'^([^0-9.-]*).*?$', r'\1', ci['compiler']) - if re.search('static', buildconfig): ci['static'] = True if re.search('debug', buildconfig): @@ -618,7 +615,7 @@ def add_dependency(dep): def detect_epics_host_arch(): if ci['os'] == 'windows': - if ci['compiler-class'] == 'vs': + if re.match(r'^vs', ci['compiler']): # there is no combined static and debug EPICS_HOST_ARCH target, # so a combined debug and static target will appear to be just static # but debug will have been specified in CONFIG_SITE by prepare() @@ -633,7 +630,7 @@ def detect_epics_host_arch(): elif ci['platform'] == 'x64': os.environ['EPICS_HOST_ARCH'] = 'windows-x64' + hostarchsuffix - elif ci['compiler-class'] == 'gcc': + elif ci['compiler'] == 'gcc': if ci['platform'] == 'x86': os.environ['EPICS_HOST_ARCH'] = 'win32-x86-mingw' elif ci['platform'] == 'x64': @@ -669,7 +666,7 @@ def setup_for_build(args): r'C:\Strawberry\perl\bin', os.environ['PATH']]) - if ci['service'] == 'appveyor' and ci['compiler-class'] == 'gcc': + if ci['service'] == 'appveyor' and ci['compiler'] == 'gcc': logger.debug('Adding AppVeyor MSYS2/MinGW installation to PATH and INCLUDE') if 'INCLUDE' not in os.environ: os.environ['INCLUDE'] = '' @@ -835,7 +832,7 @@ def prepare(args): .format(optitype, linktype)) # Enable/fix parallel build for VisualStudio compiler on older Base versions - if ci['os'] == 'windows' and ci['compiler-class'] == 'vs': + if ci['os'] == 'windows' and re.match(r'^vs', ci['compiler']): add_vs_fix = True config_win = os.path.join(places['EPICS_BASE'], 'configure', 'os', 'CONFIG.win32-x86.win32-x86') with open(config_win) as f: @@ -906,32 +903,33 @@ CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386{0}'''.format(qemu_suffix)) print('Host compiler', ci['compiler']) - if ci['compiler-class'] == 'clang': + if ci['compiler'].startswith('clang'): with open(os.path.join(places['EPICS_BASE'], 'configure', 'os', - 'CONFIG_SITE.{0}.{0}'.format(os.environ['EPICS_HOST_ARCH'])), 'a') as f: + 'CONFIG_SITE.Common.'+os.environ['EPICS_HOST_ARCH']), 'a') as f: f.write(''' -GNU = NO -CMPLR_CLASS = clang -CC = clang -CCC = clang++''') - if ci['compiler-suffix']: - f.write(''' -CMPLR_SUFFIX = {0}'''.format(ci['compiler-suffix'])) +GNU = NO +CMPLR_CLASS = clang +CC = {0} +CCC = {1}'''.format(ci['compiler'], + re.sub(r'clang', r'clang++', ci['compiler']))) - elif ci['compiler-class'] == 'gcc': + # hack + with open(os.path.join(places['EPICS_BASE'], 'configure', 'CONFIG.gnuCommon'), 'a') as f: + f.write(''' +CMPLR_CLASS = clang''') + + elif ci['compiler'].startswith('gcc'): with open(os.path.join(places['EPICS_BASE'], 'configure', 'os', - 'CONFIG_SITE.{0}.{0}'.format(os.environ['EPICS_HOST_ARCH'])), 'a') as f: + 'CONFIG_SITE.Common.' + os.environ['EPICS_HOST_ARCH']), 'a') as f: f.write(''' -CMPLR_CLASS = gcc''') - if ci['compiler-suffix']: - f.write(''' -CMPLR_SUFFIX = {0}'''.format(ci['compiler-suffix'])) +CC = {0} +CCC = {1}'''.format(ci['compiler'], re.sub(r'gcc', r'g++', ci['compiler']))) - elif ci['compiler-class'] =='vs': + elif ci['compiler'].startswith('vs'): pass # nothing special else: - raise ValueError('Unknown compiler name {0}. Valid forms include: gcc, gcc-4.8, clang, vs2019'.format(ci['compiler'])) + raise ValueError('Unknown compiler name {0}. valid forms include: gcc, gcc-4.8, clang, vs2019'.format(ci['compiler'])) # Add additional settings to CONFIG_SITE extra_config = '' @@ -998,7 +996,7 @@ PERL = C:/Strawberry/perl/bin/perl -CSD''' sys.stdout.flush() sp.check_call(['perl', '--version']) - if ci['compiler-class'] == 'vs': + if re.match(r'^vs', ci['compiler']): print('{0}$ cl{1}'.format(ANSI_CYAN, ANSI_RESET)) sys.stdout.flush() sp.check_call(['cl']) @@ -1164,7 +1162,7 @@ def main(raw): prepare_env() detect_context() - if args.vcvars and ci['compiler-class'] == 'vs': + if args.vcvars and ci['compiler'].startswith('vs'): # re-exec with MSVC in PATH with_vcvars(' '.join(['--no-vcvars'] + raw)) else: From c734d558c262cccc42c31c27073849a340069ca2 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 10 Feb 2021 09:37:58 -0800 Subject: [PATCH 4/4] print c++ compiler version also ensures that the separate g++... binary is present. --- cue.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cue.py b/cue.py index a94da2a..4b8721b 100644 --- a/cue.py +++ b/cue.py @@ -903,15 +903,16 @@ CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386{0}'''.format(qemu_suffix)) print('Host compiler', ci['compiler']) + cxx = None if ci['compiler'].startswith('clang'): + cxx = re.sub(r'clang', r'clang++', ci['compiler']) with open(os.path.join(places['EPICS_BASE'], 'configure', 'os', 'CONFIG_SITE.Common.'+os.environ['EPICS_HOST_ARCH']), 'a') as f: f.write(''' GNU = NO CMPLR_CLASS = clang CC = {0} -CCC = {1}'''.format(ci['compiler'], - re.sub(r'clang', r'clang++', ci['compiler']))) +CCC = {1}'''.format(ci['compiler'], cxx)) # hack with open(os.path.join(places['EPICS_BASE'], 'configure', 'CONFIG.gnuCommon'), 'a') as f: @@ -919,11 +920,12 @@ CCC = {1}'''.format(ci['compiler'], CMPLR_CLASS = clang''') elif ci['compiler'].startswith('gcc'): + cxx = re.sub(r'gcc', r'g++', ci['compiler']) with open(os.path.join(places['EPICS_BASE'], 'configure', 'os', 'CONFIG_SITE.Common.' + os.environ['EPICS_HOST_ARCH']), 'a') as f: f.write(''' CC = {0} -CCC = {1}'''.format(ci['compiler'], re.sub(r'gcc', r'g++', ci['compiler']))) +CCC = {1}'''.format(ci['compiler'], cxx)) elif ci['compiler'].startswith('vs'): pass # nothing special @@ -1005,6 +1007,10 @@ PERL = C:/Strawberry/perl/bin/perl -CSD''' print('{0}$ {1} --version{2}'.format(ANSI_CYAN, cc, ANSI_RESET)) sys.stdout.flush() sp.check_call([cc, '--version']) + if cxx: + print('{0}$ {1} --version{2}'.format(ANSI_CYAN, cxx, ANSI_RESET)) + sys.stdout.flush() + sp.check_call([cxx, '--version']) if logging.getLogger().isEnabledFor(logging.DEBUG): log_modified()