You are not logged in.

#1 2021-08-19 16:46:04

followait
Banned
Registered: 2019-11-01
Posts: 58

[SOLVED] package() in PKGBUILD error: Permission denied

PKGUBILD

# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.

# Maintainer: Your Name <youremail@domain.com>
pkgname=cppjieba
pkgver=2.0.0
pkgrel=1
pkgdesc="cut words"
arch=('x86_64')
url=""
license=('MIT')
groups=()
depends=( 'rapidjson')
makedepends=('git' 'gcc' 'cmake' 'ninja')

source=(
    'cppjieba::git+ssh://path/to/cppjieba.git'
)

sha512sums=('SKIP')

build()
{
    cd "${srcdir}/cppjieba"
    cmake -B out -S . -G Ninja -D CMAKE_BUILD_TYPE=Release
    cmake --build out
}

package()
{
    cd "${srcdir}/cppjieba"
    # ninja -C out install # this is also tried, same result as `cmake --install out`
    cmake --install out
} 

The output of

makepkg

shows that

build()

succeded, but

package()

failed with errors as below:

==> Entering fakeroot environment...
==> Starting package()...
-- Install configuration: "Release"
CMake Error at out/cmake_install.cmake:63 (file):
  file cannot create directory: /usr/local/lib/cmake/cppjieba.  Maybe need
  administrative privileges.

I have read some PKGBUILD files in aur.archlinux.org, they does this the same way, why do my PKGBUILD failed?

Last edited by followait (2021-08-19 17:02:01)

Offline

#2 2021-08-19 16:48:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] package() in PKGBUILD error: Permission denied

Because you have to write everything to $pkgdir. With make, the convention is that you do this by setting DESTDIR, not sure how ninja handles it.

Offline

#3 2021-08-19 16:53:09

followait
Banned
Registered: 2019-11-01
Posts: 58

Re: [SOLVED] package() in PKGBUILD error: Permission denied

Scimmia wrote:

Because you have to write everything to $pkgdir. With make, the convention is that you do this by setting DESTDIR, not sure how ninja handles it.

I don't find the keyword "DESTDIR" in working PKGBUILD files.
How should I fix my PKGBUILD?

EDIT
with "-D CMAKE_INSTALL_PREFIX=${pkgdir}/usr/local" for cmake, it's done

Thanks

Last edited by followait (2021-08-19 17:01:24)

Offline

Board footer

Powered by FluxBB