Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack does not pass parameters given in command line to GHC #4526

Closed
mouse07410 opened this issue Jan 21, 2019 · 14 comments

Comments

Projects
None yet
4 participants
@mouse07410
Copy link

commented Jan 21, 2019

General summary/comments (optional)

stack is invoked with --ghc-options -optL=/usr/lib/libiconv.dylib. This is not passed to GHC, as the log below shows.

This problem screws up using stack on MacOS with Macports installed.

Steps to reproduce

  1. Get a Mac computer, install Macports and Haskell Platform.
  2. Do stack install intero --ghc-options -optL=/usr/lib/libiconv.dylib or stack install hsdev --ghc-options -optL=/usr/lib/libiconv.dylib, or stack install happy --ghc-options -optL=/usr/lib/libiconv.dylib

~/.stack/config.yaml (in case it can help):

#resolver: lts-13.2

system-ghc: true
skip-ghc-check: true
extra-path:
- /usr/local/bin

arch: x86_64

with-gcc: /opt/local/bin/gcc

extra-include-dirs: [ /opt/local/include, /usr/local/include ]
#extra-lib-dirs: [ /opt/local/lib, /usr/local/lib ]
extra-lib-dirs: [ /opt/local/lib/liconv, /opt/local/lib, /usr/local/lib, /usr/lib ]

#ignore-revision-mismatch: true
allow-newer: true

ghc-options:
    # All packages
    #"$locals": -Wall /usr/lib/libiconv.dylib
    "$targets": -Wall /usr/lib/libiconv.dylib
    "$everything": -O2 /usr/lib/libiconv.dylib
apply-ghc-options: everything

build:
  cabal-verbose: true

Expected

Successful build.

Actual

$ stack install hsdev --ghc-options -optL=/usr/lib/libiconv.dylib --verbose 2>&1 | tee hsdev-build.txt
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1
2019-01-21 13:15:12.147091: [debug] Checking for project config at: /Users/uri/src/stack.yaml
2019-01-21 13:15:12.147617: [debug] Checking for project config at: /Users/uri/stack.yaml
2019-01-21 13:15:12.147685: [debug] Checking for project config at: /Users/stack.yaml
2019-01-21 13:15:12.147735: [debug] Checking for project config at: /stack.yaml
2019-01-21 13:15:12.147785: [debug] No project config file found, using defaults.
2019-01-21 13:15:12.149954: [debug] Run from outside a project, using implicit global project config
2019-01-21 13:15:12.150343: [debug] Decoding build plan from: /Users/uri/.stack/build-plan/lts-13.2.yaml
2019-01-21 13:15:12.150398: [debug] Trying to decode /Users/uri/.stack/build-plan-cache/lts-13.2.cache
2019-01-21 13:15:12.156167: [debug] Success decoding /Users/uri/.stack/build-plan-cache/lts-13.2.cache
2019-01-21 13:15:12.156340: [debug] Getting system compiler version
2019-01-21 13:15:12.156619: [debug] Run process: /usr/local/bin/ghc --info
2019-01-21 13:15:12.261122: [debug] Process finished in 104ms: /usr/local/bin/ghc --info
2019-01-21 13:15:12.262655: [debug] Getting global package database location
2019-01-21 13:15:12.262895: [debug] Run process: /usr/local/bin/ghc-pkg --no-user-package-db list --global
2019-01-21 13:15:12.263590: [debug] Asking GHC for its version
2019-01-21 13:15:12.263769: [debug] Run process: /usr/local/bin/ghc --numeric-version
2019-01-21 13:15:12.264668: [debug] Getting Cabal package version
2019-01-21 13:15:12.264772: [debug] Run process: /usr/local/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
2019-01-21 13:15:12.349020: [debug] Process finished in 86ms: /usr/local/bin/ghc-pkg --no-user-package-db list --global
. . . . .
2019-01-21 13:15:29.285083: [debug] Encoding /Users/uri/.stack/global-project/.stack-work/install/x86_64-osx/lts-13.2/8.6.3/flag-cache/network-uri-2.6.1.0-K75fCYvLQE41EntOQ30cqK
2019-01-21 13:15:29.285590: [debug] Finished writing /Users/uri/.stack/global-project/.stack-work/install/x86_64-osx/lts-13.2/8.6.3/flag-cache/network-uri-2.6.1.0-K75fCYvLQE41EntOQ30cqK

