Skip to content

cabal install/build: static executables and stripping #7236

Closed
@prez

Description

@prez

Description
Various combinations of configure/build/install and --enable-executable-static / --enable-executable-stripping do not produce a static + stripped executable.

System information
Alpine Linux - musl libc and busybox.

~/test # cat /etc/alpine-release
3.12.0

~/test # cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library 

~/test # ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.3

Setup

~/test # ls
Main.hs     test.cabal

~/test # cat Main.hs 
main :: IO ()
main = putStrLn "Hello, Haskell!"

~/test # cat test.cabal 
cabal-version:       3.4
name:                test
version:             0.0.0

executable tst
  main-is:             Main.hs
  ghc-options:         -O2 -Wall -Wcompat
  default-language:    Haskell2010
  build-depends:       base >=4.14 && <4.15

Steps to reproduce

  1. trying cabal install, directly:

cabal install --installdir=. --install-method=copy --enable-executable-stripping --enable-executable-static
observation:

~/test # file tst
tst: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, with debug_info, not stripped

verbose output:

~/test # cabal install --verbose --installdir=. --install-method=copy  --enable-executable-stripping --enable-executable-static
Reading available packages of hackage.haskell.org...
Using most recent state (could not read timestamp file)
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
index-state(hackage.haskell.org) =
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
Resolving dependencies...
Wrote tarball sdist to /root/test/dist-newstyle/sdist/test-0.0.0.tar.gz
/root/.ghcup/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /root/.ghcup/bin
found ghc-pkg in /root/.ghcup/bin/ghc-pkg
/root/.ghcup/bin/ghc-pkg --version
/root/.ghcup/bin/ghc --supported-languages
/root/.ghcup/bin/ghc --info
creating /tmp/cabal-install.-9924/dist-newstyle
creating /tmp/cabal-install.-9924/dist-newstyle/cache
Compiler settings changed, reconfiguring...
/root/.ghcup/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /root/.ghcup/bin
found ghc-pkg in /root/.ghcup/bin/ghc-pkg
/root/.ghcup/bin/ghc-pkg --version
/root/.ghcup/bin/ghc --supported-languages
/root/.ghcup/bin/ghc --info
/root/.ghcup/bin/ghc --print-global-package-db
Reading available packages of hackage.haskell.org...
Using most recent state (could not read timestamp file)
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
index-state(hackage.haskell.org) =
/usr/bin/pkg-config --version
/usr/bin/pkg-config --variable pc_path pkg-config
/usr/bin/pkg-config --version
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion menu ncurses libffi panelw gmpxx panel ncursesw form formw gmp menuw
Resolving dependencies...
Component graph for test-0.0.0: component exe:tst
component test-0.0.0-e-tst-488ac8259d45e17088e8b41c4b86826f888a4087127f02fd74ae6953073e190a
    include base-4.14.1.0
unit test-0.0.0-e-tst-488ac8259d45e17088e8b41c4b86826f888a4087127f02fd74ae6953073e190a
    include base-4.14.1.0
Up to date
creating /tmp/cabal-install.-9924/dist-newstyle/build
creating /tmp/cabal-install.-9924/dist-newstyle/tmp
creating .
Copying 'tst' to './tst'

Oof, that didn't go well at all. Dynamic, not stripped.

  1. trying cabal build:
~/test # cabal clean

~/test # cabal build --enable-executable-stripping --enable-executable-static

observation:

~/test # file $(find dist-newstyle/ -type f -executable -print)
dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

verbose output:

~/test # cabal build --verbose --enable-executable-stripping --enable-executable-static
Project settings changed, reconfiguring...
creating /root/test/dist-newstyle
creating /root/test/dist-newstyle/cache
this build was affected by the following (project) config files:
Compiler settings changed, reconfiguring...
/root/.ghcup/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /root/.ghcup/bin
found ghc-pkg in /root/.ghcup/bin/ghc-pkg
/root/.ghcup/bin/ghc-pkg --version
/root/.ghcup/bin/ghc --supported-languages
/root/.ghcup/bin/ghc --info
/root/.ghcup/bin/ghc --print-global-package-db
Reading available packages of hackage.haskell.org...
Using most recent state (could not read timestamp file)
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
index-state(hackage.haskell.org) =
/usr/bin/pkg-config --version
/usr/bin/pkg-config --variable pc_path pkg-config
/usr/bin/pkg-config --version
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion menu ncurses libffi panelw gmpxx panel ncursesw form formw gmp menuw
Resolving dependencies...
Component graph for test-0.0.0: component exe:tst
component test-0.0.0-inplace-tst include base-4.14.1.0
unit test-0.0.0-inplace-tst include base-4.14.1.0
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built:
 - test-0.0.0 (exe:tst) (first run)
creating /root/test/dist-newstyle/build
creating /root/test/dist-newstyle/tmp
creating /root/test/dist-newstyle/packagedb
/root/.ghcup/bin/ghc-pkg init /root/test/dist-newstyle/packagedb/ghc-8.10.3
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3
creating /root/test/dist-newstyle/build/x86_64-linux
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/cache
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","configure","--verbose=2","--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst","--ghc","--prefix=/root/.cabal","--bindir=/root/.cabal/bin","--libdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst","--libsubdir=","--dynlibdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3","--libexecdir=/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0","--libexecsubdir=","--datadir=/root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0","--datasubdir=","--docdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0","--htmldir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html","--haddockdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html","--sysconfdir=/root/.cabal/etc","--enable-library-vanilla","--disable-library-profiling","--enable-shared","--disable-static","--disable-executable-dynamic","--enable-executable-static","--disable-profiling","--profiling-detail=default","--library-profiling-detail=default","--enable-optimization","--disable-debug-info","--disable-library-for-ghci","--disable-split-sections","--disable-split-objs","--enable-executable-stripping","--disable-library-stripping","--package-db=clear","--package-db=global","--package-db=/root/.cabal/store/ghc-8.10.3/package.db","--package-db=/root/test/dist-newstyle/packagedb/ghc-8.10.3","--cid=test-0.0.0-inplace-tst","--extra-prog-path=/root/.cabal/bin","--dependency=base=base-4.14.1.0","--disable-coverage","--exact-configuration","--with-ghc=/root/.ghcup/bin/ghc","--with-ghc-pkg=/root/.ghcup/bin/ghc-pkg","--ghc-option=-hide-all-packages","exe:tst"]
/root/.ghcup/bin/cabal-3.4.0.0-rc4 act-as-setup --build-type=Simple --
configure --verbose=2
--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
--ghc --prefix=/root/.cabal --bindir=/root/.cabal/bin
--libdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst
--libsubdir= --dynlibdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3
--libexecdir=/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0
--libexecsubdir=
--datadir=/root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0 --datasubdir=
--docdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0
--htmldir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html
--haddockdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html
--sysconfdir=/root/.cabal/etc --enable-library-vanilla
--disable-library-profiling --enable-shared --disable-static
--disable-executable-dynamic --enable-executable-static --disable-profiling
--profiling-detail=default --library-profiling-detail=default
--enable-optimization --disable-debug-info --disable-library-for-ghci
--disable-split-sections --disable-split-objs --enable-executable-stripping
--disable-library-stripping --package-db=clear --package-db=global
--package-db=/root/.cabal/store/ghc-8.10.3/package.db
--package-db=/root/test/dist-newstyle/packagedb/ghc-8.10.3
--cid=test-0.0.0-inplace-tst --extra-prog-path=/root/.cabal/bin
--dependency=base=base-4.14.1.0 --disable-coverage --exact-configuration
--with-ghc=/root/.ghcup/bin/ghc --with-ghc-pkg=/root/.ghcup/bin/ghc-pkg
--ghc-option=-hide-all-packages exe:tst
Using Parsec parser
Configuring executable 'tst' for test-0.0.0..
Dependency base ==4.14.1.0: using base-4.14.1.0
Source component graph: component exe:tst
Configured component graph:
    component test-0.0.0-inplace-tst include base-4.14.1.0
Linked component graph:
    unit test-0.0.0-inplace-tst include base-4.14.1.0
Ready component graph:
    definite test-0.0.0-inplace-tst depends base-4.14.1.0
