Changed every 'fpic' variant to 'pic' (#4969)
* Changed every 'fpic' variant to 'pic'. fixes #2463 Every variant that activates compilation of position independent code has been changed to 'pic'. Hardcoded compiler flags in packages have been substituted with `self.compiler.pic_flag`. * Changed literal uses of '-fpic' to 'self.compiler.pic_flag'
This commit is contained in:
parent
452f382293
commit
9be294de31
@ -103,13 +103,12 @@ def configure_args(self):
|
|||||||
spec = self.spec
|
spec = self.spec
|
||||||
self.validate(spec)
|
self.validate(spec)
|
||||||
|
|
||||||
extra_args = []
|
extra_args = [
|
||||||
|
# required, otherwise building its python bindings will fail
|
||||||
# required, otherwise building its python bindings on ADIOS will fail
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
extra_args.append("CFLAGS=-fPIC")
|
|
||||||
|
|
||||||
# always build external MXML, even in ADIOS 1.10.0+
|
# always build external MXML, even in ADIOS 1.10.0+
|
||||||
extra_args.append('--with-mxml=%s' % spec['mxml'].prefix)
|
'--with-mxml={0}'.format(spec['mxml'].prefix)
|
||||||
|
]
|
||||||
|
|
||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
extra_args.append('--enable-shared')
|
extra_args.append('--enable-shared')
|
||||||
|
@ -60,7 +60,9 @@ def patch(self):
|
|||||||
|
|
||||||
# Be sure to use the Spack compiler wrapper
|
# Be sure to use the Spack compiler wrapper
|
||||||
makefile.filter('^FC.*', 'FC = {0}'.format(os.environ['F77']))
|
makefile.filter('^FC.*', 'FC = {0}'.format(os.environ['F77']))
|
||||||
makefile.filter('^FFLAGS.*', 'FFLAGS = -O2 -g -fPIC')
|
makefile.filter(
|
||||||
|
'^FFLAGS.*', 'FFLAGS = -O2 -g {0}'.format(self.compiler.pic_flag)
|
||||||
|
)
|
||||||
|
|
||||||
if not which('ranlib'):
|
if not which('ranlib'):
|
||||||
makefile.filter('^RANLIB.*', 'RANLIB = touch')
|
makefile.filter('^RANLIB.*', 'RANLIB = touch')
|
||||||
|
@ -78,7 +78,7 @@ def install(self, spec, prefix):
|
|||||||
'CXX={0}'.format(os.environ['CXX']),
|
'CXX={0}'.format(os.environ['CXX']),
|
||||||
'F77={0}'.format(os.environ['F77']),
|
'F77={0}'.format(os.environ['F77']),
|
||||||
'FORTRAN={0}'.format(os.environ['FC']),
|
'FORTRAN={0}'.format(os.environ['FC']),
|
||||||
'cc_flags=-fPIC',
|
'cc_flags={0}'.format(self.compiler.pic_flag),
|
||||||
# Allow Spack environment variables to propagate through to SCons
|
# Allow Spack environment variables to propagate through to SCons
|
||||||
'env_vars=all'
|
'env_vars=all'
|
||||||
]
|
]
|
||||||
|
@ -51,7 +51,7 @@ def configure_args(self):
|
|||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
|
||||||
config_args = [
|
config_args = [
|
||||||
'CFLAGS=-fPIC',
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
'--with-jpeg={0}'.format(spec['jpeg'].prefix),
|
'--with-jpeg={0}'.format(spec['jpeg'].prefix),
|
||||||
'--with-zlib={0}'.format(spec['zlib'].prefix),
|
'--with-zlib={0}'.format(spec['zlib'].prefix),
|
||||||
'--disable-netcdf', # must be disabled to build NetCDF with HDF4
|
'--disable-netcdf', # must be disabled to build NetCDF with HDF4
|
||||||
|
@ -74,7 +74,7 @@ def edit(self, spec, prefix):
|
|||||||
config.append('CCFLAGS = -fopenmp')
|
config.append('CCFLAGS = -fopenmp')
|
||||||
config.append('LINKFLAGS = -fopenmp $(OPTFLAGS)')
|
config.append('LINKFLAGS = -fopenmp $(OPTFLAGS)')
|
||||||
|
|
||||||
config.append('SHFLAGS = -fPIC')
|
config.append('SHFLAGS = {0}'.format(self.compiler.pic_flag))
|
||||||
config.append('DEPFLAGS = -M')
|
config.append('DEPFLAGS = -M')
|
||||||
config.append('LINK = c++')
|
config.append('LINK = c++')
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ def install(self, spec, prefix):
|
|||||||
raise InstallError('METIS@:4 does not support the following '
|
raise InstallError('METIS@:4 does not support the following '
|
||||||
'variants: gdb, int64, real64.')
|
'variants: gdb, int64, real64.')
|
||||||
|
|
||||||
options = ['COPTIONS=-fPIC']
|
options = ['COPTIONS={0}'.format(self.compiler.pic_flag)]
|
||||||
if '+debug' in spec:
|
if '+debug' in spec:
|
||||||
options.append('OPTFLAGS=-g -O0')
|
options.append('OPTFLAGS=-g -O0')
|
||||||
make(*options)
|
make(*options)
|
||||||
@ -119,7 +119,7 @@ def install(self, spec, prefix):
|
|||||||
install(sharefile, prefix.share)
|
install(sharefile, prefix.share)
|
||||||
|
|
||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
shared_flags = ['-fPIC', '-shared']
|
shared_flags = [self.compiler.pic_flag, '-shared']
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
shared_suffix = 'dylib'
|
shared_suffix = 'dylib'
|
||||||
shared_flags.extend(['-Wl,-all_load', 'libmetis.a'])
|
shared_flags.extend(['-Wl,-all_load', 'libmetis.a'])
|
||||||
|
@ -50,7 +50,7 @@ def url_for_version(self, version):
|
|||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
return [
|
return [
|
||||||
# ADIOS build with -fPIC, so we need it too (avoid linkage issue)
|
# ADIOS build with -fPIC, so we need it too (avoid linkage issue)
|
||||||
'CFLAGS=-fPIC',
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
# Default is non-shared, but avoid any future surprises
|
# Default is non-shared, but avoid any future surprises
|
||||||
'--disable-shared',
|
'--disable-shared',
|
||||||
]
|
]
|
||||||
|
@ -39,7 +39,7 @@ class Nalu(CMakePackage):
|
|||||||
git='https://github.com/NaluCFD/Nalu.git', branch='master')
|
git='https://github.com/NaluCFD/Nalu.git', branch='master')
|
||||||
|
|
||||||
# Currently Nalu only builds static libraries; To be fixed soon
|
# Currently Nalu only builds static libraries; To be fixed soon
|
||||||
depends_on('yaml-cpp+fpic~shared')
|
depends_on('yaml-cpp+pic~shared')
|
||||||
depends_on('trilinos~shared+exodus+tpetra+muelu+belos+ifpack2+amesos2+zoltan+stk+boost~superlu-dist+superlu+hdf5+zlib+pnetcdf@master')
|
depends_on('trilinos~shared+exodus+tpetra+muelu+belos+ifpack2+amesos2+zoltan+stk+boost~superlu-dist+superlu+hdf5+zlib+pnetcdf@master')
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
|
@ -133,7 +133,7 @@ def configure_args(self):
|
|||||||
config_args.append('--disable-shared')
|
config_args.append('--disable-shared')
|
||||||
# We don't have shared libraries but we still want it to be
|
# We don't have shared libraries but we still want it to be
|
||||||
# possible to use this library in shared builds
|
# possible to use this library in shared builds
|
||||||
CFLAGS.append('-fPIC')
|
CFLAGS.append(self.compiler.pic_flag)
|
||||||
|
|
||||||
if '+dap' in spec:
|
if '+dap' in spec:
|
||||||
config_args.append('--enable-dap')
|
config_args.append('--enable-dap')
|
||||||
|
@ -46,9 +46,9 @@ class NetlibScalapack(CMakePackage):
|
|||||||
description='Build the shared library version'
|
description='Build the shared library version'
|
||||||
)
|
)
|
||||||
variant(
|
variant(
|
||||||
'fpic',
|
'pic',
|
||||||
default=False,
|
default=False,
|
||||||
description='Build with -fpic compiler option'
|
description='Build position independent code'
|
||||||
)
|
)
|
||||||
|
|
||||||
provides('scalapack')
|
provides('scalapack')
|
||||||
@ -87,10 +87,10 @@ def cmake_args(self):
|
|||||||
'-DBLAS_LIBRARIES=%s' % (blas.joined(';'))
|
'-DBLAS_LIBRARIES=%s' % (blas.joined(';'))
|
||||||
])
|
])
|
||||||
|
|
||||||
if '+fpic' in spec:
|
if '+pic' in spec:
|
||||||
options.extend([
|
options.extend([
|
||||||
"-DCMAKE_C_FLAGS=-fPIC",
|
"-DCMAKE_C_FLAGS=%s" % self.compiler.pic_flag,
|
||||||
"-DCMAKE_Fortran_FLAGS=-fPIC"
|
"-DCMAKE_Fortran_FLAGS=%s" % self.compiler.pic_flag
|
||||||
])
|
])
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
@ -41,4 +41,8 @@ class Otf2(AutotoolsPackage):
|
|||||||
version('1.2.1', '8fb3e11fb7489896596ae2c7c83d7fc8')
|
version('1.2.1', '8fb3e11fb7489896596ae2c7c83d7fc8')
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
return ["--enable-shared", "CFLAGS=-fPIC", "CXXFLAGS=-fPIC"]
|
return [
|
||||||
|
'--enable-shared',
|
||||||
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
|
'CXXFLAGS={0}'.format(self.compiler.pic_flag)
|
||||||
|
]
|
||||||
|
@ -40,7 +40,7 @@ class ParallelNetcdf(AutotoolsPackage):
|
|||||||
|
|
||||||
variant('cxx', default=True, description='Build the C++ Interface')
|
variant('cxx', default=True, description='Build the C++ Interface')
|
||||||
variant('fortran', default=True, description='Build the Fortran Interface')
|
variant('fortran', default=True, description='Build the Fortran Interface')
|
||||||
variant('fpic', default=True,
|
variant('pic', default=True,
|
||||||
description='Produce position-independent code (for shared libs)')
|
description='Produce position-independent code (for shared libs)')
|
||||||
|
|
||||||
depends_on('mpi')
|
depends_on('mpi')
|
||||||
@ -53,12 +53,18 @@ def configure_args(self):
|
|||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
|
||||||
args = ['--with-mpi={0}'.format(spec['mpi'].prefix)]
|
args = ['--with-mpi={0}'.format(spec['mpi'].prefix)]
|
||||||
args.append('SEQ_CC=%s' % spack_cc)
|
args.append('SEQ_CC={0}'.format(spack_cc))
|
||||||
|
|
||||||
|
if '+pic' in spec:
|
||||||
|
args.extend([
|
||||||
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
|
'CXXFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
|
'FFLAGS={0}'.format(self.compiler.pic_flag)
|
||||||
|
])
|
||||||
|
|
||||||
if '+fpic' in spec:
|
|
||||||
args.extend(['CFLAGS=-fPIC', 'CXXFLAGS=-fPIC', 'FFLAGS=-fPIC'])
|
|
||||||
if '~cxx' in spec:
|
if '~cxx' in spec:
|
||||||
args.append('--disable-cxx')
|
args.append('--disable-cxx')
|
||||||
|
|
||||||
if '~fortran' in spec:
|
if '~fortran' in spec:
|
||||||
args.append('--disable-fortran')
|
args.append('--disable-fortran')
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ class Parmgridgen(Package):
|
|||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
make_opts = [
|
make_opts = [
|
||||||
'make=make',
|
'make=make',
|
||||||
'COPTIONS=-fPIC',
|
'COPTIONS={0}'.format(self.compiler.pic_flag),
|
||||||
'LDOPTIONS=-fPIC',
|
'LDOPTIONS={0}'.format(self.compiler.pic_flag),
|
||||||
'CC={0}'.format(self.compiler.cc),
|
'CC={0}'.format(self.compiler.cc),
|
||||||
'LD={0}'.format(self.compiler.cc),
|
'LD={0}'.format(self.compiler.cc),
|
||||||
'LIBDIR=-L../..',
|
'LIBDIR=-L../..',
|
||||||
|
@ -88,5 +88,8 @@ def configure_args(self):
|
|||||||
if '~shmem' in spec:
|
if '~shmem' in spec:
|
||||||
config_args.append("--without-shmem")
|
config_args.append("--without-shmem")
|
||||||
|
|
||||||
config_args.extend(["CFLAGS=-fPIC", "CXXFLAGS=-fPIC"])
|
config_args.extend([
|
||||||
|
'CFLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
|
'CXXFLAGS={0}'.format(self.compiler.pic_flag)
|
||||||
|
])
|
||||||
return config_args
|
return config_args
|
||||||
|
@ -129,7 +129,9 @@ def configure(self):
|
|||||||
if self.spec.satisfies('platform=darwin'):
|
if self.spec.satisfies('platform=darwin'):
|
||||||
makefile_inc.extend([
|
makefile_inc.extend([
|
||||||
'LIB = .dylib',
|
'LIB = .dylib',
|
||||||
'CLIBFLAGS = -dynamiclib -fPIC',
|
'CLIBFLAGS = -dynamiclib {0}'.format(
|
||||||
|
self.compiler.pic_flag
|
||||||
|
),
|
||||||
'RANLIB = echo',
|
'RANLIB = echo',
|
||||||
'AR = $(CC)',
|
'AR = $(CC)',
|
||||||
'ARFLAGS = -dynamiclib $(LDFLAGS) -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % prefix.lib # noqa
|
'ARFLAGS = -dynamiclib $(LDFLAGS) -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % prefix.lib # noqa
|
||||||
@ -137,12 +139,12 @@ def configure(self):
|
|||||||
else:
|
else:
|
||||||
makefile_inc.extend([
|
makefile_inc.extend([
|
||||||
'LIB = .so',
|
'LIB = .so',
|
||||||
'CLIBFLAGS = -shared -fPIC',
|
'CLIBFLAGS = -shared {0}'.format(self.compiler.pic_flag),
|
||||||
'RANLIB = echo',
|
'RANLIB = echo',
|
||||||
'AR = $(CC)',
|
'AR = $(CC)',
|
||||||
'ARFLAGS = -shared $(LDFLAGS) -o'
|
'ARFLAGS = -shared $(LDFLAGS) -o'
|
||||||
])
|
])
|
||||||
cflags.append('-fPIC')
|
cflags.append(self.compiler.pic_flag)
|
||||||
else:
|
else:
|
||||||
makefile_inc.extend([
|
makefile_inc.extend([
|
||||||
'LIB = .a',
|
'LIB = .a',
|
||||||
|
@ -58,8 +58,8 @@ def install(self, spec, prefix):
|
|||||||
cmake_args = std_cmake_args[:]
|
cmake_args = std_cmake_args[:]
|
||||||
cmake_args.extend([
|
cmake_args.extend([
|
||||||
'-DBUILD_SHARED_LIBS=ON',
|
'-DBUILD_SHARED_LIBS=ON',
|
||||||
'-DCMAKE_C_FLAGS=-fPIC',
|
'-DCMAKE_C_FLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
'-DCMAKE_Fortran_FLAGS=-fPIC',
|
'-DCMAKE_Fortran_FLAGS={0}'.format(self.compiler.pic_flag),
|
||||||
'-DEXAMPLES_ENABLE=ON',
|
'-DEXAMPLES_ENABLE=ON',
|
||||||
'-DEXAMPLES_INSTALL=ON',
|
'-DEXAMPLES_INSTALL=ON',
|
||||||
'-DFCMIX_ENABLE=ON'
|
'-DFCMIX_ENABLE=ON'
|
||||||
|
@ -38,7 +38,7 @@ class Superlu(Package):
|
|||||||
version('5.2.1', '3a1a9bff20cb06b7d97c46d337504447')
|
version('5.2.1', '3a1a9bff20cb06b7d97c46d337504447')
|
||||||
version('4.3', 'b72c6309f25e9660133007b82621ba7c')
|
version('4.3', 'b72c6309f25e9660133007b82621ba7c')
|
||||||
|
|
||||||
variant('fpic', default=True,
|
variant('pic', default=True,
|
||||||
description='Build with position independent code')
|
description='Build with position independent code')
|
||||||
|
|
||||||
depends_on('cmake', when='@5.2.1:', type='build')
|
depends_on('cmake', when='@5.2.1:', type='build')
|
||||||
@ -51,7 +51,7 @@ def install(self, spec, prefix):
|
|||||||
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].libs.joined())
|
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].libs.joined())
|
||||||
]
|
]
|
||||||
|
|
||||||
if '+fpic' in spec:
|
if '+pic' in spec:
|
||||||
cmake_args.extend([
|
cmake_args.extend([
|
||||||
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON'
|
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON'
|
||||||
])
|
])
|
||||||
@ -89,7 +89,7 @@ def install(self, spec, prefix):
|
|||||||
'CDEFS = -DAdd_'
|
'CDEFS = -DAdd_'
|
||||||
])
|
])
|
||||||
|
|
||||||
if '+fpic' in spec:
|
if '+pic' in spec:
|
||||||
config.extend([
|
config.extend([
|
||||||
# Use these lines instead when pic_flag capability arrives
|
# Use these lines instead when pic_flag capability arrives
|
||||||
'CFLAGS = -O3 {0}'.format(self.compiler.pic_flag),
|
'CFLAGS = -O3 {0}'.format(self.compiler.pic_flag),
|
||||||
|
@ -177,7 +177,7 @@ class Trilinos(CMakePackage):
|
|||||||
|
|
||||||
# ###################### Dependencies ##########################
|
# ###################### Dependencies ##########################
|
||||||
|
|
||||||
# Everything should be compiled with -fpic
|
# Everything should be compiled position independent (-fpic)
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
depends_on('lapack')
|
depends_on('lapack')
|
||||||
depends_on('boost', when='+boost')
|
depends_on('boost', when='+boost')
|
||||||
@ -207,7 +207,7 @@ class Trilinos(CMakePackage):
|
|||||||
depends_on('superlu-dist@:4.3', when='@:12.6.1+superlu-dist')
|
depends_on('superlu-dist@:4.3', when='@:12.6.1+superlu-dist')
|
||||||
depends_on('superlu-dist@develop', when='@develop+superlu-dist')
|
depends_on('superlu-dist@develop', when='@develop+superlu-dist')
|
||||||
depends_on('superlu-dist@xsdk-0.2.0', when='@xsdk-0.2.0+superlu-dist')
|
depends_on('superlu-dist@xsdk-0.2.0', when='@xsdk-0.2.0+superlu-dist')
|
||||||
depends_on('superlu+fpic@4.3', when='+superlu')
|
depends_on('superlu+pic@4.3', when='+superlu')
|
||||||
# Trilinos can not be built against 64bit int hypre
|
# Trilinos can not be built against 64bit int hypre
|
||||||
depends_on('hypre~internal-superlu~int64', when='+hypre')
|
depends_on('hypre~internal-superlu~int64', when='+hypre')
|
||||||
depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre')
|
depends_on('hypre@xsdk-0.2.0~internal-superlu', when='@xsdk-0.2.0+hypre')
|
||||||
|
@ -36,7 +36,7 @@ class YamlCpp(CMakePackage):
|
|||||||
|
|
||||||
variant('shared', default=True,
|
variant('shared', default=True,
|
||||||
description='Enable build of shared libraries')
|
description='Enable build of shared libraries')
|
||||||
variant('fpic', default=True,
|
variant('pic', default=True,
|
||||||
description='Build with position independent code')
|
description='Build with position independent code')
|
||||||
|
|
||||||
depends_on('boost', when='@:0.5.3')
|
depends_on('boost', when='@:0.5.3')
|
||||||
@ -49,7 +49,7 @@ def cmake_args(self):
|
|||||||
'-DBUILD_SHARED_LIBS:BOOL=%s' % (
|
'-DBUILD_SHARED_LIBS:BOOL=%s' % (
|
||||||
'ON' if '+shared' in spec else 'OFF'),
|
'ON' if '+shared' in spec else 'OFF'),
|
||||||
'-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=%s' % (
|
'-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=%s' % (
|
||||||
'ON' if '+fpic' in spec else 'OFF'),
|
'ON' if '+pic' in spec else 'OFF'),
|
||||||
])
|
])
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
@ -76,7 +76,7 @@ def install(self, spec, prefix):
|
|||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
config_args.append('RANLIB=echo')
|
config_args.append('RANLIB=echo')
|
||||||
config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o')
|
config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o')
|
||||||
config_cflags.append('-fPIC')
|
config_cflags.append(self.compiler.pic_flag)
|
||||||
if spec.satisfies('%gcc'):
|
if spec.satisfies('%gcc'):
|
||||||
config_args.append('--with-libs={0}'.format('-lgfortran'))
|
config_args.append('--with-libs={0}'.format('-lgfortran'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user