All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
To: richard.purdie@linuxfoundation.org,
	openembedded-core@lists.openembedded.org
Cc: Thomas Perrot <thomas.perrot@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Khem Raj <raj.khem@gmail.com>
Subject: Re: [OE-core] [scarthgap] recipe's sysroot misconfiguration in multilib
Date: Wed, 26 Mar 2025 20:15:16 +0100	[thread overview]
Message-ID: <29e667c7-c9d9-496c-b7b7-bf580c39eda4@bootlin.com> (raw)
In-Reply-To: <296b0e95be234db91dfaa8164e45d035973aa459.camel@linuxfoundation.org>

Hello, Richard

Thanks for your reply

On 3/26/25 19:55, Richard Purdie via lists.openembedded.org wrote:
> On Wed, 2025-03-26 at 19:47 +0100, Joao Marcos Costa wrote:
>> I have been trying to set up a multilib environment to generate
>> libraries built with Control Flow Integrity support. The gcc toolchain
>> is already patched to support this custom multilib ABI, and it is indeed
>> capable of generating binaries with the CFI flags.
>>
>> I am, however, facing this strange issue where a header is not found in
>> the multilib recipe-sysroot (i.e., libcfi-recipe-sysroot) of a given
>> package (e.g., zstd), and do_compile task fails:
>>
(...)
>>
>> Besides my TUNE_*, DEFAULTTUNE, BASE_LIB values set up, I also added
>> 'GCCMULTILIB = "--enable-multilib"' to gcc-cross.inc, to enable multilib
>> for the cross toolchain. Could I be missing something, maybe with
>> recipes-devtools/gcc/gcc-multilib-config.inc?
> 
> I'm finding it odd that you have to add --enable-multilib since in
> general with gcc-cross, we use separate cross toolchains for each
> multilib. This kind of implies you're configuring the setup differently
> to how the system would expect.

If I don't, my cross toolchain is configured with "--disable-multilib". 
To confirm this, I ran gcc with "-v" from within the recipe's native 
sysroot, and the output is:

Target: riscv64-freedomusdkmllibcfi-linux
Configured with: 
../../../../../../work-shared/gcc-internal-13.2.0-r0/git/configure 
--build=x86_64-linux --host=x86_64-linux 
--target=riscv64-freedomusdkmllibcfi-linux --prefix=//host/usr 
--exec_prefix=//host/usr 
--bindir=//host/usr/bin/riscv64-freedomusdkmllibcfi-linux 
--sbindir=//host/usr/bin/riscv64-freedomusdkmllibcfi-linux 
--libexecdir=//host/usr/libexec/riscv64-freedomusdkmllibcfi-linux 
--datadir=//host/usr/share --sysconfdir=//host/etc 
--sharedstatedir=//host/com --localstatedir=//host/var 
--libdir=//host/usr/lib/riscv64-freedomusdkmllibcfi-linux 
--includedir=//host/usr/include --oldincludedir=//host/usr/include 
--infodir=//host/usr/share/info --mandir=//host/usr/share/man 
--disable-silent-rules --disable-dependency-tracking 
--with-libtool-sysroot=//host --enable-clocale=generic --with-gnu-ld 
--enable-shared --enable-languages=c,c++,fortran --enable-threads=posix 
--disable-multilib --enable-default-pie --enable-c99 --enable-long-long 
--enable-(...)

As a consequence, the build fails even before it gets to libcfi-zstd:

...libcfi-glibc-internal/2.37/recipe-sysroot-native/usr/bin/riscv64-freedomusdkmllibcfi-linux/../../libexec/riscv64-freedomusdkmllibcfi-linux/gcc/riscv64-freedomusdkmllibcfi-linux/13.2.0/ld.bfd: 
cannot find -lgcc: No such file or directory
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:1293: 
...libcfi-glibc-internal/2.37/build-riscv64-freedomusdkmllibcfi-linux/elf/librtld.map] 
Error 1


> 
> The recipe-sysroot-native/installeddeps/ directory will show you what
> is installed in each and might help narrow down the size difference.
> 

Oddly enough, both installeddeps seem to contain (at least) the same 
number of items:

$ ls -l zstd/1.5.5/recipe-sysroot-native/installeddeps/ | wc -l
74
$ ls 
../riscv64cfi-freedomusdkmllibcfi-linux/libcfi-zstd/1.5.5/recipe-sysroot-native/installeddeps/ 
-l | wc -l
75

But, to be honest, my comparison didn't go any further than comparing 
this line count.

> Cheers,
> 
> Richard

Thanks!

-- 
Best regards,
João Marcos Costa


  reply	other threads:[~2025-03-26 19:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5be84788-6fa5-453c-83bc-d547246dc037@bootlin.com>
2025-03-26 18:55 ` [scarthgap] recipe's sysroot misconfiguration in multilib Richard Purdie
2025-03-26 19:15   ` Joao Marcos Costa [this message]
2025-03-26 19:26     ` [OE-core] " Khem Raj
2025-03-26 20:54       ` Joao Marcos Costa
2025-03-26 21:28         ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29e667c7-c9d9-496c-b7b7-bf580c39eda4@bootlin.com \
    --to=joaomarcos.costa@bootlin.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=thomas.perrot@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.