Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libc++-14 incompatibility #1602

Open
dbs4261 opened this issue May 24, 2024 · 3 comments
Open

libc++-14 incompatibility #1602

dbs4261 opened this issue May 24, 2024 · 3 comments

Comments

@dbs4261
Copy link
Contributor

dbs4261 commented May 24, 2024

Hi folks, looks like there is an issue with using gcc-14. When compiling Open3d using oneApi with gcc-14, I am getting a build error. I've traced it to oneapi/dpl/pstl/algorithm_impl.h. It seems to be an issue with the macro #if (_PSTL_UDR_PRESENT || _ONEDPL_UDR_PRESENT) (actual error: error: operator '||' has no left operand). Now, I'm reporting the bug here because _PSTL_UDR_PRESENT is defined in pstl_config.h but that is never included. My IDE is telling me that the definition is coming instead from pstl_config.h libc++-14 shown below:

#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900) || \
    (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 40900) || \
    (defined(_OPENMP) && _OPENMP >= 201307)
#    define _PSTL_UDR_PRESENT
#endif

#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900 && __INTEL_COMPILER_BUILD_DATE >= 20180626) || \
    (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 100000)
#   define _PSTL_UDS_PRESENT
#endif

Now, in all versions of the file included in my oneApi installation have a value after _PSTL_UDR_PRESENT. This is also the case with libc++-13. So the fix might need to be made on that end.

@jwakely
Copy link

jwakely commented May 28, 2024

libc++ is part of LLVM, I guess you mean libstdc++.

@jwakely
Copy link

jwakely commented May 28, 2024

The problem is that the upstream PSTL (which is also part of LLVM!) changed the definition of that macro:
llvm/llvm-project@3b9a1bb#diff-4c6821476cefc699b801f5fdbeda3341e3c64626dcf39a79621ea02031bdd50eL113

It's no longer defined to 1, which seems like a bad decision in the upstream code IMHO.

But the real problem is that onedpl is not including its own pstl_config.h and is relying on an incompatible "third-party" header of the same name, found elsewhere in the include path.

@dbs4261
Copy link
Contributor Author

dbs4261 commented May 28, 2024

Quick correction, libc++-13 and libc++-14 are the apt packages proving those files. However your point is a good one that both GNU C++ and Clang++ use LLVM's PSTL implementation. I tried adding #include "pstl_config.h" to the top of algorithm_impl.h, and that made me realize both the LLVM PSTL and oneDPL implementation use the same include guard, so that wont work. Looks like this will need to be resolved by either changing the code that checks for _PSTL_UDR_PRESENT or by fixing the upstream header. I think fixing the LLVM PSTL header is the better choice for backwards compatibility reasons.

Altina-oz added a commit to Altina-oz/xmake-repo that referenced this issue Jun 10, 2024
/* MACROS DUE TO llvm/llvm-project@3b9a1bb#diff-4c6821476cefc699b801f5fdbeda3341e3c64626dcf39a79621ea02031bdd50eL113 */
            /* ALSO C.F. oneapi-src/oneDPL#1602 */
            /* AND THE USING OF _PSTL_... MACROS IS REMOVED FROM ONEDPL NOWADAYS*/
waruqi pushed a commit to xmake-io/xmake-repo that referenced this issue Jun 11, 2024
* Update onedpl xmake.lua

* Create fetch.lua

* Update xmake.lua

rc1

* Update xmake.lua

/* MACROS DUE TO llvm/llvm-project@3b9a1bb#diff-4c6821476cefc699b801f5fdbeda3341e3c64626dcf39a79621ea02031bdd50eL113 */
            /* ALSO C.F. oneapi-src/oneDPL#1602 */
            /* AND THE USING OF _PSTL_... MACROS IS REMOVED FROM ONEDPL NOWADAYS*/

* Update xmake.lua

typo

* Update xmake.lua

* bad ci ; try again

ci on arch linux failed due to network error

* Update xmake.lua

* Refine config

* refine fetch.lua

remove unnecessary add_deps

* Update xmake.lua

* minor formatting refinement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants