Skip to contentSkip to conversation

rpmbuild doesn't work on the target system out of the box with standard macros in the specfile

DISCUSSION Böszörményi Zoltán 2 participants 4 messages Jul 14, 2023 – Jul 24, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 2 lines · Zoltan Boszormenyi via lists.openembedded.org

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

#2 lore raw

2023. 07. 14. 15:23 keltezéssel, Ross Burton írta:

Quoted 4 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 2 lines

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.

Quoted 1 line

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.

Quoted 4 lines

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

Cheers,
Ross

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

2023. 07. 14. 15:48 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:

Quoted 6 lines

2023. 07. 14. 15:23 keltezéssel, Ross Burton írta:

Quoted 4 lines · Zoltan Boszormenyi via lists.openembedded.org
Quoted 2 lines

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?

Quoted 7 lines

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.

Quoted 1 line

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.

Quoted 27 lines

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.

Quoted 4 lines

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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-