Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 914708 - app-crypt/pinentry: cross compilation is broken
Summary: app-crypt/pinentry: cross compilation is broken
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2023-09-25 16:46 UTC by Allen Webb
Modified: 2024-02-24 23:11 UTC (History)
2 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 Allen Webb 2023-09-25 16:46:31 UTC
m4/curses.m4 is using an unprefixed path: "-I/usr/include/ncursesw"

```
aarch64-cros-linux-gnu-clang -DHAVE_CONFIG_H -I. -I..   -I/usr/include/ncursesw -I../pinentry -Wall  -Os -pipe  -march=armv8-a+crc+crypto -mtune=cortex-a55 -ftree-vectorize -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wall -Wno-pointer-sign -Wpointer-arith -c -o pinentry-curses.o pinentry-curses.c
error: include location '/usr/include/ncursesw' is unsafe for cross-compilation [-Werror,-Wpoison-system-directories]
```

I patched it to be prefixed (in src_prepare):
```
sed -i 's/-I$inetutils_cv_includedir_ncurses/-I$SYSROOT$inetutils_cv_includedir_ncurses/' \
	"${S}/m4/curses.m4" || die
```

Then it fails with linking issues because -L/usr/lib64 is set:
```
aarch64-cros-linux-gnu-clang  -Os -pipe  -march=armv8-a+crc+crypto -mtune=cortex-a55 -ftree-vectorize -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wall -Wno-pointer-sign -Wpointer-arith  -Wl,-O2 -Wl,--as-needed  -Wl,--gc-sections -Wl,--icf=all -o pinentry-curses pinentry-curses.o ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a ../secmem/libsecmem.a -L/usr/lib64 -lassuan -lgpg-error -lgpg-error  -lncursesw -ltinfow  
ld.lld: error: /build/corsola/usr/lib/../lib64/Scrt1.o is incompatible with elf64-x86-64
ld.lld: error: /build/corsola/usr/lib/../lib64/crti.o is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/clang_rt.crtbegin-aarch64.o is incompatible with elf64-x86-64
ld.lld: error: pinentry-curses.o is incompatible with elf64-x86-64
ld.lld: error: ../pinentry/libpinentry.a(pinentry.o) is incompatible with elf64-x86-64
ld.lld: error: ../pinentry/libpinentry.a(argparse.o) is incompatible with elf64-x86-64
ld.lld: error: ../pinentry/libpinentry.a(password-cache.o) is incompatible with elf64-x86-64
ld.lld: error: ../pinentry/libpinentry.a(pinentry-emacs.o) is incompatible with elf64-x86-64
ld.lld: error: ../pinentry/libpinentry-curses.a(libpinentry_curses_a-pinentry-curses.o) is incompatible with elf64-x86-64
ld.lld: error: ../secmem/libsecmem.a(secmem.o) is incompatible with elf64-x86-64
ld.lld: error: ../secmem/libsecmem.a(util.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(addtf3.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(comparetf2.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(divtc3.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(divtf3.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(extenddftf2.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(extendhftf2.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(extendsftf2.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(fixtfdi.c.o) is incompatible with elf64-x86-64
ld.lld: error: /usr/lib64/clang/17/lib/linux/libclang_rt.builtins-aarch64.a(fixtfsi.c.o) is incompatible with elf64-x86-64
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

I was able to work around that with the following in SRC prepare:
```
sed -i -e 's/LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG --libs`/LIBASSUAN_LIBS=`"${PKG_CONFIG}" libassuan --libs`/' \
	"${S}/m4/libassuan.m4" || die
```
Comment 1 Larry the Git Cow gentoo-dev 2024-02-24 23:11:08 UTC
The bug has been closed via the following commit(s):

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

commit a78a3ecdfec2294b96255a02be639741352a7314
Author:     James Le Cuirot <chewi@gentoo.org>
AuthorDate: 2024-02-24 23:10:23 +0000
Commit:     James Le Cuirot <chewi@gentoo.org>
CommitDate: 2024-02-24 23:10:23 +0000

    app-crypt/pinentry: Fix cross-compiling by using gpgrt-config
    
    It appears to be a reimplementation of pkg-config in Bash. It even uses the
    SYSROOT properly without setting any environment variables, seemingly by basing
    paths on where it was executed from. As such, using the build host's
    gpgrt-config doesn't work.
    
    Closes: https://bugs.gentoo.org/914708
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>

 app-crypt/pinentry/pinentry-1.2.1-r5.ebuild | 107 ++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)