Using Cabal-3.4.0.0 compiled by ghc-8.8
Using compiler: ghc-8.10.3
Using install prefix: /root/.cabal
Executables installed in: /root/.cabal/bin
Libraries installed in:
/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst
Dynamic Libraries installed in: /root/.cabal/lib/x86_64-linux-ghc-8.10.3
Private executables installed in:
/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0
Data files installed in: /root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0
Documentation installed in:
/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0
Configuration files installed in: /root/.cabal/etc
No alex found
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 10.2.1 found on system at: /usr/bin/cc
Using ghc version 8.10.3 given by user at: /root/.ghcup/bin/ghc
Using ghc-pkg version 8.10.3 given by user at: /root/.ghcup/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.24.0 found on system at: /root/.ghcup/bin/haddock
No happy found
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.68 found on system at: /root/.ghcup/bin/hpc
Using hsc2hs version 0.68.7 found on system at: /root/.ghcup/bin/hsc2hs
No hscolour found
No jhc found
Using ld found on system at: /usr/bin/ld
Using pkg-config version 1.7.3 found on system at: /usr/bin/pkg-config
Using runghc version 8.10.3 found on system at: /root/.ghcup/bin/runghc
Using strip version 2.35 found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","build","--verbose=2","--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst"]
/root/.ghcup/bin/cabal-3.4.0.0-rc4 act-as-setup --build-type=Simple -- build
--verbose=2
--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
Component build order: executable 'tst'
/root/.ghcup/bin/ghc-pkg init /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen
Preprocessing executable 'tst' for test-0.0.0..
Building executable 'tst' for test-0.0.0..
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp
/root/.ghcup/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -odir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -hidir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -stubdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i. -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -optP-include -optP/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /root/.cabal/store/ghc-8.10.3/package.db -package-db /root/test/dist-newstyle/packagedb/ghc-8.10.3 -package-db /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace -package-id base-4.14.1.0 -XHaskell2010 ./Main.hs -O2 -Wall -Wcompat -hide-all-packages
[1 of 1] Compiling Main             ( Main.hs, /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp/Main.o )
Linking...
/root/.ghcup/bin/ghc --make -fbuilding-cabal-package -O -static -outputdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -odir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -hidir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -stubdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i. -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -optP-include -optP/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen/cabal_macros.h -optl-static -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /root/.cabal/store/ghc-8.10.3/package.db -package-db /root/test/dist-newstyle/packagedb/ghc-8.10.3 -package-db /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace -package-id base-4.14.1.0 -XHaskell2010 ./Main.hs -o /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst -O2 -Wall -Wcompat -hide-all-packages
Linking /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst ...

Close, but no cigar. Static, not stripped.

  1. trying cabal configure followed by cabal build:
~/test # cabal clean

~/test # cabal configure --enable-executable-stripping --enable-executable-static

~/test # cabal build

observation:

~/test # file $(find dist-newstyle/ -type f -executable -print)
dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

verbose output:

~/test # cabal configure --verbose --enable-executable-stripping --enable-executable-static
Project settings changed, reconfiguring...
creating /root/test/dist-newstyle
creating /root/test/dist-newstyle/cache
this build was affected by the following (project) config files:
- /root/test/cabal.project.local
'cabal.project.local' already exists, backing it up to 'cabal.project.local~'.
Compiler settings changed, reconfiguring...
/root/.ghcup/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /root/.ghcup/bin
found ghc-pkg in /root/.ghcup/bin/ghc-pkg
/root/.ghcup/bin/ghc-pkg --version
/root/.ghcup/bin/ghc --supported-languages
/root/.ghcup/bin/ghc --info
/root/.ghcup/bin/ghc --print-global-package-db
Reading available packages of hackage.haskell.org...
Using most recent state (could not read timestamp file)
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.RemoteRepo {remoteRepoName = RepoName
"hackage.haskell.org", remoteRepoURI = http://hackage.haskell.org/,
remoteRepoSecure = Just True, remoteRepoRootKeys =
["fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0","1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42","2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3","0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d","51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921"],
remoteRepoKeyThreshold = 3, remoteRepoShouldTryHttps = True}
index-state(hackage.haskell.org) =
/usr/bin/pkg-config --version
/usr/bin/pkg-config --variable pc_path pkg-config
/usr/bin/pkg-config --version
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion menu ncurses libffi panelw gmpxx panel ncursesw form formw gmp menuw
Resolving dependencies...
Component graph for test-0.0.0: component exe:tst
component test-0.0.0-inplace-tst include base-4.14.1.0
unit test-0.0.0-inplace-tst include base-4.14.1.0
Build profile: -w ghc-8.10.3 -O1
In order, the following would be built:
 - test-0.0.0 (exe:tst) (first run)

