Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any advice on how to build a standalone binary for linux? #5

Open
alnutile opened this issue Apr 26, 2015 · 6 comments
Open

Any advice on how to build a standalone binary for linux? #5

alnutile opened this issue Apr 26, 2015 · 6 comments

Comments

@alnutile
Copy link

The boxes I need this to run on I can not download or install anything on but I can include in my git repo a binary as I already to with pdftk.

But this tool would be a lot better option since it does both steps for me in one eg make pages and images.

Thanks for you work!


it is an ubuntu box I need to make this for btw. I tried this
http://jurjenbokma.com/ApprenticesNotes/getting_statlinked_binaries_on_debian.html
but it did not work.

@mardukbp
Copy link

If using your (pressumably remote) git repo is an option, then I suggest you install junest. When you are done installing and adding junest to your $PATH, do the following:

junest -f
pacman -Syy
pacman -S pdf2svg

Exit junest (Ctrl-D) and setup an alias in your .bashrc:

alias pdf2svg='junest -- pdf2svg'

Close the Terminal and open a new one.

Enjoy!

@mardukbp
Copy link

Here's a more portable procedure:

  1. On a Linux (possibly virtual) machine where pdf2svg is installed download the CARE binary.
  2. Make it executable chmod +x care-x86_64
  3. Wrap pdf2svg in a self-contained environment: ./care-x86_64 pdf2svg
  4. On the machine where you want to use pdf2svg extract the archive: ./care-XXXX.bin
  5. Tell CARE about the directory where your PDFs are stored:
    1. nano care-XXXX/re-execute.sh
    2. Scroll down until you find lines starting with -b
    3. Add the following line to the family: -b "/home/USER/path/to/your/pdfs" \
    4. Find the line nearby that begins with -w and update your $HOME accordingly.
    5. Save (Ctrl + O) and exit (Ctrl + X)
  6. Run ./care-XXXX/re-execute.sh pdf2svg /home/USER/path/to/your/pdfs/file.pdf /home/USER/path/to/your/pdfs/file.svg

Enjoy!

@rgpublic
Copy link

Quite an old issue, but with the great help of the poppler folks, I finally I managed to build a true completely static pdf2svg binary. Perhaps this is also useful for others, so I'm posting it here. I used an Ubuntu Cosmic docker container to build it. Here is the relevant excerpt of the docker file:

https://gist.github.com/rgpublic/1a721599332402f55625afc3886b967a

Even if you don't want to use Docker and/or a Docker file, the necessary steps are pretty easy to understand as you can see.

NB: Working inside a docker container is only recommended in order to not spoil your system with all the unnecessary installs and packages. After you've build the static binary, you can take it anywhere and run it. Docker is NOT required later to use the static binary, of course.

The resulting binary is about 17 MB.

@DanieW
Copy link

DanieW commented Sep 23, 2020

Today (2020-09-23) I managed to compile this on CentOS 8. I needed to make some adaptions as follows:

Comment out line 90 in the source code by inserting "//" at the beginning of the line.:
{ pdf2svg.c:90:2: warning: ‘g_type_init’ is deprecated [-Wdeprecated-declarations] }

In order to have the development libraries available for compiling:
dnf install poppler-devel
dnf install poppler-glib-devel

Changed configure's line 2072 to "if true ; then " to bypass the deprecated test.
{ if eval "$MISSING --is-lightweight"; then -- is outdated}

I also could not find the code in pdf2svg-0.2.3-12.fc33.src.rpm

@dawbarton
Copy link
Owner

Today (2020-09-23) I managed to compile this on CentOS 8. I needed to make some adaptions as follows:

@DanieW: would you be able to submit a PR with these changes in? I'm sure others would appreciate them,

@DanieW
Copy link

DanieW commented Sep 24, 2020

Sorry, I was mistaken. It seems I have to do:
cat pdf2svg-0.2.3-12.fc33.src.rpm | rpm2cpio - | cpio -tv
to extract the source, whereas I tried
rpm -ivh --prefix=/opt pdf2svg-0.2.3-12.fc33.src.rpm
But still I propose the changes above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants