Search code examples
buildgnupgconfigure

How to link libgpg-error installed in custom directory to build the libgcrypt


I'm attempting to compile libgcrypt 1.8.10. I encountered the following issue when attempting to create libgcrypt with the command

./configure:
>checking whether to enable AMD64 as(1) feature detection... yes
>checking for gpg-error-config... no
>checking for GPG Error - version >= 1.25... no
>
>configure: error: libgpg-error is needed.
>                See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .

So I built and installed 'libgpg-error-1.47' in the '/tmp/Abhiyjn/app' directory. It was installed successfully. I then attempted to create libgcrypt once more, but I continued to receive the same issue. After that, I attempted to build libgcrypt again, but received the same issue. I attempted to execute the configure script using options

./configure --prefix=/tmp/Abhiyjn/app/ LDFLAGS="-L/tmp/Abhiyjn/app/lib" CFLAGS="-I/tmp/Abhiyjn/app/include"

./configure --prefix=/tmp/Abhiyjn/app/ --with-libgpg-error-prefix="/tmp/Abhiyjn/app/lib/libgpg-error.so" CFLAGS="-I/tmp/Abhiyjn/app/include"

./configure --prefix=/tmp/Abhiyjn/app/ LDFLAGS=-L"/tmp/Abhiyjn/app/lib/pkgconfig/"

but none of it is working, How can properly link the libgpg-error which I installed in a custome directory


Solution

  • After encountering difficulties linking libgpg-error to build libgcrypt, I found a solution that worked for me. Here's what I did:

    Build and Install libgpg-error:

    • I configured libgpg-error using the following configuration options:
      ./configure --prefix=/tmp/Abhiyjn/app --enable-install-gpg-error-config
      
    • After configuring, I built and installed libgpg-error into the custom directory /tmp/Abhiyjn/app. The gpg-error-config utility was installed in /tmp/Abhiyjn/app/bin.

    Build libgcrypt with Linked libgpg-error:

    • With libgpg-error successfully installed, I reattempted building libgcrypt. This time, I specified the location of the custom directory where the libgpg-error installed with the --with-libgpg-error-prefix option:
      ./configure --prefix=/tmp/Abhiyjn/app --with-libgpg-error-prefix=/tmp/Abhiyjn/app
      
    • Running ./configure with these options went without any issues. enter image description here

    Build and Install libgcrypt:

    • Finally, I built libgcrypt using make and installed it using make install. This installed libgcrypt into the custom directory /tmp/Abhiyjn/app.