All of lore.kernel.org
 help / color / mirror / Atom feed
* rpmbuild doesn't work on the target system out of the box with standard macros in the specfile
@ 2023-07-14 12:53 Böszörményi Zoltán
  2023-07-14 13:23 ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 4+ messages in thread
From: Böszörményi Zoltán @ 2023-07-14 12:53 UTC (permalink / raw)
  To: OpenEmbedded Core Mailing List

Hi,

I have to create a Yocto based system with a lot of developer
tools and SDK including rpmbuild. This is because a third party
developer is comfortable with building stuff on hardware but
not with cross-compiling and creating Bitbake recipes.

Anyway, with the image created and installed, I tried to build
an RPM from an autotools based project on the target system
The specfile used the standard %configure macro.

./configure stopped with an error saying the compiler doesn't
produce working binaries.

It turned out that %optflags was not defined correctly and
in this case rpm --eval "%optflags" returns the passed-in
string as is.

The OS was built using MACHINE=genericx86-64 and
I had to make this change manually in rpmrc to make it work:

--------------------------------------------------------------------
# diff -u /usr/lib/rpm/rpmrc.old /usr/lib/rpm/rpmrc
--- /usr/lib/rpm/rpmrc.old    2023-05-18 12:28:44.000000000 +0000
+++ /usr/lib/rpm/rpmrc    2023-07-14 12:34:59.840691763 +0000
@@ -380,6 +380,8 @@
  buildarchtranslate: x86_64: x86_64
  buildarchtranslate: amd64: x86_64
  buildarchtranslate: ia32e: x86_64
+buildarchtranslate: genericx86_64: x86_64
+buildarchtranslate: core2_64: x86_64

  buildarchtranslate: sh3: sh3
  buildarchtranslate: sh4: sh4
--------------------------------------------------------------------

I think a lot of other BSPs would have the same issue.
For one, meta-intel defines BSPs that produce builds for newer
archs than genericx86-64. They probably wouldn't work either.

It would be nice if Yocto's rpm recipe added the possible
buildarchtranslate lines for BSP target archs automatically.

Best regards,
Zoltán Böszörményi



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] rpmbuild doesn't work on the target system out of the box with standard macros in the specfile
  2023-07-14 12:53 rpmbuild doesn't work on the target system out of the box with standard macros in the specfile Böszörményi Zoltán
@ 2023-07-14 13:23 ` Ross Burton
  2023-07-14 13:48   ` Böszörményi Zoltán
       [not found]   ` <1771C00C48FCDC1F.28005@lists.openembedded.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Ross Burton @ 2023-07-14 13:23 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: OpenEmbedded Core Mailing List

On 14 Jul 2023, at 13:53, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> It would be nice if Yocto's rpm recipe added the possible
> buildarchtranslate lines for BSP target archs automatically.

As you’re in the perfect position to test this, would you be willing to come up with a patch?

It might be as simple as only changing the macro files in native builds, so the target rpm has conventional macros.  Then again I don’t know much about RPM so may be wrong!

A test case that does a simple build using rpm would be a good step too.

Cheers,
Ross

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] rpmbuild doesn't work on the target system out of the box with standard macros in the specfile
  2023-07-14 13:23 ` [OE-core] " Ross Burton
@ 2023-07-14 13:48   ` Böszörményi Zoltán
       [not found]   ` <1771C00C48FCDC1F.28005@lists.openembedded.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Böszörményi Zoltán @ 2023-07-14 13:48 UTC (permalink / raw)
  To: Ross Burton; +Cc: OpenEmbedded Core Mailing List

2023. 07. 14. 15:23 keltezéssel, Ross Burton írta:
> On 14 Jul 2023, at 13:53, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>> It would be nice if Yocto's rpm recipe added the possible
>> buildarchtranslate lines for BSP target archs automatically.
> As you’re in the perfect position to test this, would you be willing to come up with a patch?

I am trying to.
Currently I am stuck with making this work for Yocto 3.4.
Later I may be able to come up with something that works for Yocto master.

> It might be as simple as only changing the macro files in native builds, so the target rpm has conventional macros.  Then again I don’t know much about RPM so may be wrong!

rpmrc and the platform specific macros file need changing.

rpm --eval '%{_arch}' also not correct. strace shows that
it looks at the contents of /etc/rpm/platform and then
wants to read /usr/lib/rpm/platform/<platform>/macros
which doesn't exist for e.g. platform=genericx86-64 or
other BSPs.

Also, I am not using multiarch so the default
/usr/lib/rpm/platform/x86_64-linux/macros is not correct
as it tells rpmbuild to use /usr/lib64 as opposed to use /usr/lib.

Not sure what to do with a multiarch Yocto build.

> A test case that does a simple build using rpm would be a good step too.
>
> Cheers,
> Ross



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] rpmbuild doesn't work on the target system out of the box with standard macros in the specfile
       [not found]   ` <1771C00C48FCDC1F.28005@lists.openembedded.org>
@ 2023-07-24 12:40     ` Böszörményi Zoltán
  0 siblings, 0 replies; 4+ messages in thread
From: Böszörményi Zoltán @ 2023-07-24 12:40 UTC (permalink / raw)
  To: Ross Burton; +Cc: OpenEmbedded Core Mailing List

2023. 07. 14. 15:48 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 07. 14. 15:23 keltezéssel, Ross Burton írta:
>> On 14 Jul 2023, at 13:53, Zoltan Boszormenyi via lists.openembedded.org 
>> <zboszor=gmail.com@lists.openembedded.org> wrote:
>>> It would be nice if Yocto's rpm recipe added the possible
>>> buildarchtranslate lines for BSP target archs automatically.
>> As you’re in the perfect position to test this, would you be willing to come up with a 
>> patch?
>
> I am trying to.
> Currently I am stuck with making this work for Yocto 3.4.
> Later I may be able to come up with something that works for Yocto master.
>
>> It might be as simple as only changing the macro files in native builds, so the target 
>> rpm has conventional macros.  Then again I don’t know much about RPM so may be wrong!
>
> rpmrc and the platform specific macros file need changing.

It seems only the latter needs to be changed.
In case of MACHINE=genericx86-64, RPM packages with
.genericx86_64.rpm suffix will be generated this way.

I just sent the patch against the rpm recipe. Please
review and comment.

I hope I got it right for architectures I don't usually build for.

>
> rpm --eval '%{_arch}' also not correct. strace shows that
> it looks at the contents of /etc/rpm/platform and then
> wants to read /usr/lib/rpm/platform/<platform>/macros
> which doesn't exist for e.g. platform=genericx86-64 or
> other BSPs.
>
> Also, I am not using multiarch so the default
> /usr/lib/rpm/platform/x86_64-linux/macros is not correct
> as it tells rpmbuild to use /usr/lib64 as opposed to use /usr/lib.
>
> Not sure what to do with a multiarch Yocto build.
>
>> A test case that does a simple build using rpm would be a good step too.
>>
>> Cheers,
>> Ross
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#184265): https://lists.openembedded.org/g/openembedded-core/message/184265
> Mute This Topic: https://lists.openembedded.org/mt/100140377/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-24 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 12:53 rpmbuild doesn't work on the target system out of the box with standard macros in the specfile Böszörményi Zoltán
2023-07-14 13:23 ` [OE-core] " Ross Burton
2023-07-14 13:48   ` Böszörményi Zoltán
     [not found]   ` <1771C00C48FCDC1F.28005@lists.openembedded.org>
2023-07-24 12:40     ` Böszörményi Zoltán

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.