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

Compatibility tests compilation fail with fatal error: sqlite3.h: No such file or directory #579

Open
dkaluza opened this issue Dec 30, 2024 · 2 comments
Labels
bug Something isn't working C API testing

Comments

@dkaluza
Copy link
Contributor

dkaluza commented Dec 30, 2024

When trying to run compatibility tests I have encountered the following compilation error:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.71s
LIBS="../.././target/x86_64-unknown-linux-gnu/debug/liblimbo_sqlite3.a" make -C sqlite3/tests test
make[1]: Entering directory '/home/daniel/limbo/sqlite3/tests'
  CC       main.o
  CC       test-aux.o
test-aux.c:3:10: fatal error: sqlite3.h: No such file or directory
    3 | #include <sqlite3.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:32: test-aux.o] Error 1
make[1]: Leaving directory '/home/daniel/limbo/sqlite3/tests'
make: *** [Makefile:72: test-sqlite3] Error 2

I can avoid it by installing an appropriate system headers package, e.g. libsqlite3-dev on ubuntu but I suspect it is not intended way to solve this problem.

If I understand correctly test files should be linked with appropriate header file resulting from limbo-c Makefile target.
Let me know if this is correct, I can try to investigate how to fix this.

@penberg
Copy link
Collaborator

penberg commented Dec 31, 2024

@dkaluza We are actually now pulling the system-wide sqlite3.h, but perhaps we should indeed fix it to grab the one generated by Limbo.

@dkaluza
Copy link
Contributor Author

dkaluza commented Jan 3, 2025

@penberg Ok, added a PR to fix this issue.

While testing it I have found out that SQLITE_NOTFOUND has inconsistent error code with one in SQLite docs.
And that open is returning it instead of SQLITE_CANTOPEN. Added fix in the same PR so that tests are still passing.

I have also tried to run the compatibility tests with recent SQLite version 3.47.2 2024-12-07 20:39:59

And it turned out that tests are hanging indefinitely.
Investigated the issue, it was caused by the -q flag being passed to the executable and it is not available in SQLite so it exited immediately with error. Handled it and improved the testing python script to print out errors instead of infinite loop.

However compatibility tests with recent SQLite still return the following error:

Running test: test-switch-output-stdout
Error: mode should be one of: ascii box column csv html insert json line list markdown qbox quote table tabs tcl

But since I assume that this is still an improvement it should be probably handled in separate issue.

Btw. While linking the generated header with C code the following warning is emitted:

../.././target/x86_64-unknown-linux-gnu/debug/include/limbo_sqlite3/sqlite3.h:5:9: warning: ISO C99 requires whitespace after the macro name
    5 | #define SQLITE3.H_MAJOR 0

Probably usage of this macro might not work as expected but since I did not find any usage at first glance I did not investigate any further.

Let me know if I should split it to multiple PR's or improve in some other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C API testing
Projects
None yet
Development

No branches or pull requests

2 participants