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

cabal-install executable-stripping is off by default, contrary to documentation #10501

Open
mauke opened this issue Nov 1, 2024 · 0 comments

Comments

@mauke
Copy link

mauke commented Nov 1, 2024

Describe the bug
According to https://cabal.readthedocs.io/en/stable/cabal-project-description-file.html#cfg-field-executable-stripping, executable stripping is on by default ("Default value: True"). But it isn't.

To Reproduce

$ mkdir hello-world && cd hello-world
$ cabal init -n
[Info] Guessing dependencies...                                                                                                                                                                                                              
[Info] Using cabal specification: 3.12                                                                                                                                                                                                       
[Warn] unknown license type, you must put a copy in LICENSE yourself.                                                                                                                                                                        
[Info] Creating fresh file CHANGELOG.md...                                                                                                                                                                                                   
[Info] Creating fresh directory ./app...                                                                                                                                                                                                     
[Info] Creating fresh file app/Main.hs...                                                                                                                                                                                                    
[Info] Creating fresh file hello-world.cabal...                                                                                                                                                                                              
[Warn] No synopsis given. You should edit the .cabal file and add one.                                                                                                                                                                       
[Info] You may want to edit the .cabal file and add a Description field.                                                                                                                                                                     

$ cabal install --install-method=copy --installdir=bin
Wrote tarball sdist to
.../hello-world/dist-newstyle/sdist/hello-world-0.1.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - hello-world-0.1.0.0 (exe:hello-world) (requires build)
Starting     hello-world-0.1.0.0 (exe:hello-world)
Building     hello-world-0.1.0.0 (exe:hello-world)
Installing   hello-world-0.1.0.0 (exe:hello-world)
Completed    hello-world-0.1.0.0 (exe:hello-world)
Copying 'hello-world' to 'bin/hello-world'
$ file bin/hello-world
bin/hello-world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f01f23649275f7d42dfb4b6875ba1eaab4558218, with debug_info, not stripped

NB: with debug_info, not stripped

Expected behavior
For comparison:

$ rm bin/hello-world
$ { echo 'packages: .'; echo 'executable-stripping: True'; } > cabal.project
$ cabal install --install-method=copy --installdir=bin
Wrote tarball sdist to
.../hello-world/dist-newstyle/sdist/hello-world-0.1.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - hello-world-0.1.0.0 (exe:hello-world) (requires build)
Starting     hello-world-0.1.0.0 (exe:hello-world)
Building     hello-world-0.1.0.0 (exe:hello-world)
Installing   hello-world-0.1.0.0 (exe:hello-world)
Completed    hello-world-0.1.0.0 (exe:hello-world)
Copying 'hello-world' to 'bin/hello-world'
$ file bin/hello-world 
bin/hello-world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=400106adf4c1724d0afd02e49918c9ea835e8dc9, stripped

NB: stripped

This is the result I would have expected without setting executable-stripping manually in the project file.

System information

  • Operating system: Ubuntu Linux
  • cabal, ghc versions: 3.12.1.0, 9.2.8
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

1 participant