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

Cross compilation Windows build quadmath problems #126

Closed
Chris-SP365 opened this issue Nov 16, 2023 · 5 comments
Closed

Cross compilation Windows build quadmath problems #126

Chris-SP365 opened this issue Nov 16, 2023 · 5 comments

Comments

@Chris-SP365
Copy link

I'm working on sqlite-jdbc-crypt and try to get up to date builds with current SQLite and current SQLite3MultipleCipher versions:

Since 1.6.3 there is a reference to quadmath for Windows 64 architectures in vsv.c:

https://github.com/utelle/SQLite3MultipleCiphers/blob/main/src/vsv.c

sqlite-jdbc-crypt uses Dockcross to compile to various architectures. When updated to 3.42.0 and 1.6.3 I get compile errors on Windows 64 builds.

The first one was a missing quadmath linker option on Windows x86-64. I added it and it worked.
The second problem is a missing quadmath.h header for Windows ARM-64. I tried various things:

  • Adding includes/options -> no success
  • Adding a quadmath.h -> Compile error "__float128 not supported"

Could you please tell me if Win ARM64 is a supported configuration?
Also could you elaborate why quadmath is only needed for Windows 64?

Thank you

Chris

@utelle
Copy link
Owner

utelle commented Nov 16, 2023

I'm working on sqlite-jdbc-crypt and try to get up to date builds with current SQLite and current SQLite3MultipleCipher versions:

Since 1.6.3 there is a reference to quadmath for Windows 64 architectures in vsv.c:

vsv.c is a SQLite extension that supports variants of the CSV file format for importing CSV files. I added this extension on a user's request. However, if you don't need this extension in your applications then you can simply disable it.

quadmath is only referenced if the library is compiled with GCC for a WIN64 platform. This dependency was introduced by the author of the extension between February and May 2023.

sqlite-jdbc-crypt uses Dockcross to compile to various architectures. When updated to 3.42.0 and 1.6.3 I get compile errors on Windows 64 builds.

The first one was a missing quadmath linker option on Windows x86-64. I added it and it worked.

Actually, I wasn't aware of this problem until early October. The build files were fixed for version 1.7.1.

The second problem is a missing quadmath.h header for Windows ARM-64. I tried various things:

  • Adding includes/options -> no success
  • Adding a quadmath.h -> Compile error "__float128 not supported"

My guess is that the author of the extension never tested to compile it for ARM64. ... and I didn't use GCC for that purpose.

Could you please tell me if Win ARM64 is a supported configuration?

Yes. SQLite3 Multiple Ciphers can be compiled for almost any platform just like SQLite itself. However, sometimes minor adjustments may be necessary.

Also could you elaborate why quadmath is only needed for Windows 64?

I haven't inspected the VSV code in greater detail, but it has something to do with conversion between integer and floating point values. AFAICT this "feature" is not critical in any way. Most likely I will adjust the code, so that the feature will be disabled by default, but can be enabled, if someone really needs it.

@Chris-SP365
Copy link
Author

Thank you for your detailed response. This helps me to understand the problem.
I'd like to keep this open for new questions regarding my task.

utelle added a commit that referenced this issue Nov 17, 2023
Use of 128-bit floats for conversion purposes in the VSV extension could cause compilation problems due to the dependency on the GCC-specific quadmath library. This library will now only be used, if the prprocessor symbol SQLITE_USE_QUADMATH is defined. This symbol will not be defined by default.
@utelle
Copy link
Owner

utelle commented Nov 17, 2023

I applied a quick fix for the problem. The GCC quadmath library will now be referenced under WIN64 only, if the preprocessor symbol SQLITE_USE_QUADMATH is defined. By default it is not defined.

@Chris-SP365
Copy link
Author

Sounds reasonable. Thank you

@utelle
Copy link
Owner

utelle commented Nov 17, 2023

Sounds reasonable. Thank you

You are welcome.

As I described already in a previous post, the use of quadmath in the VSV extension represents a very special case:

  1. The compiler is GCC
  2. The platform is WIN64
  3. The extension VSV is actually used
  4. The CSV file contains integer items with absolute values between 9.007.199.254.740.991 = 2^53-1 and 9.223.372.036.854.775.808 = 2^63-1, which should be represented as 64-bit integers internally. Without 128-bit floating point support all integers greater than 9.007.199.254.740.991 = 2^53-1 will be represented as doubles.

Only if your requirements meet all 4 conditions, you will want to define the symbol SQLITE_USE_QUADMATH.

I'd like to keep this open for new questions regarding my task.

IMHO this issue could be closed, because I find it highly unlikely that you will have further questions regarding quadmath in the light that this feature isn't used anywhere else in SQLite.

If you have further questions regarding other issues you may have with SQLite3 Multiple Ciphers, please open a new issue.

However, if you happen to have further questions regarding quadmath, simply reopen this issue. Thanks.

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