This bugzilla service is closed. All entries have been migrated to
Bug 1350 - Building with Android LLVM STL library causes build error in EventCount.h
Summary: Building with Android LLVM STL library causes build error in EventCount.h
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Tensor (show other bugs)
Version: unspecified
Hardware: All Android
: Normal Compilation Problem
Assignee: Nobody
Depends on:
Reported: 2016-11-29 17:20 UTC by Linus Mårtensson
Modified: 2019-12-04 16:32 UTC (History)
4 users (show)


Description Linus Mårtensson 2016-11-29 17:20:08 UTC
I'm currently working on building Google's Tensorflow for Android using LLVM STL. When in the build process, there's an error as some Eigen components are utilized, more specifically in EventCount.h, here:

"error: invalid failure memory model for __atomic_compare_exchange".

According to the C++11 standard, the failure state for compare_exchange cannot be memory_order_release, as this would result in an erroneous state. Further, setting only a single memory_order parameter should resolve correctly to memory_order_relaxed on failure, but this isn't done in LLVM for whatever reason, and it's unlikely that the Android NDK version of LLVM will be updated in a timely manner and expose it to all platforms.
The faster solution to allow a correct build would instead be to explicitly define the two result states explicitly instead of implicitly as:
compare_exchange_weak(..., std::memory_order_release, std::memory_order_relaxed)

I tested this on my local build, and it resolves the build error as expected.

The error MAY also be present if building with LLVM for x86 / linux, but I was not in a position to test.
Comment 1 Nobody 2019-12-04 16:32:41 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.