|Summary:||Building with Android LLVM STL library causes build error in EventCount.h|
|Product:||Eigen||Reporter:||Linus Mårtensson <linus.martensson>|
|Severity:||Compilation Problem||CC:||benoit.steiner.goog, chtz, gael.guennebaud, rmlarsen|
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: https://bitbucket.org/eigen/eigen/src/f82d2aa716dc7b5c54db5f68f62bae9626dcc833/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h?at=default&fileviewer=file-view-default#EventCount.h-99 "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 gitlab.com'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: https://gitlab.com/libeigen/eigen/issues/1350.