Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 267479 - dev-libs/libgcrypt tries to link against native libgpg-error when crosscompiling
Summary: dev-libs/libgcrypt tries to link against native libgpg-error when crosscompiling
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Crypto team [DISABLED]
URL: https://bugs.g10code.com/gnupg/issue1261
Whiteboard:
Keywords: LATER
: 334431 (view as bug list)
Depends on:
Blocks: 267503
  Show dependency tree
 
Reported: 2009-04-25 21:27 UTC by Andrei Slavoiu
Modified: 2017-04-08 18:58 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,63.48 KB, text/plain)
2009-04-25 21:28 UTC, Andrei Slavoiu
Details
libgcrypt-1.4.4.ebuild.patch (libgcrypt-1.4.4.ebuild.patch,419 bytes, patch)
2009-04-25 21:36 UTC, Andrei Slavoiu
Details | Diff
Updated patch to use SYSROOT instead of ROOT (libgcrypt-1.4.4.ebuild.patch,422 bytes, patch)
2009-04-26 06:58 UTC, Andrei Slavoiu
Details | Diff
libgpg-error-1.10-0001-Generate-and-install-a-pkg-config-file.patch (libgpg-error-1.10-0001-Generate-and-install-a-pkg-config-file.patch,1.66 KB, patch)
2012-09-17 22:03 UTC, Dennis Schridde
Details | Diff
libgcrypt-1.5.0-0001-Generate-and-install-a-pkg-config-file.patch (libgcrypt-1.5.0-0001-Generate-and-install-a-pkg-config-file.patch,1.41 KB, patch)
2012-09-17 22:03 UTC, Dennis Schridde
Details | Diff
libgcrypt-1.5.0-0002-Use-pkg-config-to-find-gpg-error.patch (libgcrypt-1.5.0-0002-Use-pkg-config-to-find-gpg-error.patch,985 bytes, patch)
2012-09-17 22:03 UTC, Dennis Schridde
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Slavoiu 2009-04-25 21:27:23 UTC
/bin/sh ../libtool --tag=CC   --mode=link armv4tl-softfloat-linux-gnueabi-gcc  -march=armv4t -mtune=arm920t -Os -pipe -fvisibility=hidden -Wall    -Wl,--version-script=./libgcrypt.vers -version-info 16:2:5 -Wl,-O1 -o libgcrypt.la -rpath /usr/lib libgcrypt_la-visibility.lo libgcrypt_la-misc.lo libgcrypt_la-global.lo libgcrypt_la-sexp.lo libgcrypt_la-hwfeatures.lo libgcrypt_la-stdmem.lo libgcrypt_la-secmem.lo libgcrypt_la-missing-string.lo libgcrypt_la-module.lo libgcrypt_la-fips.lo libgcrypt_la-hmac256.lo libgcrypt_la-ath.lo ../cipher/libcipher.la ../random/librandom.la ../mpi/libmpi.la -L/usr/lib64 -lgpg-error
armv4tl-softfloat-linux-gnueabi-gcc -shared  .libs/libgcrypt_la-visibility.o .libs/libgcrypt_la-misc.o .libs/libgcrypt_la-global.o .libs/libgcrypt_la-sexp.o .libs/libgcrypt_la-hwfeatures.o .libs/libgcrypt_la-stdmem.o .libs/libgcrypt_la-secmem.o .libs/libgcrypt_la-missing-string.o .libs/libgcrypt_la-module.o .libs/libgcrypt_la-fips.o .libs/libgcrypt_la-hmac256.o .libs/libgcrypt_la-ath.o -Wl,--whole-archive ../cipher/.libs/libcipher.a ../random/.libs/librandom.a ../mpi/.libs/libmpi.a -Wl,--no-whole-archive  -L/usr/lib64 /usr/lib64/libgpg-error.so  -march=armv4t -mtune=arm920t -Wl,--version-script=./libgcrypt.vers -Wl,-O1 -Wl,-soname -Wl,libgcrypt.so.11 -o .libs/libgcrypt.so.11.5.2
/usr/lib64/libgpg-error.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [libgcrypt.la] Error 1
make[2]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.4.4/work/libgcrypt-1.4.4/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.4.4/work/libgcrypt-1.4.4'
make: *** [all] Error 2
 *
 * ERROR: dev-libs/libgcrypt-1.4.4 failed.

