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

SWIG/OCaml outstanding problems #2833

Open
ojwb opened this issue Mar 11, 2024 · 0 comments
Open

SWIG/OCaml outstanding problems #2833

ojwb opened this issue Mar 11, 2024 · 0 comments
Labels

Comments

@ojwb
Copy link
Member

ojwb commented Mar 11, 2024

This is a summary of problems I noted in #2649 which really need someone with ocaml skills:

Testing with ocaml 5

Ocaml 5 should now work, but nobody involved with easy access to it has actually confirmed this (and it's not yet packaged for Debian so I can't easily test it).

CI testing for ocaml 5

Better still, if someone can add a CI job using ocaml5 we can be confident support won't be accidentally broken. The CI runs on Ubuntu 20.04 or 22.04.

Testsuite fails with parallel make

make -j2 check-ocaml-test-suite randomly fails with:

File "swig.ml", line 1:
Error: Could not find the .cmi file for interface swig.mli.

Apparently we should be using ocamldep to generate make dependencies.

For now I've just disabled parallel make for ocaml in CI (if we're keeping this as the fix, it'd be better done in the build system so users get it too but it didn't seem trivial to do that).

Fails with ocaml 4.08.1

CI is passes with ocaml 4.13.1, but fails with 4.08.1.

This doesn't seem to be a SWIG problem, but rather ocaml relying on deprecated C semantics for empty parameter lists, e.g.:

2024-02-22T21:40:55.3883786Z  8949 | extern value caml_get_public_method();
2024-02-22T21:40:55.3883899Z       |              ^~~~~~~~~~~~~~~~~~~~~~
2024-02-22T21:40:55.3884042Z In file included from /tmp/camlobja00dca.c:6:
2024-02-22T21:40:55.3884557Z /usr/lib/ocaml/caml/mlvalues.h:219:18: note: previous declaration ‘value caml_get_public_method(value, value)’
2024-02-22T21:40:55.3884837Z   219 | CAMLextern value caml_get_public_method (value obj, value tag);
2024-02-22T21:40:55.3884951Z       |                  ^~~~~~~~~~~~~~~~~~~~~~
2024-02-22T21:40:55.3885395Z /tmp/camlobja00dca.c:9131:14: error: conflicting declaration of C function ‘value caml_set_oo_id()’
2024-02-22T21:40:55.3885510Z  9131 | extern value caml_set_oo_id();
2024-02-22T21:40:55.3885609Z       |              ^~~~~~~~~~~~~~

There are also GCC -Wnarrowing warnings from a byte array initialiser - these looks harmless to me and just due to char being signed on x86-64, but they're promoted to errors because -Werror is in effect.

For now I've simply documented the oldest version we know works (4.13.1) but apparently OCaml 4.07 is still used by RHEL 8, so the problematic versions are still somewhat relevant.

Generated code for some testcases passes NULL to strcpy()

Testcases arrays, memberin_extend_c and sizeof_pointer generate code tries to strcpy to a variable that has value NULL, as gcc -Wnonnull reports:

warning: argument 1 null where non-null expected [-Wnonnull] 

None of these have a _runme.ml so the pass despite this. You can run these individually using for example:

make -C Examples/test-suite/ocaml arrays.ctest

Known failing testcases

These are marked as known to fail so the testsuite passes, but they ought to be resolved and from the errors it looks like there a very small number of common causes.

See FAILING_CPP_TESTS and FAILING_C_TESTS in Examples/test-suite/ocaml/Makefile.in.

You can run an individual test with e.g. (for a C test it needs to be .ctest instead):

make -C Examples/test-suite/ocaml allprotected.cpptest

You can run also all the tests marked as failing and report any which now pass with:

make -s -C Examples/test-suite/ocaml check-failing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant