Skip to content

cabal-install 3.6.0.0 fails "list-bin" command? #7739

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

Closed
mouse07410 opened this issue Oct 10, 2021 · 1 comment
Closed

cabal-install 3.6.0.0 fails "list-bin" command? #7739

mouse07410 opened this issue Oct 10, 2021 · 1 comment

Comments

@mouse07410
Copy link
Collaborator

Describe the bug

cabal list-bin <target> fails to output the path to the executable it built, complains instead. Targets are clearly and unambiguously defined in the <Project>.cabal file.

To Reproduce

$ git clone https://github.com/agda/agda.git --recurse-submodules
$ cd agda
$ cabal v2-build --enable-tests --disable-documentation -foptimise-heavily -fenable-cluster-counting --ghc-options="+RTS -M6G -RTS" --program-suffix=-2.6.3 2>&1 | tee cabal-build-out.txt
.  .  .  .  .
[404 of 404] Compiling Agda.Main        ( src/full/Agda/Main.hs, /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/Main.o, /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/Main.dyn_o ) [Agda.Compiler.Backend changed]
ld: warning: directory not found for option '-L/usr/local/opt/icu4c/lib'
ld: warning: dylib (/opt/local/lib/libicuuc.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicui18n.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicudata.dylib) was built for newer macOS version (11.2) than being linked (11.0)
Preprocessing executable 'agda' for Agda-2.6.3..
Building executable 'agda' for Agda-2.6.3..
[1 of 1] Compiling Main             ( src/main/Main.hs, /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda/agda-tmp/Main.dyn_o ) [Agda.Main changed]
Linking /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda/agda ...
ld: warning: directory not found for option '-L/usr/local/opt/icu4c/lib'
ld: warning: dylib (/opt/local/lib/libicuuc.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicui18n.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicudata.dylib) was built for newer macOS version (11.2) than being linked (11.0)
Preprocessing test suite 'agda-tests' for Agda-2.6.3..
.  .  .  .  .
[63 of 63] Compiling Main             ( test/Main.hs, /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda-tests/agda-tests-tmp/Main.dyn_o ) [Test.Tasty.Silver.Filter changed]
Linking /Users/ur20980/src/agda/dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda-tests/agda-tests ...
ld: warning: directory not found for option '-L/usr/local/opt/icu4c/lib'
ld: warning: dylib (/opt/local/lib/libicui18n.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicuuc.dylib) was built for newer macOS version (11.2) than being linked (11.0)
ld: warning: dylib (/opt/local/lib/libicudata.dylib) was built for newer macOS version (11.2) than being linked (11.0)

real	26m55.345s
user	26m15.397s
sys	1m4.782s

and then:

$ rg agda Agda.cabal
8:author:          Ulf Norell and The Agda Team, see https://agda.readthedocs.io/en/latest/team.html
10:homepage:        http://wiki.portal.chalmers.se/agda/
11:bug-reports:     https://github.com/agda/agda/issues
29:  This package includes both a command-line program (agda) and an
31:  running @agda-mode setup@ (see the README).
95:                    JS/agda-rts.js
97:                    latex/agda.sty
.  .  .  .  .
806:executable agda
832:executable agda-mode
833:  hs-source-dirs:   src/agda-mode
852:test-suite agda-tests
920:  -- Since 'agda-tests' wants to call 'agda', we have to add it here,
922:  build-tool-depends: Agda:agda
$ 
$ cabal list-bin agda-mode
cabal: No or multiple targets given

$ cabal list-bin agda
cabal: No or multiple targets given

$ cabal list-bin agda-tests
cabal: No or multiple targets given

$ cabal list-bin Agda:agda
cabal: No or multiple targets given

$ ll dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/agda
-rwxr-xr-x  1 ur20980  staff  87928 Oct  9 20:19 dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/agda*
$ ll dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda-mode/agda-mode
-rwxr-xr-x  1 ur20980  staff  160408 Sep 28 23:26 dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/agda-mode/agda-mode*
$ 

Expected behavior
I expect to get back the correct path to the executable(s) that clearly exist where one would expect them to be, similar to my toy project below:

$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
 - h-tst1-0.1.0.0 (exe:h-tst1) (cannot read state cache)
Configuring executable 'h-tst1' for h-tst1-0.1.0.0..
Preprocessing executable 'h-tst1' for h-tst1-0.1.0.0..
Building executable 'h-tst1' for h-tst1-0.1.0.0..
[1 of 1] Compiling Main             ( Main.hs, /Users/ur20980/src/h-tst1/dist-newstyle/build/x86_64-osx/ghc-9.0.1/h-tst1-0.1.0.0/x/h-tst1/build/h-tst1/h-tst1-tmp/Main.dyn_o )
Linking /Users/ur20980/src/h-tst1/dist-newstyle/build/x86_64-osx/ghc-9.0.1/h-tst1-0.1.0.0/x/h-tst1/build/h-tst1/h-tst1 ...
$ cabal list-bin
cabal: One target is required, none provided

$ cabal list-bin h-tst1
/Users/ur20980/src/h-tst1/dist-newstyle/build/x86_64-osx/ghc-9.0.1/h-tst1-0.1.0.0/x/h-tst1/build/h-tst1/h-tst1
$ rg h-tst1 h-tst1.cabal 
2:-- Initial package description 'h-tst1.cabal' generated by 'cabal init'.
5:name:                h-tst1
18:executable h-tst1
$ 

System information

  • macOS Big Sur 11.6, Xcode-13.0
  • Cabal-3.6.0.0, GHC-9.0.1

Additional context
Agda is a fairly complex project, and its Agda.cabal file is 1108 lines long (h-tst1.cabal of my toy project is 24 lines only). Still, I'd expect cabal to be able to figure where exactly in dist-newsytle it placed the executables it compiled and linked.

My builds are dynamic, but that shouldn't make any difference, IMHO.
For toy project:

$ otool -L `cabal list-bin h-tst1`
/Users/ur20980/src/h-tst1/dist-newstyle/build/x86_64-osx/ghc-9.0.1/h-tst1-0.1.0.0/x/h-tst1/build/h-tst1/h-tst1:
	@rpath/libHSbase-4.15.0.0-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSghc-prim-0.7.0-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSrts-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
$ 

For Agda:

$ otool -L dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/agda
dist-newstyle/build/x86_64-osx/ghc-9.0.1/Agda-2.6.3/build/Agda/agda:
	@rpath/libHSAgda-2.6.3-inplace-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSbase-4.15.0.0-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSghc-prim-0.7.0-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libHSrts_thr-ghc9.0.1.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
$

If you need more info, please let me know.

@fgaz
Copy link
Member

fgaz commented Oct 10, 2021

Thanks for the detailed report. It looks like a dupicate of #7679, please comment there if you have further information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants