Page MenuHome

Fix compilation error on certain platforms
ClosedPublic

Authored by Sergey Sharybin (sergey) on Feb 14 2022, 10:29 AM.

Details

Summary

Atomic operations performed by the C++ standard library might require
libatomic on platforms which do not have hardware support for those
operations.

This change makes it that such configurations are automatically detected
and -latomic is added when needed.

Diff Detail

Repository
rB Blender
Branch
atomic_fix_v2 (branched from master)
Build Status
Buildable 20540
Build 20540: arc lint + arc unit

Event Timeline

Sergey Sharybin (sergey) requested review of this revision.Feb 14 2022, 10:29 AM
Sergey Sharybin (sergey) created this revision.

Was hoping to check it with our buildbot, but it is currently in a hiccup state: https://builder.blender.org/admin/#/buildrequests/48712 (Arnd has it in his list to resolve).
So for now best is the buildd status of Blender in Debian which previously was failing on platforms like armel (Raspberry Pi): https://buildd.debian.org/status/package.php?p=blender&suite=experimental


The build seems to work now, even without this patch, so that's not really a good builder to base any conclusions on.

Your patch LGTM though. Is there a way for me to test it without an RPi?

Sorry, should have explained it better in the previous comment.

There is a series of patched Debian is applying on top of the "vanilla" Blender to fix issues on the official Debian platforms. The patch from our side (this patch, D14106) Ive sent to Matteo to verify before submitting this patch to our codereview. This proposed change was not part of version 3.0.1+dfsg-5 and was causing /usr/include/c++/11/bits/atomic_base.h:636: error: undefined reference to '__atomic_fetch_add_8' build error. This patch was incorporated into 3.0.1+dfsg-6 and now the armel platform is compiling successfully.

Your patch LGTM though. Is there a way for me to test it without an RPi?

Afraid it is not that simple. This is something really platform specific.
The best you can do is to verify the -latomic is NOT appended to the PLATFORM_LINKFLAGS on 64bit Intel platforms. Other than that I can not think of a better way than sending patch to Matteo, verifying it works (the patch, we know Matteo is working hard ;) and apply the patch on our side.

I think it would be nice to eventually have some RPi's plugged to our network with ssh open to ease debugging things like this. But that's not something we can solve in the short term due to global shortage :(

and now the armel platform is compiling successfully.

That's good enough for me :)

This revision is now accepted and ready to land.Feb 14 2022, 12:21 PM