Statically compile gcrypt

72 views Asked by At

I've been bashing my head off this for a while now and am out of ideas.

What I want to do

I have an application written in C (on a linux platform) that has two main external dependencies. Raylib and gcrypt. I would like to package this application for distribution on Windows and Linux. Preferably via github CI, but even locally would be fine.

What I am trying

The application compiles and builds just fine with shared libraries, so I'm starting by just trying to build it statically. So as not to be struggling with github CI at the same time, I'm working locally for now.

I have built Raylib statically and have confirmed that there is no associated .so in the output of ldd.

For gcrypt, I have downloaded the source and built the .a after configuring the build with ./configure --enable-static --disable-shared --with-libgpg-error-prefix=/home/smolloy/Code/libgpg-error-1.47 I did a similar thing for libgpg-error, and then moved their .a files into an includes directory for my main build.

When trying to build my application with a -static flag, I get several hundred errors of the form:

/usr/bin/ld: ./includes//libgcrypt.a(libgcrypt_la-visibility.o): in function `gpg_err_make_from_errno':
/usr/include/gpg-error.h:1057:(.text+0x46): undefined reference to `gpg_err_code_from_errno'
/usr/bin/ld: ./includes//libgcrypt.a(libgcrypt_la-visibility.o): in function `_gcry_error_from_errno':
/home/smolloy/Code/libgcrypt-1.10.3/src/gcrypt-int.h:315:(.text+0x65): undefined reference to `gpg_err_code_from_errno'

My questions

Is this a reasonable way to attack my initial problem (i.e. trying to build executables for distribution) ? If not, then how should I be proceeding?

What am I doing wrong with my attempts at statically building this?

0

There are 0 answers