ncurses: fix pic and opt flags#12272
Merged
adamjstewart merged 1 commit intospack:developfrom Aug 7, 2019
Merged
Conversation
Resolves spack#11932. Move the PIC flags from CFLAGS on the configure line to the spack compiler wrapper for ncurses. The problem with the configure line for autotools is that specifying CFLAGS sets the entire flags, thus deleting the flags that configure would add itself. By default, if CFLAGS is unspecified, then configure picks a sensible default of `-g -O2`. But adding `-fPIC` erases these and it ends up building unoptimized.
adamjstewart
approved these changes
Aug 7, 2019
likask
added a commit
to likask/spack
that referenced
this pull request
Aug 7, 2019
…upsream_develop * commit 'f7026a058b63f5a3109691e2c3871ee77c08f756': (1881 commits) Version 19.8.1 of PLASMA (spack#12299) new package: py-exodus (spack#12291) ncurses: fix pic and opt flags (spack#12272) pumi: new version 2.2.1 (spack#12282) tests: explain and test dependency flattening routines (spack#11993) graphviz package: add MacOS fixes and quartz support (spack#11128) Overhaul numpy package (spack#12170) mirrors: mirror config should use spack variable expansions (spack#9027) stacks: fix reference handling in env.write() (spack#12096) fltk: fix about variable types (spack#12292) Avoid sending empty reports to codecov (spack#12293) Packages/musl (spack#12288) c-blosc package: Add -std=gnu99 flag for gcc (spack#11959) Move new packages from tutorial to builtin (spack#12289) Balay/amrex 19.08 (spack#12287) openPMD-api: pre-load depend libs (spack#12279) Add version 19.8.0 of PLASMA (spack#12275) Add version 2.5.1 of MAGMA released today (spack#12274) ginkgo: add maintainers (spack#12273) new package: py-backports-tempfile (spack#12261) ... # Conflicts: # .travis.yml # var/spack/repos/builtin/packages/moab/package.py # var/spack/repos/builtin/packages/mofem-cephas/package.py # var/spack/repos/builtin/packages/mofem-fracture-module/package.py # var/spack/repos/builtin/packages/mofem-users-modules/package.py # var/spack/repos/builtin/packages/petsc/package.py
dev-zero
pushed a commit
to dev-zero/spack
that referenced
this pull request
Aug 13, 2019
Resolves spack#11932. Move the PIC flags from CFLAGS on the configure line to the spack compiler wrapper for ncurses. The problem with the configure line for autotools is that specifying CFLAGS sets the entire flags, thus deleting the flags that configure would add itself. By default, if CFLAGS is unspecified, then configure picks a sensible default of `-g -O2`. But adding `-fPIC` erases these and it ends up building unoptimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #11932.
Move the PIC flags from CFLAGS on the configure line to the spack
compiler wrapper for ncurses. The problem with the configure line for
autotools is that specifying CFLAGS sets the entire flags, thus
deleting the flags that configure would add itself.
By default, if CFLAGS is unspecified, then configure picks a sensible
default of
-g -O2. But adding-fPICerases these and it ends upbuilding unoptimized.
This patch is a simple and safe way of fixing the problem of building
ncurses unoptimized. But this brings up two larger issues that affect
autotools in general.
(1) Autotools was designed to pass compiler flags via CFLAGS and
CXXFLAGS on the configure line. You can either set these yourself, or
else leave them unspecified and then configure selects sensible
defaults, normally
-g -O2.The problem is that if you specify any flag, then configure uses
those as the entire flags. This erases the
-O2flag and builds thepackage unoptimized, unless you add it yourself. You have to do
things like setting
CFLAGS='-fPIC -g -O2'to keep-O2.Cmake has an easier time of this because every cmake package has a
build_typevariant which is orthogonal to the opt flags.(2) The
--with-sharedand--with-cxx-sharedoptions tell configureto build shared libraries and libtool already adds the PIC flag.
(Run
spack -d installand you see that-fPICis added twice.)So, adding
-fPICshould not be necessary at all, and certainlythat's true for the latest ncurses and GNU. But there are reports
#3135 that libtool has trouble with the PGI compiler, at least for
older libtool.
I suspect that whatever problems there were have long since been
fixed. Either that or libtool is fundamentally broken for PGI, which
I find hard to believe.
This deserves further study, but we'll keep the
-fPICfor now. Thelast thing I want to do is break someone else's use case.