--  While building package happy-1.19.9 using:
      /usr/local/bin/ghc --make -odir /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup -hidir /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/uri/.stack/snapshots/x86_64-osx/lts-13.2/8.6.3/pkgdb -package-db=/Users/uri/.stack/global-project/.stack-work/install/x86_64-osx/lts-13.2/8.6.3/pkgdb -hide-all-packages -package-id=Cabal-2.4.1.0-Df4rkGuWEtO4aZs4eesJ3r -package-id=base-4.12.0.0 -package-id=directory-1.3.3.0 -package-id=filepath-1.4.2.1 -optP-include -optP/private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup_macros.h /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/Setup.lhs /Users/uri/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup -threaded
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/uri/.stack/global-project/.stack-work/logs/happy-1.19.9.log

    [1 of 2] Compiling Main             ( /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/Setup.lhs, /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/Main.o )
    
    /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/Setup.lhs:48:22: warning: [-Wdeprecations]
        In the use of ‘rawSystemProgramConf’
        (imported from Distribution.Simple.Program):
        Deprecated: "use runDbProgram instead. This symbol will be removed in Cabal-3.0 (est. Mar 2019)."
       |
    48 |   let runProgram p = rawSystemProgramConf (fromFlagOrDefault normal (buildVerbosity flags))
       |                      ^^^^^^^^^^^^^^^^^^^^
    [2 of 2] Compiling StackSetupShim   ( /Users/uri/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/StackSetupShim.o )
    Linking /private/var/folders/pd/mxn5kp_55jg23x7jjd10gtwm0000gn/T/stack3944/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup ...
    Undefined symbols for architecture x86_64:
      "_iconv", referenced from:
          _hs_iconv in libHSbase-4.12.0.0.a(iconv.o)
         (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding_closure, _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding15_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding14_bytes , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding15_info , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding10_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding13_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure )
      "_iconv_open", referenced from:
          _hs_iconv_open in libHSbase-4.12.0.0.a(iconv.o)
         (maybe you meant: _hs_iconv_open)
      "_iconv_close", referenced from:
          _hs_iconv_close in libHSbase-4.12.0.0.a(iconv.o)
         (maybe you meant: _hs_iconv_close)
      "_locale_charset", referenced from:
          _localeEncoding in libHSbase-4.12.0.0.a(PrelIOUtils.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    `clang' failed in phase `Linker'. (Exit code: 1)
$

Complete build log: hsdev-build.txt

happy-log.txt

Stack version

$ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

Method of installation

  • Official binary, downloaded from/with Haskell Platform, an updated via stack update
@dbaynard

This comment has been minimized.

Copy link
Contributor

commented Jan 24, 2019

This relate to #4504, right?

@mouse07410

This comment has been minimized.

Copy link
Author

commented Jan 24, 2019

Related - as in "discovered during a battle with the same problem"? Yes.

But it points at a different issue with stack, I think.

@snoyberg

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

Explanation: --ghc-options are currently only passed to Cabal, not to GHC directly. This applies only in the case of building a Setup.hs I believe.

@snoyberg

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

@mouse07410 would you be able to test the PR at #4651?

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

I'm not an expert either in Haskell or in it's ecosystem. What would be required (setup-wise) for testing it? I'd appreciate some guidance how to do it without wrecking the existing setup. Thanks!

@snoyberg

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

Typically I'd recommend stack upgrade --git --git-branch 4526-ghc-options-when-building-setup, but my understanding is that you currently can't build any code on your local machine with Stack, correct?

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

Well, thankfully, only some packages fail to build. So, there is a chance. I don't recall if I tried to manually rebuild stack (probably not), but I think I did "stack upgrade" at least once (wouldn't bet my life on it though :)

I will try what you showed today, and report here.

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

Darn... On one machine stack upgrade ... failed:

. . . . .
Progress 54/169              