~/test # cabal build --verbose
this build was affected by the following (project) config files:
- /root/test/cabal.project.local
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built:
 - test-0.0.0 (exe:tst) (first run)
creating /root/test/dist-newstyle/build
creating /root/test/dist-newstyle/tmp
creating /root/test/dist-newstyle/packagedb
/root/.ghcup/bin/ghc-pkg init /root/test/dist-newstyle/packagedb/ghc-8.10.3
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3
creating /root/test/dist-newstyle/build/x86_64-linux
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0
creating /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/cache
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","configure","--verbose=2","--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst","--ghc","--prefix=/root/.cabal","--bindir=/root/.cabal/bin","--libdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst","--libsubdir=","--dynlibdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3","--libexecdir=/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0","--libexecsubdir=","--datadir=/root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0","--datasubdir=","--docdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0","--htmldir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html","--haddockdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html","--sysconfdir=/root/.cabal/etc","--enable-library-vanilla","--disable-library-profiling","--enable-shared","--disable-static","--disable-executable-dynamic","--enable-executable-static","--disable-profiling","--profiling-detail=default","--library-profiling-detail=default","--enable-optimization","--disable-debug-info","--disable-library-for-ghci","--disable-split-sections","--disable-split-objs","--enable-executable-stripping","--disable-library-stripping","--package-db=clear","--package-db=global","--package-db=/root/.cabal/store/ghc-8.10.3/package.db","--package-db=/root/test/dist-newstyle/packagedb/ghc-8.10.3","--cid=test-0.0.0-inplace-tst","--extra-prog-path=/root/.cabal/bin","--dependency=base=base-4.14.1.0","--disable-coverage","--exact-configuration","--with-ghc=/root/.ghcup/bin/ghc","--with-ghc-pkg=/root/.ghcup/bin/ghc-pkg","--ghc-option=-hide-all-packages","exe:tst"]
/root/.ghcup/bin/cabal-3.4.0.0-rc4 act-as-setup --build-type=Simple --
configure --verbose=2
--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
--ghc --prefix=/root/.cabal --bindir=/root/.cabal/bin
--libdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst
--libsubdir= --dynlibdir=/root/.cabal/lib/x86_64-linux-ghc-8.10.3
--libexecdir=/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0
--libexecsubdir=
--datadir=/root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0 --datasubdir=
--docdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0
--htmldir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html
--haddockdir=/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0/html
--sysconfdir=/root/.cabal/etc --enable-library-vanilla
--disable-library-profiling --enable-shared --disable-static
--disable-executable-dynamic --enable-executable-static --disable-profiling
--profiling-detail=default --library-profiling-detail=default
--enable-optimization --disable-debug-info --disable-library-for-ghci
--disable-split-sections --disable-split-objs --enable-executable-stripping
--disable-library-stripping --package-db=clear --package-db=global
--package-db=/root/.cabal/store/ghc-8.10.3/package.db
--package-db=/root/test/dist-newstyle/packagedb/ghc-8.10.3
--cid=test-0.0.0-inplace-tst --extra-prog-path=/root/.cabal/bin
--dependency=base=base-4.14.1.0 --disable-coverage --exact-configuration
--with-ghc=/root/.ghcup/bin/ghc --with-ghc-pkg=/root/.ghcup/bin/ghc-pkg
--ghc-option=-hide-all-packages exe:tst
Using Parsec parser
Configuring executable 'tst' for test-0.0.0..
Dependency base ==4.14.1.0: using base-4.14.1.0
Source component graph: component exe:tst
Configured component graph:
    component test-0.0.0-inplace-tst include base-4.14.1.0
