Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 718790 - dev-libs/opensc-0.19.0-r2 fails to build on arm/arm64
Summary: dev-libs/opensc-0.19.0-r2 fails to build on arm/arm64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal enhancement (vote)
Assignee: Cross compilation support
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-04-21 19:57 UTC by John L Chen
Modified: 2020-04-22 08:32 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John L Chen 2020-04-21 19:57:51 UTC
opensc fails to cross compile for arm64 targets with this error message:
===================
libtool: warning: relinking 'opensc-pkcs11.la'
libtool: install: (cd /build/hana/tmp/portage/dev-libs/opensc-0.19.0-r2/work/opensc-0.19.0/src/pkcs11; /bin/sh "/build/hana/tmp/portage/dev-libs/opensc-0.19.0-r2/work/opensc-0.19.0/libtool"  --tag CC --mode=relink armv7a-cros-linux-gnueabihf-clang -pthread -DPKCS11_THREAD_LOCKING -Os -pipe -march=armv8-a+crc -mtune=cortex-a57.cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wall -Wextra -Wno-unused-parameter -Werror -export-symbols ./pkcs11.exports -module -shared -avoid-version -no-undefined -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all -o opensc-pkcs11.la -rpath /usr/lib opensc_pkcs11_la-pkcs11-global.lo opensc_pkcs11_la-pkcs11-session.lo opensc_pkcs11_la-pkcs11-object.lo opensc_pkcs11_la-misc.lo opensc_pkcs11_la-slot.lo opensc_pkcs11_la-mechanism.lo opensc_pkcs11_la-openssl.lo opensc_pkcs11_la-framework-pkcs15.lo opensc_pkcs11_la-framework-pkcs15init.lo opensc_pkcs11_la-debug.lo opensc_pkcs11_la-pkcs11-display.lo ../../src/libopensc/libopensc.la ../../src/common/libscdl.la ../../src/common/libcompat.la -L/build/hana/usr/lib -lcrypto -ldl -inst-prefix-dir /build/hana/tmp/portage/dev-libs/opensc-0.19.0-r2/image)
libtool: relink: echo "{ global:" > .libs/opensc-pkcs11.ver
libtool: relink:  cat ./pkcs11.exports | sed -e "s/\(.*\)/\1;/" >> .libs/opensc-pkcs11.ver
libtool: relink:  echo "local: *; };" >> .libs/opensc-pkcs11.ver
libtool: relink:  armv7a-cros-linux-gnueabihf-clang -shared  -fPIC -DPIC  .libs/opensc_pkcs11_la-pkcs11-global.o .libs/opensc_pkcs11_la-pkcs11-session.o .libs/opensc_pkcs11_la-pkcs11-object.o .libs/opensc_pkcs11_la-misc.o .libs/opensc_pkcs11_la-slot.o .libs/opensc_pkcs11_la-mechanism.o .libs/opensc_pkcs11_la-openssl.o .libs/opensc_pkcs11_la-framework-pkcs15.o .libs/opensc_pkcs11_la-framework-pkcs15init.o .libs/opensc_pkcs11_la-debug.o .libs/opensc_pkcs11_la-pkcs11-display.o  -Wl,--whole-archive ../../src/common/.libs/libscdl.a ../../src/common/.libs/libcompat.a -Wl,--no-whole-archive  -L/build/hana/tmp/portage/dev-libs/opensc-0.19.0-r2/image/usr/lib -L/usr/lib -lopensc -L/build/hana/usr/lib -lz -lcrypto -ldl  -pthread -Os -march=armv8-a+crc -mtune=cortex-a57.cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -g -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all   -pthread -Wl,-soname -Wl,opensc-pkcs11.so -Wl,-version-script -Wl,.libs/opensc-pkcs11.ver -o .libs/opensc-pkcs11.so
ld.lld: error: /build/hana/usr/lib/../lib/crti.o is incompatible with armelf_linux_eabi
ld.lld: error: /usr/lib64/clang/11.0.0/lib/linux/clang_rt.crtbegin-armhf.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-pkcs11-global.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-pkcs11-session.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-pkcs11-object.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-misc.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-slot.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-mechanism.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-openssl.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-framework-pkcs15.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-framework-pkcs15init.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-debug.o is incompatible with armelf_linux_eabi
ld.lld: error: .libs/opensc_pkcs11_la-pkcs11-display.o is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libscdl.a(libscdl.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_dummy.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_strlcat.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_strlcpy.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_strnlen.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_getpass.o) is incompatible with armelf_linux_eabi
ld.lld: error: ../../src/common/.libs/libcompat.a(compat_getopt.o) is incompatible with armelf_linux_eabi
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
libtool:   error: error: relink 'opensc-pkcs11.la' with the above command before installing it
===================

The cause is libtool including DESTDIR in -L when make install is ran to relink the libs.

Running elibtoolize in src_prepare to apply "cross" patch would fix this.

Note: This happened on Chromium OS, and this bug is filed so that I have something to put in the BUG field when I submit the PR to upstream the fix. I'm new to Gentoo so if I did anything that's not in accordance with the common practice here, please let me know. Thank you.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-04-21 19:59:32 UTC
I think Chromium OS has their own bugtracker: https://www.chromium.org/for-testers/bug-reporting-guidelines.

Please let me know if I have misunderstood, but this doesn't seem like a Gentoo bug.
Comment 2 Jonas Stein gentoo-dev 2020-04-21 20:22:44 UTC
there is no arm64 in
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~m68k ppc ppc64 ~s390 ~sparc x86"

So I guess this is rather a feature request to add the keyword later?
Comment 3 Jonas Stein gentoo-dev 2020-04-21 20:23:10 UTC
sorry
Comment 4 John L Chen 2020-04-22 02:29:31 UTC
(In reply to Sam James (sec padawan) from comment #1)
> I think Chromium OS has their own bugtracker:
> https://www.chromium.org/for-testers/bug-reporting-guidelines.
> 
> Please let me know if I have misunderstood, but this doesn't seem like a
> Gentoo bug.

The bug is already tracked and fixed on Chromium OS, and a PR submitted in Chromium OS gerrit (See: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2145534).

However, the Chromium OS reviewer wanted me to upstream the patch in Gentoo, and thus I filed this bug so that I've something to write in the commit message. Please let me know if this (file a bug for a PR) is not the common practice.

Thank you.
Comment 5 Larry the Git Cow gentoo-dev 2020-04-22 08:32:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59cb1b18da5679404b96aefc573b149e66837d97

commit 59cb1b18da5679404b96aefc573b149e66837d97
Author:     John L Chen <zuan@chromium.org>
AuthorDate: 2020-04-21 20:02:41 +0000
Commit:     Mikle Kolyada <zlogene@gentoo.org>
CommitDate: 2020-04-22 08:31:47 +0000

    dev-libs/opensc: Add elibtoolize to fix cross compiling for arm/arm64
    
    opensc fails to cross compile for arm/arm64 target because libtool
    adds host /usr/lib64 to -L during make install when the libraries are
    relinked.
    
    Adding elibtoolize in src_prepare() applies the "cross" patch that
    fixes this.
    
    Closes: https://bugs.gentoo.org/718790
    Signed-off-by: John L Chen <zuan@chromium.org>
    Closes: https://github.com/gentoo/gentoo/pull/15460
    Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>

 dev-libs/opensc/opensc-0.20.0.ebuild | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)