--  While building package stm-2.4.5.0 using:
      /Users/ur20980/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3 --verbose --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade72480/stack/.stack-work/logs/stm-2.4.5.0.log

    Using Parsec parser
    Configuring stm-2.4.5.0...
    Dependency array ==0.5.3.0: using array-0.5.3.0
    Dependency base (>=4.3 && <4.12) && ==4.12.0.0: using base-4.12.0.0
    Warning: the following files would be used as linker inputs, but linking is not being done: /usr/lib/libiconv.dylib
    Source component graph: component lib
    Configured component graph:
        component stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm
            include array-0.5.3.0
            include base-4.12.0.0
    Linked component graph:
        unit stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm
            include array-0.5.3.0
            include base-4.12.0.0
            Control.Concurrent.STM=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM,Control.Concurrent.STM.TArray=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TArray,Control.Concurrent.STM.TBQueue=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TBQueue,Control.Concurrent.STM.TChan=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TChan,Control.Concurrent.STM.TMVar=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TMVar,Control.Concurrent.STM.TQueue=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TQueue,Control.Concurrent.STM.TSem=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TSem,Control.Concurrent.STM.TVar=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Concurrent.STM.TVar,Control.Monad.STM=stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm:Control.Monad.STM
    Ready component graph:
        definite stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm
            depends array-0.5.3.0
            depends base-4.12.0.0
    Using Cabal-2.4.0.1 compiled by ghc-8.6
    Using compiler: ghc-8.6.3
    Using install prefix: /Users/ur20980/.cabal
    Executables installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/bin
    Libraries installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/lib/x86_64-osx-ghc-8.6.3/stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm
    Dynamic Libraries installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/lib/x86_64-osx-ghc-8.6.3
    Private executables installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/libexec/x86_64-osx-ghc-8.6.3/stm-2.4.5.0
    Data files installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/share/x86_64-osx-ghc-8.6.3/stm-2.4.5.0
    Documentation installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/doc/stm-2.4.5.0
    Configuration files installed in:
    /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/etc
    No alex found
    Using ar found on system at: /opt/local/bin/ar
    No c2hs found
    No cpphs found
    No doctest found
    Using gcc version 4.2.1 found on system at: /opt/local/bin/clang
    Using ghc version 8.6.3 given by user at: /Users/ur20980/.ghcup/bin/ghc
    Using ghc-pkg version 8.6.3 given by user at:
    /Users/ur20980/.ghcup/bin/ghc-pkg
    No ghcjs found
    No ghcjs-pkg found
    No greencard found
    Using haddock version 2.22.0 found on system at:
    /Users/ur20980/.ghcup/bin/haddock
    Using happy version 1.19.9 found on system at: /Users/ur20980/.cabal/bin/happy
    Using haskell-suite found on system at: haskell-suite-dummy-location
    Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
    No hmake found
    Using hpc version 0.67 found on system at:
    /Users/ur20980/.ghcup/ghc/8.6.3/bin/hpc
    Using hsc2hs version 0.68.5 found on system at:
    /Users/ur20980/.ghcup/ghc/8.6.3/bin/hsc2hs
    Using hscolour version 1.24 found on system at:
    /Users/ur20980/.cabal/bin/HsColour
    No jhc found
    Using ld found on system at: /opt/local/bin/ld
    Using pkg-config version 0.29.2 found on system at: /opt/local/bin/pkg-config
    Using runghc version 8.6.3 found on system at:
    /Users/ur20980/.ghcup/bin/runghc
    Using strip found on system at: /opt/local/bin/strip
    Using tar found on system at: /usr/bin/tar
    No uhc found
    Component build order: library
    /Users/ur20980/.ghcup/bin/ghc-pkg init .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/package.conf.inplace
    creating .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build
    creating .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen
    creating .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen
    Preprocessing library for stm-2.4.5.0..
    Building library for stm-2.4.5.0..
    creating .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build
    /Users/ur20980/.ghcup/bin/ghc --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -odir .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -hidir .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -stubdir .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -i -i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -i. -i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen -i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen -I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen -I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen -I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build -I/opt/local/include -I/usr/local/include -optP-include -optP.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/cabal_macros.h -this-unit-id stm-2.4.5.0-GfJxMxtntTZ3BxdyiWveBm -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.6.3/pkgdb -package-db .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/package.conf.inplace -package-id array-0.5.3.0 -package-id base-4.12.0.0 -XHaskell2010 Control.Concurrent.STM Control.Concurrent.STM.TArray Control.Concurrent.STM.TVar Control.Concurrent.STM.TChan Control.Concurrent.STM.TMVar Control.Concurrent.STM.TQueue Control.Concurrent.STM.TBQueue Control.Concurrent.STM.TSem Control.Monad.STM Control.Sequential.STM -Wall /usr/lib/libiconv.dylib -ddump-hi -ddump-to-file '-fdiagnostics-color=always'
    [ 1 of 10] Compiling Control.Concurrent.STM.TBQueue ( Control/Concurrent/STM/TBQueue.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TBQueue.o )
    [ 2 of 10] Compiling Control.Concurrent.STM.TChan ( Control/Concurrent/STM/TChan.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TChan.o )
    [ 3 of 10] Compiling Control.Concurrent.STM.TMVar ( Control/Concurrent/STM/TMVar.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TMVar.o )
    [ 4 of 10] Compiling Control.Concurrent.STM.TQueue ( Control/Concurrent/STM/TQueue.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TQueue.o )
    [ 5 of 10] Compiling Control.Concurrent.STM.TVar ( Control/Concurrent/STM/TVar.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TVar.o )
    [ 6 of 10] Compiling Control.Concurrent.STM.TArray ( Control/Concurrent/STM/TArray.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Concurrent/STM/TArray.o )
    [ 7 of 10] Compiling Control.Monad.STM ( Control/Monad/STM.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Control/Monad/STM.o )
    
    /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack72480/stm-2.4.5.0/Control/Monad/STM.hs:34:9: error: Not in scope: ‘always’
       |
    34 |         always,
       |         ^^^^^^
    
    /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack72480/stm-2.4.5.0/Control/Monad/STM.hs:35:9: error: Not in scope: ‘alwaysSucceeds’
       |
    35 |         alwaysSucceeds,
       |         ^^^^^^^^^^^^^^
    
