unsatisfiable constraints error when installing pdftk alpine linux
Asked Answered
C

3

5

When trying to install pdftk apk throws this error.

ERROR: unsatisfiable constraints:
  pdftk (missing):
    required by: world[pdftk]

Here is the whole output:

/opt/app # apk add pdftk
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  pdftk (missing):
    required by: world[pdftk]

I'm new to apk and not sure what the issue means or how to fix it.

Carmelcarmela answered 9/3, 2021 at 20:1 Comment(2)
not sure what the issue means there is no pdftk on alpine. Compile it yourself.Allare
@Allare it can't be compiles anymore. See my answer below using the java port.Tillio
T
1

The pdftk package for Alpine was discontinued starting with Alpine v3.9.

For using pdftk on Alpine, you could build the package from source, as suggested.
Alternatively, if you're comfortable with using an older Alpine version, you should be able to use it on Alpine V3.8.

Unfortunately, you won't be able to install pdftk from Alpine 3.8 repositories on a newer Alpine version due to unsatifiable constraints.

Tinaret answered 10/3, 2021 at 10:46 Comment(0)
T
5

I just installed it the same way it is done on debian using the java port of pdftk. Works fine.

apk add openjdk8
wget https://gitlab.com/pdftk-java/pdftk/-/jobs/924565145/artifacts/raw/build/libs/pdftk-all.jar
mv pdftk-all.jar pdftk.jar

Create a file called pdftk

$ nano pdftk

    #!/usr/bin/env bash
    java -jar "$0.jar" "$@"

Update file permissions and move it to bin directory

chmod 775 pdftk*
mv pdftk* /usr/local/bin

Then test with pdftk -version and you should see output similar to:

pdftk port to java 3.2.2 a Handy Tool for Manipulating PDF Documents
Copyright (c) 2017-2018 Marc Vinyals - https://gitlab.com/pdftk-java/pdftk
Copyright (c) 2003-2013 Steward and Lee, LLC.
pdftk includes a modified version of the iText library.
Copyright (c) 1999-2009 Bruno Lowagie, Paulo Soares, et al.
This is free software; see the source code for copying conditions. There is
NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Note that the pdftk java url will likely change. Get the latest here: https://gitlab.com/pdftk-java/pdftk#pre-built-binaries

I have also posted my answer on the alpine git: https://gitlab.alpinelinux.org/alpine/aports/-/issues/10136

Tillio answered 29/5, 2021 at 1:53 Comment(2)
Wow! Thank you for this answer! Really great explained. Helped a lot.Iinden
you sir are my hero :) I saved a lot of time I supposeWeiland
M
5

I managed to get @nicky solution to work on my alpine docker like this

# pdftk
RUN apk add openjdk8
RUN wget https://gitlab.com/pdftk- 
java/pdftk/-/jobs/924565145/artifacts/raw/build/libs/pdftk-all.jar
RUN mv pdftk-all.jar /usr/local/bin/pdftk.jar

COPY docker/php/pdftk /usr/local/bin/pdftk
RUN chmod 775 /usr/local/bin/pdftk*

of course, you have to create the pdftk as in @nicky's post, and put it in the appropriate folder relative to your dockerfile (here, ./docker/php for me). Note that in my case, i changed from bash to sh too in the file.

Masoretic answered 9/8, 2021 at 10:32 Comment(0)
T
1

The pdftk package for Alpine was discontinued starting with Alpine v3.9.

For using pdftk on Alpine, you could build the package from source, as suggested.
Alternatively, if you're comfortable with using an older Alpine version, you should be able to use it on Alpine V3.8.

Unfortunately, you won't be able to install pdftk from Alpine 3.8 repositories on a newer Alpine version due to unsatifiable constraints.

Tinaret answered 10/3, 2021 at 10:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.