A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/commercialhaskell/stack/issues/4009 below:

Building Main/StackSetupShim triggers un-silenceable -nopie warnings with clang · Issue #4009 · commercialhaskell/stack · GitHub

General summary/comments

In attempting to upgrade a library (haskell-tree-sitter) to a newer Stackage nightly (nightly-2018-05-04, for GHC 8.4, but nightly-2018-04-25 exhibits this problem too), the build process (with a custom Setup.hs) always generates the following errors from clang:

haskell-tree-sitter-0.1.0: configure (lib)
[1 of 2] Compiling Main             ( /Users/patrickt/src/haskell-tree-sitter/Setup.hs, /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup/Main.o )
[2 of 2] Compiling StackSetupShim   ( /Users/patrickt/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup/StackSetupShim.o )
Linking /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup/setup ...
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]

These errors also appear when compiling dependent C code in the project itself; I was able to fix them with the following stanza in my stack.yaml:

apply-ghc-options: everything
ghc-options:
  $everything: -optc -Wno-unused-command-line-argument

However, I'm unable to figure out how to silence these warnings when building the setup executable. Adding a GHC_OPTIONS stanza to my Setup.hs did not work, nor did adding ccOptions = "-Wno-unused-command-line-argument" to my Setup.hs's libBuildInfo. Short of editing ~/.stack/programs/x86_64-osx/ghc-8.4.1/lib/ghc-8.4.1/settings on every machine we use, is there a way to silence these warnings? This makes upgrading to 8.4 a tricky proposition.

I am running macOS 10.13.4 with stack 1.7.1. The output of clang --version is

Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Running with --verbose seems to indicate that the command producing these warnings is

2018-05-04 12:46:29.295442: [debug] Run process: /Users/patrickt/.stack/programs/x86_64-osx/ghc-8.4.2/bin/ghc-8.4.2 --make -odir /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup -hidir /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/patrickt/.stack/snapshots/x86_64-osx/nightly-2018-04-25/8.4.2/pkgdb -package-db=/Users/patrickt/src/haskell-tree-sitter/.stack-work/install/x86_64-osx/nightly-2018-04-25/8.4.2/pkgdb -hide-all-packages -package-id=Cabal-2.2.0.1 -package-id=base-4.11.1.0 -package-id=directory-1.3.1.5 -package-id=process-1.6.3.0 -optP-include -optP/Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup/setup_macros.h /Users/patrickt/src/haskell-tree-sitter/Setup.hs /Users/patrickt/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /Users/patrickt/src/haskell-tree-sitter/.stack-work/dist/x86_64-osx/Cabal-2.2.0.1/setup/setup -threaded

Steps to reproduce
  1. Check out git@github.com:tree-sitter/haskell-tree-sitter.git
  2. Switch to the tentative-8.4-upgrade branch
  3. Run script/bootstrap to fetch submodules
  4. Run stack build
Expected

A clean build free of C errors.

Actual

Seemingly-unsilenceable errors from clang.

Stack version
$ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2
Method of installation

EDIT: fixed repository link


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4