$

My ~/.stack/config.yaml:
stack-config.yaml.txt

Update
Attempt to disable allow-newer: True resulted in a bigger disaster:
stack-upgrade.out.txt

And I don't really want to succeed building stack with/for GHC-8.0.2 or such...

@snoyberg

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

Ok I'll re-enable the check and re-try

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

First, I don't quite like the fact that the enabled check saddled my system with GHC-8.2.2.

$ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1
$ stack upgrade --git --git-branch 4526-ghc-options-when-building-setup 2>&1 | tee ~/stack-upgrade.out.txt
Cloning stack
Cloning into 'stack'...
open-browser-0.2.1.0: configure
uuid-types-1.0.3: download
. . . . .
hackage-security-0.5.3.0: build
hackage-security-0.5.3.0: copy/register

--  While building package happy-1.19.9 using:
      /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --make -odir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -hidir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -package-db=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/install/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -hide-all-packages -package-id=Cabal-2.4.0.1-3bZfb3D11r2LsqHGk5ybV3 -package-id=base-4.10.1.0 -package-id=directory-1.3.0.2 -package-id=filepath-1.4.1.2 -optP-include -optP/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup_macros.h /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/Setup.lhs /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup -threaded
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/logs/happy-1.19.9.log

    [1 of 2] Compiling Main             ( /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/Setup.lhs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/Main.o )
    
    /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/Setup.lhs:48:22: warning: [-Wdeprecations]
        In the use of ‘rawSystemProgramConf’
        (imported from Distribution.Simple.Program):
        Deprecated: "use runDbProgram instead. This symbol will be removed in Cabal-3.0 (est. Oct 2018)."
       |
    48 |   let runProgram p = rawSystemProgramConf (fromFlagOrDefault normal (buildVerbosity flags))
       |                      ^^^^^^^^^^^^^^^^^^^^
    [2 of 2] Compiling StackSetupShim   ( /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/StackSetupShim.o )
    Linking /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/happy-1.19.9/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup ...
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    Undefined symbols for architecture x86_64:
      "_iconv", referenced from:
          _hs_iconv in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding_closure, _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _base_GHCziIOziEncodingziIconv_iconvEncoding14_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info )
      "_iconv_open", referenced from:
          _hs_iconv_open in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_open)
      "_iconv_close", referenced from:
          _hs_iconv_close in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_close)
      "_locale_charset", referenced from:
          _localeEncoding in libHSbase-4.10.1.0.a(PrelIOUtils.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    `clang' failed in phase `Linker'. (Exit code: 1)


--  While building package zip-archive-0.3.3 using:
      /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --make -odir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -hidir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -package-db=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/install/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -hide-all-packages -package-id=Cabal-2.4.0.1-3bZfb3D11r2LsqHGk5ybV3 -package-id=base-4.10.1.0 -optP-include -optP/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup_macros.h /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/Setup.hs /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup -threaded
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/logs/zip-archive-0.3.3.log

    [1 of 2] Compiling Main             ( /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/Setup.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/StackSetupShim.o )
    Linking /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/zip-archive-0.3.3/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup ...
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    Undefined symbols for architecture x86_64:
      "_iconv", referenced from:
          _hs_iconv in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding6_info, _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding14_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure )
      "_iconv_open", referenced from:
          _hs_iconv_open in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_open)
      "_iconv_close", referenced from:
          _hs_iconv_close in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_close)
      "_locale_charset", referenced from:
          _localeEncoding in libHSbase-4.10.1.0.a(PrelIOUtils.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    `clang' failed in phase `Linker'. (Exit code: 1)


--  While building package stm-chans-3.0.0.4 using:
      /Users/ur20980/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --make -odir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -hidir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/ur20980/.stack/snapshots/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -package-db=/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/install/x86_64-osx/custom-snapshot-for-building-stack-with-ghc-8.2.2-RcJFh0uLBqbP/8.2.2/pkgdb -hide-all-packages -package-id=Cabal-2.4.0.1-3bZfb3D11r2LsqHGk5ybV3 -package-id=base-4.10.1.0 -optP-include -optP/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup_macros.h /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/Setup.hs /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup -threaded
    Process exited with code: ExitFailure 1
    Logs have been written to: /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack-upgrade26862/stack/.stack-work/logs/stm-chans-3.0.0.4.log

    [1 of 2] Compiling Main             ( /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/Setup.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/StackSetupShim.o )
    Linking /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack26862/stm-chans-3.0.0.4/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup ...
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    Undefined symbols for architecture x86_64:
      "_iconv", referenced from:
          _hs_iconv in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding6_info, _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding14_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure )
      "_iconv_open", referenced from:
          _hs_iconv_open in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_open)
      "_iconv_close", referenced from:
          _hs_iconv_close in libHSbase-4.10.1.0.a(iconv.o)
         (maybe you meant: _hs_iconv_close)
      "_locale_charset", referenced from:
          _localeEncoding in libHSbase-4.10.1.0.a(PrelIOUtils.o)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    `clang' failed in phase `Linker'. (Exit code: 1)
