haskell / haskell/cabal

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

Open
#10,501 0 comments 0 reactions 0 assignees View on GitHub
needs triage type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**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

Contributor guide

Open the contributing guide

Research direction

Start with the cabal install path and the executable-stripping configuration described in the issue. Reproduce the Ubuntu case with and without executable-stripping in cabal.project, then verify that the default result matches the documented default and the explicit setting using file.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.