Can't build epdfinfo to install pdf-tools
Closed this issue · 2 comments
Before everying, thank you a lot for this package. It's been a godsend as it fixed issues I had before with native-comp. Everything is perfect, except for this issue.
I'm not sure if this is the right place to ask, but I'm having problems when trying to run pdf-tools-install
, which builds epdfinfo. It works normally when using the regular packaged emacs from the Arch repos. But it fails to build when using this flatpak version, which outputs:
configure: error: in `/home/bruno/.emacs.d/straight/build/pdf-tools/build/server':
configure: error: C compiler cannot create executables
See `config.log' for more details
The log referenced does states it found gcc:
configure:3281: checking for gcc
configure:3302: found /app/bin/gcc
configure:3313: result: gcc
configure:3666: checking for C compiler version
configure:3675: gcc --version >&5
gcc (GCC) 12.2.0
But later it checks it again and exits the compilation:
configure:3686: $? = 1
configure:3675: gcc -version >&5
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
configure:3686: $? = 1
configure:3706: checking whether the C compiler works
configure:3728: gcc conftest.c >&5
gcc: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.
configure:3732: $? = 1
configure:3772: result: no
the problem with the gcc included inside the flatpak, is that is has been stripped and gutted of functionality to keep the size down. so it exists, but can only output code fed to it via libgccjit.
To get this to work pdf-tools would need to be added as an extension and built with the host compiler, rather than the gcc included inside the flatpak (which I'd prefer to remove if I could).
This would mean that pdf-tools should work, but pdf-tools-install would not behave in the traditional way.
I don't have a good grasp of extensions and may not be able to sink time into that inside the next few weeks, but if its something you or someone figures out before then I can take a patch.
So, after reading your response, I wondered if it would be possible to use host's gcc instead of the one included insided flatpak. After some research I finally found this very relevant issue.
It seems that they made the compilation possible using flatpak-spawn --host
. I'm really unfamiliar with flatpak, but I guess that this allows using the host's gcc? Either way, the linked issue contains a still to be approved PR which fixed the issue for me. Really happy that now I got Emacs with native-comp, PGTK and pdf-tools working perfectly!
Thank you for your assist and work done!