You are not logged in.

#1 2025-09-01 01:51:03

TheElevatedOne
Member
From: Slovakia
Registered: 2025-09-01
Posts: 2
Website

[SOLVED] Installing a binary to /usr/bin results in an invalid binary

Hello, I have been writing and testing a PKGBUILD for one of my projects. (First time doing this)

I am building a binary from a python script via Nuitka.

The build process works fine and builds the binary as it should.

But in the install section, when running both

install -Dm755 build/ghost-dl "$pkgdir/usr/bin/ghost-dl"

And

install -dm755 "$pkgdir/usr/bin"
cp build/ghost-dl "$pkgdir/usr/bin/ghost-dl"
chmod 775 "$pkgdir/usr/bin/ghost-dl"

The resulting binary is 100KiB in size, not the 14MiB it is in the build directory.

I have tried to workaround it by copying it directly to

/usr/bin

but that makes it not uninstall with pacman and is an extreme malpractice.

Is there a way to install it in its full size?

File Sizes:

> exa -lGxh pkg/ghost-dl-git/usr/bin/ghost-dl
Permissions Size User             Date Modified  Name                                 
.rwxr-xr-x  100k the-elevated-one  1 Sep 03:46   pkg/ghost-dl-git/usr/bin/ghost-dl

> exa -lGxh src/ghost-dl/build/ghost-dl
Permissions Size User             Date Modified  Name                           
.rwxr-xr-x   14M the-elevated-one  1 Sep 03:48   src/ghost-dl/build/ghost-dl

PKGBUILD:

# Maintainer: Adam 'TheElevatedOne' Mladý <admin@elevated.ovh> -> https://github.com/TheElevatedOne

pkgname=ghost-dl-git
pkgver=v1.0.2.r2.ge10da92
pkgrel=1
pkgdesc="Kingdom Hearts Insider Game OST Archive Dowloader CLI"
arch=(x86_64)
url="https://github.com/TheElevatedOne/ghost-dl"
license=(GPL3)
depends=(glibc gcc python python-pip)
options=('!debug')
makedepends=(
  git
  clang
  patchelf
  ccache
)
provides=(ghost-dl)
conflicts=(ghost-dl)
source=("git+https://github.com/TheElevatedOne/ghost-dl.git#branch=main")
sha256sums=("SKIP")

pkgver() {
  cd "ghost-dl"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
  cd ..
}

build() {
  set -e
  cd "ghost-dl"
  python -m venv venv
  source venv/bin/activate
  pip install -r requirements.txt
  pip install nuitka
  if ! ls build; then mkdir build; fi
  python -m nuitka --onefile --follow-imports --main=ghost-dl.py --output-dir=build
  deactivate
  rm -rf venv
  rm -rf build/ghost-dl.build build/ghost-dl.dist build/ghost-dl.onefile-build
  mv build/ghost-dl.bin build/ghost-dl
  cd ..
}

check() {
  set -e
  cd "ghost-dl"
  ls build/ghost*
  cd ..
}

package() {
  set -e
  cd "ghost-dl"

  install -dm755 "$pkgdir/usr/bin/"
  cp build/ghost-dl "$pkgdir/usr/bin/ghost-dl"
  chmod 755 "$pkgdir/usr/bin/ghost-dl"
  # install -Dm755 build/ghost-dl "$pkgdir/url/bin/ghost-dl"
  install -D LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}

Last edited by TheElevatedOne (2025-09-01 02:34:29)

Offline

#2 2025-09-01 02:32:32

TheElevatedOne
Member
From: Slovakia
Registered: 2025-09-01
Posts: 2
Website

Re: [SOLVED] Installing a binary to /usr/bin results in an invalid binary

Solved!

After searching for a while I found an Arch Forum post where it was explained.

I needed to include

options=('!strip')

in the PKGBUILD.

Offline

Board footer

Powered by FluxBB