Linked component graph:
    unit test-0.0.0-inplace-tst include base-4.14.1.0
Ready component graph:
    definite test-0.0.0-inplace-tst depends base-4.14.1.0
Using Cabal-3.4.0.0 compiled by ghc-8.8
Using compiler: ghc-8.10.3
Using install prefix: /root/.cabal
Executables installed in: /root/.cabal/bin
Libraries installed in:
/root/.cabal/lib/x86_64-linux-ghc-8.10.3/test-0.0.0-inplace-tst
Dynamic Libraries installed in: /root/.cabal/lib/x86_64-linux-ghc-8.10.3
Private executables installed in:
/root/.cabal/libexec/x86_64-linux-ghc-8.10.3/test-0.0.0
Data files installed in: /root/.cabal/share/x86_64-linux-ghc-8.10.3/test-0.0.0
Documentation installed in:
/root/.cabal/share/doc/x86_64-linux-ghc-8.10.3/test-0.0.0
Configuration files installed in: /root/.cabal/etc
No alex found
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 10.2.1 found on system at: /usr/bin/cc
Using ghc version 8.10.3 given by user at: /root/.ghcup/bin/ghc
Using ghc-pkg version 8.10.3 given by user at: /root/.ghcup/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.24.0 found on system at: /root/.ghcup/bin/haddock
No happy found
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.68 found on system at: /root/.ghcup/bin/hpc
Using hsc2hs version 0.68.7 found on system at: /root/.ghcup/bin/hsc2hs
No hscolour found
No jhc found
Using ld found on system at: /usr/bin/ld
Using pkg-config version 1.7.3 found on system at: /usr/bin/pkg-config
Using runghc version 8.10.3 found on system at: /root/.ghcup/bin/runghc
Using strip version 2.35 found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
Using self-exec internal setup method with build-type Simple and args:
["act-as-setup","--build-type=Simple","--","build","--verbose=2","--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst"]
/root/.ghcup/bin/cabal-3.4.0.0-rc4 act-as-setup --build-type=Simple -- build
--verbose=2
--builddir=/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst
Component build order: executable 'tst'
/root/.ghcup/bin/ghc-pkg init /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen
Preprocessing executable 'tst' for test-0.0.0..
Building executable 'tst' for test-0.0.0..
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst
creating
/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp
/root/.ghcup/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -odir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -hidir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -stubdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i. -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -optP-include -optP/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen/cabal_macros.h -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /root/.cabal/store/ghc-8.10.3/package.db -package-db /root/test/dist-newstyle/packagedb/ghc-8.10.3 -package-db /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace -package-id base-4.14.1.0 -XHaskell2010 ./Main.hs -O2 -Wall -Wcompat -hide-all-packages
[1 of 1] Compiling Main             ( Main.hs, /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp/Main.o )
Linking...
/root/.ghcup/bin/ghc --make -fbuilding-cabal-package -O -static -outputdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -odir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -hidir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -stubdir /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -i. -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -i/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/global-autogen -I/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst-tmp -optP-include -optP/root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/autogen/cabal_macros.h -optl-static -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /root/.cabal/store/ghc-8.10.3/package.db -package-db /root/test/dist-newstyle/packagedb/ghc-8.10.3 -package-db /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/package.conf.inplace -package-id base-4.14.1.0 -XHaskell2010 ./Main.hs -o /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst -O2 -Wall -Wcompat -hide-all-packages
Linking /root/test/dist-newstyle/build/x86_64-linux/ghc-8.10.3/test-0.0.0/x/tst/build/tst/tst ...

Still static but not stripped...

So the conclusion is that stripping just doesn't work and static linking is unreliable, at least for me.
This is either a pretty sad state of affairs, or I am missing something very obvious.

Additionally, I also find the interaction between the commands in 2. and 3. and cabal install to be a bit weird, the executable is getting rebuilt even with the same flags set in install when running cabal install even though nothing changed and everything should be cached. But that is another topic.

Expected behavior
Stripped and statically linked executables.
(tst: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped)

Additional context
Ghc and cabal were installed via ghcup in a clean environment.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions