Language-specific PIC flags (#15474)
* Language-specific PIC flags * Add tests for every compiler flag * Fix bad rebase * pic_flag -> cxx_pic_flag
This commit is contained in:
@@ -133,7 +133,7 @@ def configure_args(self):
|
||||
|
||||
extra_args = [
|
||||
# required, otherwise building its python bindings will fail
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag)
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag)
|
||||
]
|
||||
|
||||
extra_args += self.enable_or_disable('shared')
|
||||
|
@@ -371,7 +371,7 @@ def determine_b2_options(self, spec, options):
|
||||
cxxflags.append(flag)
|
||||
|
||||
if '+pic' in self.spec:
|
||||
cxxflags.append(self.compiler.pic_flag)
|
||||
cxxflags.append(self.compiler.cxx_pic_flag)
|
||||
|
||||
# clang is not officially supported for pre-compiled headers
|
||||
# and at least in clang 3.9 still fails to build
|
||||
|
@@ -59,7 +59,7 @@ def build_args(self, spec, prefix):
|
||||
'CC={0}'.format(spack_cc),
|
||||
'CXX={0}'.format(spack_cxx),
|
||||
'FORTRAN={0}'.format(spack_fc),
|
||||
'cc_flags={0}'.format(self.compiler.pic_flag),
|
||||
'cc_flags={0}'.format(self.compiler.cc_pic_flag),
|
||||
# Allow Spack environment variables to propagate through to SCons
|
||||
'env_vars=all'
|
||||
]
|
||||
|
@@ -56,7 +56,7 @@ def configure_args(self):
|
||||
args = []
|
||||
cookie = self.spec.variants['gni-cookie'].value
|
||||
ptag = self.spec.variants['ptag'].value
|
||||
args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
|
||||
args.append('CFLAGS={0}'.format(self.compiler.cc_pic_flag))
|
||||
if self.spec.satisfies('+dimes'):
|
||||
args.append('--enable-dimes')
|
||||
if self.spec.satisfies('+cray-drc'):
|
||||
|
@@ -31,7 +31,7 @@ def edit(self, spec, prefix):
|
||||
makefile = FileFilter('Makefile')
|
||||
makefile.filter('CC=.*',
|
||||
'CC={0} {1}'.format(spack_cc,
|
||||
self.compiler.pic_flag))
|
||||
self.compiler.cc_pic_flag))
|
||||
makefile.filter('CFLAGS=.*', 'CFLAGS={0}'.format(cflags))
|
||||
makefile.filter('PREFIX=.*', 'PREFIX={0}'.format(self.prefix))
|
||||
p = self.spec['libzmq'].prefix
|
||||
|
@@ -61,8 +61,8 @@ def cmake_args(self):
|
||||
|
||||
if '+pic' in spec:
|
||||
args.extend([
|
||||
'-DCMAKE_C_FLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'-DCMAKE_CXX_FLAGS={0}'.format(self.compiler.pic_flag)
|
||||
'-DCMAKE_C_FLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'-DCMAKE_CXX_FLAGS={0}'.format(self.compiler.cxx_pic_flag)
|
||||
])
|
||||
|
||||
args.append('-DCMAKE_CXX_STANDARD={0}'.format(
|
||||
|
@@ -60,8 +60,8 @@ def configure_args(self):
|
||||
'--with-segment-mmap-max=%s '
|
||||
% (self.spec.variants['segment-mmap-max'].value),
|
||||
# for consumers with shared libs
|
||||
'CC=%s %s' % (spack_cc, self.compiler.pic_flag),
|
||||
'CXX=%s %s' % (spack_cxx, self.compiler.pic_flag),
|
||||
"CC=%s %s" % (spack_cc, self.compiler.cc_pic_flag),
|
||||
"CXX=%s %s" % (spack_cxx, self.compiler.cxx_pic_flag),
|
||||
]
|
||||
|
||||
if '+aligned-segments' in self.spec:
|
||||
@@ -80,7 +80,7 @@ def configure_args(self):
|
||||
'--disable-ibv',
|
||||
'--disable-seq',
|
||||
'MPI_CC=%s %s'
|
||||
% (self.spec['mpi'].mpicc, self.compiler.pic_flag)])
|
||||
% (self.spec['mpi'].mpicc, self.compiler.cc_pic_flag)])
|
||||
|
||||
if '+ibv' in self.spec:
|
||||
args.extend(['--enable-ibv',
|
||||
|
@@ -35,7 +35,7 @@ def configure_args(self):
|
||||
spec = self.spec
|
||||
|
||||
config_args = [
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'--with-jpeg={0}'.format(spec['jpeg'].prefix),
|
||||
'--with-zlib={0}'.format(spec['zlib'].prefix),
|
||||
'--disable-netcdf', # must be disabled to build NetCDF with HDF4
|
||||
|
@@ -259,8 +259,11 @@ def configure_args(self):
|
||||
extra_args.append('--enable-static-exec')
|
||||
|
||||
if '+pic' in self.spec:
|
||||
extra_args += ['%s=%s' % (f, self.compiler.pic_flag)
|
||||
for f in ['CFLAGS', 'CXXFLAGS', 'FCFLAGS']]
|
||||
extra_args.extend([
|
||||
'CFLAGS=' + self.compiler.cc_pic_flag,
|
||||
'CXXFLAGS=' + self.compiler.cxx_pic_flag,
|
||||
'FCFLAGS=' + self.compiler.fc_pic_flag,
|
||||
])
|
||||
|
||||
if '+mpi' in self.spec:
|
||||
# The HDF5 configure script warns if cxx and mpi are enabled
|
||||
|
@@ -81,7 +81,7 @@ def common_make_opts(self):
|
||||
if '+cuda' in spec:
|
||||
makeopts += ['CUDA_DIR=%s' % spec['cuda'].prefix]
|
||||
nvccflags = ['-ccbin %s -Xcompiler "%s" -Xcompiler %s' %
|
||||
(compiler.cxx, opt, compiler.pic_flag)]
|
||||
(compiler.cxx, opt, compiler.cc_pic_flag)]
|
||||
nvccflags = ' '.join(nvccflags)
|
||||
makeopts += ['NVCCFLAGS=%s' % nvccflags]
|
||||
else:
|
||||
|
@@ -48,7 +48,7 @@ def flag_handler(self, name, flags):
|
||||
flags.append('-O2')
|
||||
|
||||
if '+pic' in self.spec:
|
||||
flags.append(self.compiler.pic_flag)
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
|
||||
return (None, None, flags)
|
||||
|
||||
|
@@ -56,7 +56,7 @@ def install(self, spec, prefix):
|
||||
spec['ncurses'].prefix.lib),
|
||||
'MYLIBS=-lncursesw',
|
||||
'CC=%s -std=gnu99 %s' % (spack_cc,
|
||||
self.compiler.pic_flag),
|
||||
self.compiler.cc_pic_flag),
|
||||
target)
|
||||
make('INSTALL_TOP=%s' % prefix,
|
||||
'install')
|
||||
|
@@ -40,6 +40,6 @@ def flag_handler(self, name, flags):
|
||||
|
||||
# Compile with PIC, if requested.
|
||||
if name == 'cflags' and '+pic' in self.spec:
|
||||
flags.append(self.compiler.pic_flag)
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
|
||||
return (flags, None, None)
|
||||
|
@@ -79,7 +79,7 @@ def install(self, spec, prefix):
|
||||
# Process library spec and options
|
||||
options = []
|
||||
if '+shared' in spec:
|
||||
options.append('COPTIONS={0}'.format(self.compiler.pic_flag))
|
||||
options.append('COPTIONS={0}'.format(self.compiler.cc_pic_flag))
|
||||
if spec.variants['build_type'].value == 'Debug':
|
||||
options.append('OPTFLAGS=-g -O0')
|
||||
make(*options)
|
||||
@@ -107,7 +107,7 @@ def install(self, spec, prefix):
|
||||
install(sharefile, prefix.share)
|
||||
|
||||
if '+shared' in spec:
|
||||
shared_flags = [self.compiler.pic_flag, '-shared']
|
||||
shared_flags = [self.compiler.cc_pic_flag, '-shared']
|
||||
if sys.platform == 'darwin':
|
||||
shared_suffix = 'dylib'
|
||||
shared_flags.extend(['-Wl,-all_load', 'libmetis.a'])
|
||||
|
@@ -307,7 +307,9 @@ def find_optional_library(name, prefix):
|
||||
if '~static' in spec:
|
||||
options += ['STATIC=NO']
|
||||
if '+shared' in spec:
|
||||
options += ['SHARED=YES', 'PICFLAG=%s' % self.compiler.pic_flag]
|
||||
options += [
|
||||
'SHARED=YES', 'PICFLAG=%s' % self.compiler.cxx_pic_flag
|
||||
]
|
||||
|
||||
if '+mpi' in spec:
|
||||
options += ['MPICXX=%s' % spec['mpi'].mpicxx]
|
||||
|
@@ -125,7 +125,8 @@ def write_makefile_inc(self):
|
||||
# when building shared libs need -fPIC, otherwise
|
||||
# /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1'
|
||||
# can not be used when making a shared object; recompile with -fPIC
|
||||
fpic = self.compiler.pic_flag if '+shared' in self.spec else ''
|
||||
cpic = self.compiler.cc_pic_flag if '+shared' in self.spec else ''
|
||||
fpic = self.compiler.fc_pic_flag if '+shared' in self.spec else ''
|
||||
# TODO: test this part, it needs a full blas, scalapack and
|
||||
# partitionning environment with 64bit integers
|
||||
|
||||
@@ -146,8 +147,8 @@ def write_makefile_inc(self):
|
||||
])
|
||||
|
||||
makefile_conf.extend([
|
||||
'OPTL = %s -O%s' % (fpic, opt_level),
|
||||
'OPTC = %s -O%s -DINTSIZE64' % (fpic, opt_level)
|
||||
'OPTL = %s -O%s' % (cpic, opt_level),
|
||||
'OPTC = %s -O%s -DINTSIZE64' % (cpic, opt_level)
|
||||
])
|
||||
else:
|
||||
if using_xlf:
|
||||
@@ -157,8 +158,8 @@ def write_makefile_inc(self):
|
||||
fpic, opt_level))
|
||||
|
||||
makefile_conf.extend([
|
||||
'OPTL = %s -O%s' % (fpic, opt_level),
|
||||
'OPTC = %s -O%s' % (fpic, opt_level)
|
||||
'OPTL = %s -O%s' % (cpic, opt_level),
|
||||
'OPTC = %s -O%s' % (cpic, opt_level)
|
||||
])
|
||||
|
||||
if '+mpi' in self.spec:
|
||||
|
@@ -28,7 +28,7 @@ def url_for_version(self, version):
|
||||
def configure_args(self):
|
||||
return [
|
||||
# ADIOS build with -fPIC, so we need it too (avoid linkage issue)
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
# Default is non-shared, but avoid any future surprises
|
||||
'--disable-shared',
|
||||
]
|
||||
|
@@ -40,8 +40,10 @@ def setup_build_environment(self, env):
|
||||
env.unset('TERMINFO')
|
||||
|
||||
def flag_handler(self, name, flags):
|
||||
if name == 'cflags' or name == 'cxxflags':
|
||||
flags.append(self.compiler.pic_flag)
|
||||
if name == 'cflags':
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
elif name == 'cxxflags':
|
||||
flags.append(self.compiler.cxx_pic_flag)
|
||||
|
||||
return (flags, None, None)
|
||||
|
||||
|
@@ -158,7 +158,7 @@ def configure_args(self):
|
||||
if '~shared' in self.spec or '+pic' in self.spec:
|
||||
# We don't have shared libraries but we still want it to be
|
||||
# possible to use this library in shared builds
|
||||
cflags.append(self.compiler.pic_flag)
|
||||
cflags.append(self.compiler.cc_pic_flag)
|
||||
|
||||
config_args += self.enable_or_disable('dap')
|
||||
# config_args += self.enable_or_disable('cdmremote')
|
||||
|
@@ -44,7 +44,7 @@ class NetcdfCxx4(AutotoolsPackage):
|
||||
|
||||
def flag_handler(self, name, flags):
|
||||
if name == 'cflags' and '+pic' in self.spec:
|
||||
flags.append(self.compiler.pic_flag)
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
elif name == 'cppflags':
|
||||
flags.append('-I' + self.spec['netcdf-c'].prefix.include)
|
||||
|
||||
|
@@ -64,12 +64,16 @@ class NetcdfFortran(AutotoolsPackage):
|
||||
def flag_handler(self, name, flags):
|
||||
config_flags = None
|
||||
|
||||
if name in ['cflags', 'fflags'] and '+pic' in self.spec:
|
||||
if '+pic' in self.spec:
|
||||
# Unlike NetCDF-C, we add PIC flag only when +pic. Adding the
|
||||
# flags also when ~shared would make it impossible to build a
|
||||
# static-only version of the library with NAG.
|
||||
config_flags = [self.compiler.pic_flag]
|
||||
elif name == 'cppflags':
|
||||
if name == 'cflags':
|
||||
config_flags = [self.compiler.cc_pic_flag]
|
||||
elif name == 'fflags':
|
||||
config_flags = [self.compiler.f77_pic_flag]
|
||||
|
||||
if name == 'cppflags':
|
||||
config_flags = [self.spec['netcdf-c'].headers.cpp_flags]
|
||||
elif name == 'ldflags':
|
||||
# We need to specify LDFLAGS to get correct dependency_libs
|
||||
|
@@ -78,8 +78,8 @@ def cmake_args(self):
|
||||
|
||||
if '+pic' in spec:
|
||||
options.extend([
|
||||
"-DCMAKE_C_FLAGS=%s" % self.compiler.pic_flag,
|
||||
"-DCMAKE_Fortran_FLAGS=%s" % self.compiler.pic_flag
|
||||
"-DCMAKE_C_FLAGS=%s" % self.compiler.cc_pic_flag,
|
||||
"-DCMAKE_Fortran_FLAGS=%s" % self.compiler.fc_pic_flag
|
||||
])
|
||||
|
||||
return options
|
||||
|
@@ -123,7 +123,7 @@ def get_compiler_options(self, spec):
|
||||
flags = '-O3 -qtune=qp -qarch=qp -q64 -qstrict -qnohot -g'
|
||||
|
||||
if self.spec.satisfies('%pgi'):
|
||||
flags += ' ' + self.compiler.pic_flag
|
||||
flags += ' ' + self.compiler.cc_pic_flag
|
||||
|
||||
return ['CFLAGS=%s' % flags,
|
||||
'CXXFLAGS=%s' % flags]
|
||||
|
@@ -231,8 +231,8 @@ def make_defs(self):
|
||||
if '~shared' in self.spec:
|
||||
if '+pic' in self.spec:
|
||||
make_defs.extend([
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'FFLAGS={0}'.format(self.compiler.pic_flag)
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'FFLAGS={0}'.format(self.compiler.f77_pic_flag)
|
||||
])
|
||||
make_defs += ['NO_SHARED=1']
|
||||
# fix missing _dggsvd_ and _sggsvd_
|
||||
|
@@ -31,7 +31,7 @@ def configure_args(self):
|
||||
'CXX={0}'.format(spack_cxx),
|
||||
'F77={0}'.format(spack_f77),
|
||||
'FC={0}'.format(spack_fc),
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'CXXFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'PYTHON_FOR_GENERATOR=:'
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'CXXFLAGS={0}'.format(self.compiler.cxx_pic_flag),
|
||||
'PYTHON_FOR_GENERATOR=:',
|
||||
]
|
||||
|
@@ -96,8 +96,12 @@ def configure_args(self):
|
||||
args += self.enable_or_disable('fortran')
|
||||
|
||||
if '+pic' in self.spec:
|
||||
args.extend(['{0}FLAGS={1}'.format(lang, self.compiler.pic_flag)
|
||||
for lang in ['C', 'CXX', 'F', 'FC']])
|
||||
args.extend([
|
||||
'CFLAGS=' + self.compiler.cc_pic_flag,
|
||||
'CXXFLAGS=' + self.compiler.cxx_pic_flag,
|
||||
'FFLAGS=' + self.compiler.f77_pic_flag,
|
||||
'FCFLAGS=' + self.compiler.fc_pic_flag,
|
||||
])
|
||||
|
||||
if self.version >= Version('1.8'):
|
||||
args.append('--enable-relax-coord-bound')
|
||||
|
@@ -28,8 +28,8 @@ class Parmgridgen(Package):
|
||||
def install(self, spec, prefix):
|
||||
make_opts = [
|
||||
'make=make',
|
||||
'COPTIONS={0}'.format(self.compiler.pic_flag),
|
||||
'LDOPTIONS={0}'.format(self.compiler.pic_flag),
|
||||
'COPTIONS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'LDOPTIONS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'CC={0}'.format(self.compiler.cc),
|
||||
'LD={0}'.format(self.compiler.cc),
|
||||
'LIBDIR=-L../..',
|
||||
|
@@ -36,6 +36,9 @@ def cmake_args(self):
|
||||
|
||||
def flag_handler(self, name, flags):
|
||||
flags = list(flags)
|
||||
if '+pic' in self.spec and name in ('cflags', 'cxxflags'):
|
||||
flags.append(self.compiler.pic_flag)
|
||||
if '+pic' in self.spec:
|
||||
if name == 'cflags':
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
elif name == 'cxxflags':
|
||||
flags.append(self.compiler.cxx_pic_flag)
|
||||
return (None, None, flags)
|
||||
|
@@ -53,7 +53,7 @@ def configure(self, spec, prefix):
|
||||
raise InstallError('Unknown/unsupported compiler family')
|
||||
|
||||
if '+pic' in spec:
|
||||
options.append('-useropt=' + self.compiler.pic_flag)
|
||||
options.append('-useropt=' + self.compiler.cxx_pic_flag)
|
||||
|
||||
configure(*options)
|
||||
|
||||
|
@@ -131,7 +131,8 @@ def configure_args(self):
|
||||
# https://github.com/spack/spack/pull/3081 and
|
||||
# https://github.com/spack/spack/pull/4416
|
||||
if spec.satisfies('%intel'):
|
||||
config_args.append('-Accflags={0}'.format(self.compiler.pic_flag))
|
||||
config_args.append('-Accflags={0}'.format(
|
||||
self.compiler.cc_pic_flag))
|
||||
|
||||
if '+shared' in spec:
|
||||
config_args.append('-Duseshrplib')
|
||||
|
@@ -33,4 +33,5 @@ class PyLlvmlite(PythonPackage):
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
# Need to set PIC flag since this is linking statically with LLVM
|
||||
env.set('CXX_FLTO_FLAGS', '-flto {0}'.format(self.compiler.pic_flag))
|
||||
env.set('CXX_FLTO_FLAGS', '-flto {0}'.format(
|
||||
self.compiler.cxx_pic_flag))
|
||||
|
@@ -280,7 +280,7 @@ def configure_args(self):
|
||||
config_args.append('--without-ensurepip')
|
||||
|
||||
if '+pic' in spec:
|
||||
config_args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
|
||||
config_args.append('CFLAGS={0}'.format(self.compiler.cc_pic_flag))
|
||||
|
||||
if spec.satisfies('@3.7:'):
|
||||
if '+ssl' in spec:
|
||||
|
@@ -163,7 +163,8 @@ def configure_args(self):
|
||||
|
||||
# Set FPICFLAGS for compilers except 'gcc'.
|
||||
if self.compiler.name != 'gcc':
|
||||
config_args.append('FPICFLAGS={0}'.format(self.compiler.pic_flag))
|
||||
config_args.append('FPICFLAGS={0}'.format(
|
||||
self.compiler.cc_pic_flag))
|
||||
|
||||
return config_args
|
||||
|
||||
|
@@ -106,8 +106,8 @@ def configure_args(self):
|
||||
config_args.append('--with-mpi=openmpi')
|
||||
|
||||
config_args.extend([
|
||||
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||
'CXXFLAGS={0}'.format(self.compiler.pic_flag)
|
||||
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
|
||||
'CXXFLAGS={0}'.format(self.compiler.cxx_pic_flag)
|
||||
])
|
||||
|
||||
if "+mpi" in spec:
|
||||
|
@@ -117,7 +117,7 @@ def configure(self):
|
||||
makefile_inc.extend([
|
||||
'LIB = .dylib',
|
||||
'CLIBFLAGS = -dynamiclib {0}'.format(
|
||||
self.compiler.pic_flag
|
||||
self.compiler.cc_pic_flag
|
||||
),
|
||||
'RANLIB = echo',
|
||||
'AR = $(CC)',
|
||||
@@ -126,12 +126,13 @@ def configure(self):
|
||||
else:
|
||||
makefile_inc.extend([
|
||||
'LIB = .so',
|
||||
'CLIBFLAGS = -shared {0}'.format(self.compiler.pic_flag),
|
||||
'CLIBFLAGS = -shared {0}'.format(
|
||||
self.compiler.cc_pic_flag),
|
||||
'RANLIB = echo',
|
||||
'AR = $(CC)',
|
||||
'ARFLAGS = -shared $(LDFLAGS) -o'
|
||||
])
|
||||
cflags.append(self.compiler.pic_flag)
|
||||
cflags.append(self.compiler.cc_pic_flag)
|
||||
else:
|
||||
makefile_inc.extend([
|
||||
'LIB = .a',
|
||||
|
@@ -31,7 +31,7 @@ def makeopts(self, spec, prefix):
|
||||
return [
|
||||
"F95={0}".format(self.compiler.fc),
|
||||
("F95FLAGS={0} -O3 -std=f2003 -ffast-math".
|
||||
format(self.compiler.pic_flag)),
|
||||
format(self.compiler.fc_pic_flag)),
|
||||
"OPENMPFLAGS={0}".format(self.compiler.openmp_flag),
|
||||
"BLAS={0}".format(spec['blas'].libs),
|
||||
"FFTW={0}".format(spec['fftw'].libs),
|
||||
|
@@ -45,9 +45,14 @@ def flag_handler(self, name, flags):
|
||||
if spec['hdf5'].satisfies('~shared'):
|
||||
flags.append('-ldl')
|
||||
flags.append(spec['readline'].libs.search_flags)
|
||||
elif name in ('cflags', 'cxxflags', 'fcflags'):
|
||||
if '+pic' in spec:
|
||||
flags.append(self.compiler.pic_flag)
|
||||
|
||||
if '+pic' in spec:
|
||||
if name == 'cflags':
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
elif name == 'cxxflags':
|
||||
flags.append(self.compiler.cxx_pic_flag)
|
||||
elif name == 'fcflags':
|
||||
flags.append(self.compiler.fc_pic_flag)
|
||||
return (flags, None, None)
|
||||
|
||||
@when('%clang@9:')
|
||||
|
@@ -236,7 +236,7 @@ def install(self, spec, prefix):
|
||||
"CXX=%s" % spec['mpi'].mpicxx,
|
||||
"PARALLEL=%s" % mpi_id,
|
||||
"PQUAL=-%s" % mpi_id,
|
||||
"OPTFLAGS=-O2 -DNDEBUG " + self.compiler.pic_flag)
|
||||
"OPTFLAGS=-O2 -DNDEBUG " + self.compiler.cc_pic_flag)
|
||||
libname = 'libSimPartitionWrapper-' + mpi_id + '.a'
|
||||
wrapperlibpath = join_path(workdir, 'lib', libname)
|
||||
install(wrapperlibpath, join_path(prefix.lib, self.oslib))
|
||||
|
@@ -37,8 +37,11 @@ def cmake_args(self):
|
||||
|
||||
def flag_handler(self, name, flags):
|
||||
flags = list(flags)
|
||||
if '+pic' in self.spec and name in ('cflags', 'cxxflags'):
|
||||
flags.append(self.compiler.pic_flag)
|
||||
if '+pic' in self.spec:
|
||||
if name == 'cflags':
|
||||
flags.append(self.compiler.cc_pic_flag)
|
||||
elif name == 'cxxflags':
|
||||
flags.append(self.compiler.cxx_pic_flag)
|
||||
return (None, None, flags)
|
||||
|
||||
@run_after('install')
|
||||
|
@@ -122,6 +122,6 @@ def build_libsqlitefunctions(self):
|
||||
if '+functions' in self.spec:
|
||||
libraryname = 'libsqlitefunctions.' + dso_suffix
|
||||
cc = Executable(spack_cc)
|
||||
cc(self.compiler.pic_flag, '-lm', '-shared',
|
||||
cc(self.compiler.cc_pic_flag, '-lm', '-shared',
|
||||
'extension-functions.c', '-o', libraryname)
|
||||
install(libraryname, self.prefix.lib)
|
||||
|
@@ -63,7 +63,8 @@ def install(self, spec, prefix):
|
||||
# logic in it. Any kind of customization will need to go through
|
||||
# filtering of that file
|
||||
|
||||
pic_flag = self.compiler.pic_flag if '+pic' in spec else ''
|
||||
cc_pic_flag = self.compiler.cc_pic_flag if '+pic' in spec else ''
|
||||
f77_pic_flag = self.compiler.f77_pic_flag if '+pic' in spec else ''
|
||||
|
||||
make_args = [
|
||||
# By default, the Makefile uses the Intel compilers if
|
||||
@@ -78,11 +79,11 @@ def install(self, spec, prefix):
|
||||
'CUDA_PATH=%s' % (spec['cuda'].prefix if '+cuda' in spec else ''),
|
||||
'CFOPENMP=%s' % (self.compiler.openmp_flag
|
||||
if '+openmp' in spec else ''),
|
||||
'CFLAGS=-O3 %s' % pic_flag,
|
||||
'CFLAGS=-O3 %s' % cc_pic_flag,
|
||||
# Both FFLAGS and F77FLAGS are used in SuiteSparse makefiles;
|
||||
# FFLAGS is used in CHOLMOD, F77FLAGS is used in AMD and UMFPACK.
|
||||
'FFLAGS=%s' % pic_flag,
|
||||
'F77FLAGS=%s' % pic_flag,
|
||||
'FFLAGS=%s' % f77_pic_flag,
|
||||
'F77FLAGS=%s' % f77_pic_flag,
|
||||
# use Spack's metis in CHOLMOD/Partition module,
|
||||
# otherwise internal Metis will be compiled
|
||||
'MY_METIS_LIB=%s' % spec['metis'].libs.ld_flags,
|
||||
|
@@ -211,7 +211,7 @@ def cmake_args(self):
|
||||
def on_off(varstr):
|
||||
return 'ON' if varstr in self.spec else 'OFF'
|
||||
|
||||
fortran_flag = self.compiler.pic_flag
|
||||
fortran_flag = self.compiler.f77_pic_flag
|
||||
if (spec.satisfies('%clang platform=darwin')) and ('+fcmix' in spec):
|
||||
f77 = Executable(self.compiler.f77)
|
||||
libgfortran = LibraryList(f77('--print-file-name',
|
||||
|
@@ -73,10 +73,10 @@ def install(self, spec, prefix):
|
||||
if '+pic' in spec:
|
||||
config.extend([
|
||||
# Use these lines instead when pic_flag capability arrives
|
||||
'CFLAGS = -O3 {0}'.format(self.compiler.pic_flag),
|
||||
'NOOPTS = {0}'.format(self.compiler.pic_flag),
|
||||
'FFLAGS = -O2 {0}'.format(self.compiler.pic_flag),
|
||||
'LOADOPTS = {0}'.format(self.compiler.pic_flag)
|
||||
'CFLAGS = -O3 {0}'.format(self.compiler.cc_pic_flag),
|
||||
'NOOPTS = {0}'.format(self.compiler.cc_pic_flag),
|
||||
'FFLAGS = -O2 {0}'.format(self.compiler.f77_pic_flag),
|
||||
'LOADOPTS = {0}'.format(self.compiler.cc_pic_flag)
|
||||
])
|
||||
else:
|
||||
config.extend([
|
||||
|
@@ -51,8 +51,8 @@ class Thrift(Package):
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
if '+pic' in self.spec:
|
||||
env.append_flags('CFLAGS', self.compiler.pic_flag)
|
||||
env.append_flags('CXXFLAGS', self.compiler.pic_flag)
|
||||
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
|
||||
env.append_flags('CXXFLAGS', self.compiler.cxx_pic_flag)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
env['PY_PREFIX'] = prefix
|
||||
|
@@ -26,6 +26,6 @@ class Unrar(MakefilePackage):
|
||||
def edit(self, spec, prefix):
|
||||
makefile = FileFilter("makefile")
|
||||
makefile.filter(
|
||||
"LIBFLAGS=-fPIC", "LIBFLAGS={0}".format(self.compiler.pic_flag)
|
||||
"LIBFLAGS=-fPIC", "LIBFLAGS={0}".format(self.compiler.cc_pic_flag)
|
||||
)
|
||||
makefile.filter("DESTDIR=/usr", "DESTDIR={0}".format(self.prefix))
|
||||
|
@@ -72,8 +72,8 @@ def cmake_args(self):
|
||||
'-DVISIT_VTK_DIR:PATH=' + spec['vtk'].prefix,
|
||||
'-DVISIT_ZLIB_DIR:PATH=' + spec['zlib'].prefix,
|
||||
'-DVISIT_USE_GLEW=OFF',
|
||||
'-DCMAKE_CXX_FLAGS=' + self.compiler.pic_flag,
|
||||
'-DCMAKE_C_FLAGS=' + self.compiler.pic_flag,
|
||||
'-DCMAKE_CXX_FLAGS=' + self.compiler.cxx_pic_flag,
|
||||
'-DCMAKE_C_FLAGS=' + self.compiler.cc_pic_flag,
|
||||
]
|
||||
|
||||
if '+python' in spec:
|
||||
|
@@ -30,7 +30,7 @@ def edit(self, spec, prefix):
|
||||
# CFLAGS=-Wall -ansi -pedantic -O3
|
||||
cflags = ''
|
||||
if '+pic' in spec:
|
||||
cflags += self.compiler.pic_flag
|
||||
cflags += self.compiler.cc_pic_flag
|
||||
filter_file(r'CFLAGS=.*',
|
||||
'CFLAGS={0}'.format(cflags),
|
||||
'config.mk')
|
||||
|
@@ -40,7 +40,7 @@ def libs(self):
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
if '+pic' in self.spec:
|
||||
env.append_flags('CFLAGS', self.compiler.pic_flag)
|
||||
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
|
||||
if '+optimize' in self.spec:
|
||||
env.append_flags('CFLAGS', '-O2')
|
||||
|
||||
|
@@ -95,7 +95,7 @@ def configure_args(self):
|
||||
'RANLIB=echo',
|
||||
'--with-ar=$(CXX) -shared $(LDFLAGS) -o'
|
||||
])
|
||||
config_cflags.append(self.compiler.pic_flag)
|
||||
config_cflags.append(self.compiler.cc_pic_flag)
|
||||
if spec.satisfies('%gcc'):
|
||||
config_args.append('--with-libs=-lgfortran')
|
||||
if spec.satisfies('%intel'):
|
||||
|
@@ -27,7 +27,7 @@ class Zstd(MakefilePackage):
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
if '+pic' in self.spec:
|
||||
env.append_flags('CFLAGS', self.compiler.pic_flag)
|
||||
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
|
||||
|
||||
def build(self, spec, prefix):
|
||||
make('PREFIX={0}'.format(prefix))
|
||||
|
Reference in New Issue
Block a user