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

Issue: Incorrect Version Macro Check in sqlite_orm.h #define _LIBCPP_VERSION #1317

Open
FreeSoaring opened this issue Jun 15, 2024 · 2 comments
Assignees

Comments

@FreeSoaring
Copy link

Issue: Incorrect Version Macro Check in sqlite_orm.h

Description

The macro check for _LIBCPP_VERSION in sqlite_orm.h is incorrect. The _LIBCPP_VERSION macro is defined in the NDK at $NDK_ROOT/sources/cxx-stl/llvm-libc++/include/__config as follows:

#define _LIBCPP_VERSION 110000

This means that the version number is in the format major * 10000 + minor * 100 + patch.

Problematic Code

In sqlite_orm.h, line 7958, the version check is currently:

#if (__cplusplus >= 202002L) && ((!_LIBCPP_VERSION || _LIBCPP_VERSION >= 13) && (!_GLIBCXX_RELEASE || _GLIBCXX_RELEASE >= 10))

Suggested Fix

The version check should be updated to match the format used by _LIBCPP_VERSION. The corrected macro should be:

#if (__cplusplus >= 202002L) && ((!_LIBCPP_VERSION || _LIBCPP_VERSION >= 130000) && (!_GLIBCXX_RELEASE || _GLIBCXX_RELEASE >= 10))

Rationale

This change ensures that the version comparison for _LIBCPP_VERSION is accurate, reflecting the actual versioning format used by libc++.

Example

The corrected code should be:

#if (__cplusplus >= 202002L) && ((!_LIBCPP_VERSION || _LIBCPP_VERSION >= 130000) && (!_GLIBCXX_RELEASE || _GLIBCXX_RELEASE >= 10))
    // Your code here
#endif
@trueqbit
Copy link
Collaborator

Hi @FreeSoaring

  1. Are you sure that the line #define _LIBCPP_VERSION 110000 is correct? @raidenluikang reported in issue Build error on Android NDK 25 #1139 and @lemourin in PR Fix version check guarding std::identity usage. #1183 that _LIBCPP_VERSION was a 5-digit number and that's what I see in the their github repo for v11. They only changed to 6 digits in v16.
  2. I assume you are using sqlite_orm 1.8.2? @lemourin fixed this with PR Fix version check guarding std::identity usage. #1183, which came after 1.8.2 and is in the dev branch.

@FreeSoaring
Copy link
Author

你好@FreeSoaring

  1. 您确定该线路#define _LIBCPP_VERSION 110000错了吗?@raidenluikang问题在Android NDK 25上构建错误 #1139中报告了这个问题,@lemourin在 PR Fix 版本中检查保护 std::identity 的使用情况。 #1183_LIBCPP_VERSION一个 5 位数字,这是我在v11 的 github repo 中看到的。他们只在v16中将其改为6位数字。
  2. 我假设我使用 sqlite_orm 1.8.2?@lemourin使用 PR修复版本检查保护 std::identity 用法问题。 #1183,它是在 1.8.2 之后发布的,位于 dev 分支中。

"Oh, I'm sorry, it is indeed a 5-digit number; I typed an extra 0.
I am using the source code of sqlite_orm version 1.8.2 downloaded from the Releases section.
In the source code, line 7958 uses the _LIBCPP_VERSION to determine if it is a 2-digit number.
This can cause compilation issues with the error 'using std::identity; is not defined'.
It should be modified to check for a 5-digit version.
I manually modified it to:

#if (__cplusplus >= 202002L) && ((!\_LIBCPP\_VERSION || \_LIBCPP\_VERSION >= 13000) && (!\_GLIBCXX\_RELEASE || \_GLIBCXX\_RELEASE >= 10))}

After this change, the NDK compilation completed successfully."

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