silverqx / TinyORM

Modern C++ ORM library
https://www.tinyorm.org
MIT License
242 stars 25 forks source link

Support for Mac OS X, *BSD, and other libc++ environment #28

Open SchaichAlonso opened 1 year ago

SchaichAlonso commented 1 year ago

libc++ has started supporting the <ranges> library of c++20, which TinyORM uses, in libc++-13, which is part of llvm-13.

Although libc++-13 has <ranges>, the implementation is incomplete and therefore disabled by default. The incomplete implementation can be enabled by passing the -fexperimental-library option to clang.

While <ranges> support is still incomplete in libc++-15, it is sufficient to build TinyORM's querybuilder and run the querybuilder's test cases w/o detecting flaws.

llvm-16's libc++ has full ranges support, and the -fexperimental-library option is no longer required. All of TinyORM can be built and tests run w/o detecting flaws on libc++-16 (TinyORM d98ee5c on FreeBSD edd0014)

On libc++ systems, the _LIBCPP_VERSION macro can be used to investigate the libc++ version being used, which is not required to be the same as the compiler's and will default to the Operating System's one if a compiler was manually installed. As TinyORM's dependencies link against libc++, care needs to be taken the dependencies use the same libc++ or a compatible version to the one used by TinyORM, making it unfeasible to attempt using a custom libc++ with operating system provided dependencies.

At this point, GitHub offers no hosted runners that are capable of building TinyORM using libc++.

This issue will likely resolve on its' own as Operating Systems update their libc++ in their future releases.

silverqx commented 1 year ago

I tried libc++ about 2-3 years ago and had trouble compiling simple hello world programs with c++20 features so I decided that I will not support libc++ because it would be a pain. Supporting Clang is pain itself 😵‍💫 with all these concept and constraints bugs, TLS wrapper bugs, unfinished aggregate initialization, or an order of static initialization. Clang has by far the most #ifdef in the code, practically all 🙂

At that time it was Clang 9 or 10 I think? But Clang 16 has rapidly evolved and solved many things, we will see how it will be in the near future.

silverqx commented 1 year ago

I know you are talking about libc++ and I'm talking about Clang itself but it shows how deep the problem is, incomplete libc++ is problematic too as you are describing.

silverqx commented 1 year ago

All of TinyORM can be built and tests run w/o detecting flaws on libc++-16 (TinyORM d98ee5c on FreeBSD edd0014)

These are good news so there is a good or better chance it can be added to supported platforms.