During configure it shows this message:
checking for gpg-error-config... /usr/bin/gpg-error-config                                                                                                                          


Reproducible: Always

Steps to Reproduce:
Comment 1 Andrei Slavoiu 2009-04-25 21:28:07 UTC
Created attachment 189428 [details]
build log

Full build log
Comment 2 Andrei Slavoiu 2009-04-25 21:36:05 UTC
Created attachment 189430 [details, diff]
libgcrypt-1.4.4.ebuild.patch

Patch that fixes this.
NOTE: in order for the patch to work the following post-install hook must be used (as I understood from googling about this this is a known problem with libtool)
# cat /usr/armv4tl-softfloat-linux-gnueabi/etc/portage/bashrc
# This script is inspired from the one posted by Mike Frysinge here http://www.nabble.com/Cross-compile-and-libtool-td13912879.html

post_src_install() {
        for i in $D/usr/lib*/*.la; do
                if [ -f $i ]; then
                        einfo "post_src_install hook: Fixing .la file $i"
                        sed -i -e "/^libdir=/s:=:='$SYSROOT':" $i
                else
                        einfo "post_src_install hook: No .la files were installed, nothing to fix"
                fi
        done
}
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-04-26 00:03:31 UTC
Comment on attachment 189430 [details, diff]
libgcrypt-1.4.4.ebuild.patch

ROOT variable cannot be used in src_* functions.
Comment 4 Andrei Slavoiu 2009-04-26 06:58:27 UTC
Created attachment 189461 [details, diff]
Updated patch to use SYSROOT instead of ROOT
Comment 5 Dane Smith (RETIRED) gentoo-dev 2010-12-02 18:14:51 UTC
*** Bug 334431 has been marked as a duplicate of this bug. ***
Comment 6 Dane Smith (RETIRED) gentoo-dev 2010-12-02 21:18:13 UTC
configure is using gpg-error-config --libs and gpg-error-config --cflags to get information. I believe that the problem is stemming from the fact that the parent systems gpg-error-config is the one used if it's present.

Mike, what is the best way to handle this? Is the solution posted the generally accepted way? Or perhaps something like
+ if tc-is-cross-compiler; then
+               export LIBGCRYPT_CONFIG="${SYSROOT}/usr/bin/libgcrypt-config"
+       fi

from bug 267503
Comment 7 SpanKY gentoo-dev 2010-12-03 05:06:27 UTC
Comment on attachment 189461 [details, diff]
Updated patch to use SYSROOT instead of ROOT

SYSROOT should not show up in any ebuild
Comment 8 SpanKY gentoo-dev 2010-12-03 05:07:26 UTC
the actual bug here is that libgcrypt wrongly uses AC_PATH_PATH in its code.  it should be using AC_PATH_TOOL.  i reported this upstream a while ago.
Comment 9 Dane Smith (RETIRED) gentoo-dev 2010-12-03 13:33:45 UTC
(In reply to comment #8)
> the actual bug here is that libgcrypt wrongly uses AC_PATH_PATH in its code. 
> it should be using AC_PATH_TOOL.  i reported this upstream a while ago.
> 
From within the working source directory:
find . | xargs grep AC_PATH_PATH

returns nothing.

find . | xargs grep AC_PATH_TOOL however has results:
./autom4te.cache/requests:                        'AC_PATH_TOOL_PREFIX' => 1,
./autom4te.cache/requests:                        'AC_PATH_TOOL_PREFIX' => 1,
./autom4te.cache/traces.2:m4trace:m4/libtool.m4:2810: -1- AU_DEFUN([AC_PATH_TOOL_PREFIX], [m4_if($#, 0, [_LT_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX($@)])])
./autom4te.cache/traces.2:m4trace:m4/libtool.m4:2810: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_DIAGNOSE([obsolete], [The macro `AC_PATH_TOOL_PREFIX' is obsolete.
./autom4te.cache/traces.1:m4trace:m4/libtool.m4:1889: -1- AC_DEFUN([AC_PATH_TOOL_PREFIX], [AC_REQUIRE([AC_PROG_EGREP])dnl
./autom4te.cache/traces.1:m4trace:m4/libtool.m4:1952: -1- AC_DEFUN([AC_PATH_MAGIC], [AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
./autom4te.cache/traces.1:    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
./autom4te.cache/traces.1:m4trace:configure.ac:136: -1- AC_PATH_TOOL_PREFIX([${ac_tool_prefix}file], [/usr/bin$PATH_SEPARATOR$PATH])
./autom4te.cache/traces.1:m4trace:configure.ac:136: -1- AC_PATH_TOOL_PREFIX([file], [/usr/bin$PATH_SEPARATOR$PATH])
./m4/libtool.m4:AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
./m4/libtool.m4:dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])

So it looks like upstream may have fixed it (incorrectly)?
Comment 10 SpanKY gentoo-dev 2010-12-03 19:53:42 UTC
i meant AC_PATH_PROG

autom4te.cache isnt relevant as that is all cache state.  none of it comes from upstream.
Comment 11 Daniel Kurtz 2010-12-07 02:11:04 UTC
I read what vapier said here:
https://bugs.g10code.com/gnupg/issue1261

However, I don't think it is quite as simple as using AC_PATH_TOOL instead of AC_PATH_PROG.  This searches for ${host}-gpg-error-config in $PATH.  But, at least on my system, gpg-error-config's name isn't prefixed, but we want to search for it in ${SYSROOT}/usr/bin.

Hence, the patches by Andrei work... is there a better way of doing this without using ${SYSROOT} or ${ROOT} in the ebuild itself? 
Comment 12 SpanKY gentoo-dev 2010-12-07 04:05:36 UTC
and that's the point of cross-fix-root that is already part of crossdev
Comment 13 Dennis Schridde 2012-09-17 22:02:24 UTC
The issue seems to persist in dev-libs/libgcrypt-1.5.0-r2.

I fixed it using a set of patches that can be found in the ambro-cross overlay at [1] and [2]. (Also attached here and submitted upstream.)

[1] http://code.google.com/p/ambro-cross-overlay/source/browse/#svn%2Ftrunk%2Fdev-libs%2Flibgpg-error%2Ffiles
[2] http://code.google.com/p/ambro-cross-overlay/source/browse/#svn%2Ftrunk%2Fdev-libs%2Flibgcrypt%2Ffiles
Comment 14 Dennis Schridde 2012-09-17 22:03:01 UTC
Created attachment 324126 [details, diff]
libgpg-error-1.10-0001-Generate-and-install-a-pkg-config-file.patch
Comment 15 Dennis Schridde 2012-09-17 22:03:18 UTC
Created attachment 324128 [details, diff]
libgcrypt-1.5.0-0001-Generate-and-install-a-pkg-config-file.patch
Comment 16 Dennis Schridde 2012-09-17 22:03:32 UTC
Created attachment 324130 [details, diff]
libgcrypt-1.5.0-0002-Use-pkg-config-to-find-gpg-error.patch
Comment 17 SpanKY gentoo-dev 2012-09-17 23:19:03 UTC
unfortunately, upstream is stupid and isn't interested in supporting .pc files.  and our downstream isn't interested in adding them either.
Comment 18 Dennis Schridde 2012-09-18 00:10:01 UTC
(In reply to comment #17)
> unfortunately, upstream is stupid and isn't interested in supporting .pc
> files.  and our downstream isn't interested in adding them either.
Let us hope they changed their opinion. I submitted the patches anyway:
http://lists.gnupg.org/pipermail/gnupg-devel/2012-September/026908.html
http://lists.gnupg.org/pipermail/gcrypt-devel/2012-September/001985.html
Comment 19 Justin Lecher (RETIRED) gentoo-dev 2012-10-27 09:41:25 UTC
(In reply to comment #17)
> unfortunately, upstream is stupid and isn't interested in supporting .pc
> files.  and our downstream isn't interested in adding them either.

So I assume that I have the permission to add it?
Comment 20 SpanKY gentoo-dev 2012-10-27 18:47:06 UTC
(In reply to comment #19)

Diego said no last i heard to cleaning up gpg related packages