$ 

The complete log:
stack-upgrade.out.txt

~/.stack/config.yaml:
stack-config.yaml.txt

As I said, some packages - including intero, hsdev, happy fail to build with stack. Apparently, this hasn't changed. From the given output, I cannot tell whether stack now looks into /opt/local/lib/liconv first (as it should according to ~/.stack/config.yaml) or not. Also, I've no idea whether the cloned environment (as stack cloned GHC-8.2.2 instead of using system GHC-8.6.3) even respects that global config file, or maybe it overrides it with whatever it pulls from Hackage - which would explain the error: if what's on Hackage could work in its standard configuration - I wouldn't need to customize config.yaml.

@snoyberg snoyberg closed this in 8da7f04 Mar 25, 2019

snoyberg added a commit that referenced this issue Mar 25, 2019

Merge pull request #4651 from commercialhaskell/4526-ghc-options-when…
…-building-setup

Apply GHC options when building Setup.hs (fixes #4526)
@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 25, 2019

This issue is closed - should I assume the problem it complained about is solved? Or should I expect intero and happy to keep failing the build by stack?

How should I try the version of stack with this PR merged? Just stack upgrade doesn't help:

$ stack upgrade
Current Stack version: 1.9.3, available download version: 1.9.3
Skipping binary upgrade, you are already running the most recent version
$ 
@snoyberg

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

I'm not really in a position to help you further. Comments like:

First, I don't quite like the fact that the enabled check saddled my system with GHC-8.2.2.

Make it clear that there's not much I can do to address your concerns, and so I'd rather focus my efforts where they'll make a positive impact. I'd recommend getting a binary built on another machine and using that.

@mouse07410

This comment has been minimized.

Copy link
Author

commented Mar 26, 2019

@snoyberg I don't think you understand. In addition to taking up the disk space (a scarce resource at least for me, maybe not for you), every additional downloaded toolchain increases the likelihood of the build process ignoring the global config parameters and doing its own thing instead, especially since those parameters are rather intricate - like what to pass to ghc or to gcc.

My experience with using stack to build intero is a good illustration of the above. The downloaded toolchain appears to ignore my global parameters, which is the only explanation I have for why packages that I create under my specified toolchain (coincidentally, installed system-wide) use the necessary parameters and build fine, but some other packages built with downloaded toolchains "outside of my control" fail to build - and fail to use the global config parameters.

I'm not really in a position to help you further

No problem. I don't seem to be able to use stack anyway because of its multiple shortcomings, so no point wasting your time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.