Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 836316 - sys-libs/liburing doesn't cross-compile
Summary: sys-libs/liburing doesn't cross-compile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-03-28 09:00 UTC by Jeremi Piotrowski
Modified: 2022-03-28 19:55 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 Jeremi Piotrowski 2022-03-28 09:00:03 UTC
sys-libs/liburing doesn't cross-compile because only the cc flag is passed to configure, but the value of cxx is used for linking some of the binaries.

Here's an excerpt from the build.log:
```
>>> Configuring source in /build/arm64-usr/var/tmp/portage/sys-libs/liburing-2.1-r1/work/liburing-2.1 ...
 * .arm64: running multilib-minimal_abi_src_configure
prefix                        /usr
includedir                    /usr/include
libdir                        /usr/lib64
libdevdir                     /usr/lib64
relativelibdir
mandir                        /usr/share/man
datadir                       /usr/share
stringop_overflow             yes
array_bounds                  yes
__kernel_rwf_t                yes
__kernel_timespec             yes
open_how                      no
statx                         yes
C++                           yes
has_ucontext                  yes
CC                            aarch64-cros-linux-gnu-gcc
CXX                           g++

...

aarch64-cros-linux-gnu-gcc -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ -I../src/include/ -include ../config-host.h -O2 -pipe -mtune=generic -g -D_GNU_SOURCE -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -L../src/ -o statx statx.c helpers.o -luring -Wstringop-overflow=0 -Warray-bounds=0
g++ -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ -I../src/include/ -include ../config-host.h -O2 -pipe -mtune=generic -g -O2 -pipe -mtune=generic -g -D_GNU_SOURCE -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -L../src/ -std=c++11 -o sq-full-cpp sq-full-cpp.cc helpers.o -luring -Wstringop-overflow=0 -Warray-bounds=0
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:165: sq-full-cpp] Error 1
make[1]: *** Waiting for unfinished jobs....
```
Comment 1 Larry the Git Cow gentoo-dev 2022-03-28 19:31:51 UTC
The bug has been referenced in the following commit(s):

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

commit 8aeeba04d1e08aa74cf50e402eb37477e402ec33
Author:     Jeremi Piotrowski <jpiotrowski@microsoft.com>
AuthorDate: 2022-03-24 11:17:22 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2022-03-28 19:31:34 +0000

    sys-libs/liburing: pass --cxx paramter to configure
    
    Provide the correct value to --cxx to fix cross-compilation. liburing uses the
    value of the cxx variable for linking. This happens to work for native builds
    but breaks when cross-compiling, as evidenced by the below output (from
    Flatcar):
    
    >>> Configuring source in /build/arm64-usr/var/tmp/portage/sys-libs/liburing-2.1-r1/work/liburing-2.1 ...
     * .arm64: running multilib-minimal_abi_src_configure
    prefix                        /usr
    includedir                    /usr/include
    libdir                        /usr/lib64
    libdevdir                     /usr/lib64
    relativelibdir
    mandir                        /usr/share/man
    datadir                       /usr/share
    stringop_overflow             yes
    array_bounds                  yes
    __kernel_rwf_t                yes
    __kernel_timespec             yes
    open_how                      no
    statx                         yes
    C++                           yes
    has_ucontext                  yes
    CC                            aarch64-cros-linux-gnu-gcc
    CXX                           g++
    
    ...
    
    aarch64-cros-linux-gnu-gcc -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ -I../src/include/ -include ../config-host.h -O2 -pipe -mtune=generic -g -D_GNU_SOURCE -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -L../src/ -o statx statx.c helpers.o -luring -Wstringop-overflow=0 -Warray-bounds=0
    g++ -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ -I../src/include/ -include ../config-host.h -O2 -pipe -mtune=generic -g -O2 -pipe -mtune=generic -g -D_GNU_SOURCE -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -L../src/ -std=c++11 -o sq-full-cpp sq-full-cpp.cc helpers.o -luring -Wstringop-overflow=0 -Warray-bounds=0
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: Relocations in generic ELF (EM: 183)
    /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: helpers.o: error adding symbols: file in wrong format
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:165: sq-full-cpp] Error 1
    make[1]: *** Waiting for unfinished jobs....
    
    Bug: https://bugs.gentoo.org/836316
    Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
    Closes: https://github.com/gentoo/gentoo/pull/24733
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 sys-libs/liburing/liburing-2.1-r1.ebuild | 1 +
 sys-libs/liburing/liburing-2.1-r2.ebuild | 1 +
 sys-libs/liburing/liburing-9999.ebuild   | 1 +
 3 files changed, 3 insertions(+)