1

Following the standard installation procedure of htop produces the following error:

~/htop-2.2.0 $ ./configure 
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/app/htop-2.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257

1 Answers1

1

You can't install things this way on Heroku.

When you heroku run bash you get a one-off dyno that will be discarded as soon as you log out. Even if the dyno wasn't discarded, it's not the dyno that your application runs on. Anything you want to install needs to be installed at build time and included in your application slug.

Instead, install htop via its Ubuntu package using multiple buildpacks and heroku-buildpack-apt.

Something like

  • heroku buildpacks:set heroku/python
  • heroku buildpacks:add --index 1 heroku-community/apt

should work for a Python application. Modify the first command depending on the main buildpack you wish to use.

Once you've set up your buildpacks, create a new Aptfile in the root of your project containing the names of the packages you wish to install:

htop

Commit, and deploy.

You should see htop and any other packages you require get installed at build time.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Unfortunately, it does not result in having htop when I connect via `heroku run` with the dyno. Even though htop *gets* installed at build time. – Lukasz Czerwinski Nov 25 '22 at 08:50
  • @LukaszCzerwinski, it should work just fine, especially if you are seeing it get installed during the build. What error messages do you get when you try to run it? Are you using Docker? – ChrisGPT was on strike Nov 25 '22 at 11:53