-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[5.3 regression] Failure when using the C API in C++ code #13422
Comments
I think that @MisterDA is probably the right person to get in touch with to fix these specific issues you are reporting -- adding more conditional macros for |
This one is fun. See how Dune invokes the C compiler and passes (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wextra -Wno-unused-parameter -x c++ -DUSEGLPK -g -I /Users/antonin/Tarides/ocaml/5.3/_opam/lib/ocaml -I /Users/antonin/Tarides/ocaml/5.3/_opam/lib/cudf -I /Users/antonin/Tarides/ocaml/5.3/_opam/lib/extlib -I glpk -o mccs_stubs.o -c mccs_stubs.cpp) $ cc -dM -E -x c++ - < /dev/null | grep __cplusplus
#define __cplusplus 199711L
$ cc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
$ /opt/homebrew/Cellar/llvm/18.1.8/bin/clang -dM -E -x c++ - < /dev/null | grep __cplusplus
#define __cplusplus 201703L The C compiler driver defaults to C++97 whereas the I'm not sure if it's an OCaml problem or a Dune problem. I suppose it's Dune, as AFAIK OCaml doesn't invoke the C++ compiler nor provide flags through |
I'd consider this a Dune problem. Dune will have to either invoke |
It looks like this is not a upstream Dune problem, as What value of the Note: maybe the conf-c++ package should be updated to check that the C++ compiler installed is C++11-compliant? |
I don't understand the rationale behind invoking a C compiler and having to pass explicit The use of We can relax the OCaml requirements by coping with older standards, but it really would be nice if the compiler invocation was fixed to pass at least |
It does sound like a Dune problem if mccs has to hard-code a specific flag to tell Dune to invoke a C++ compiler instead of a C compiler on C++ files. Dune already has support for building C++ code. It has to be noted that mccs uses |
Spoiler: no.
This is unneeded as Dune 3.16 knowns how to invoke the C++ compiler from the C driver (but not Dune 2.0). |
It was fixed in dune in ocaml/dune#10962 and ocaml/dune#11009. Hopefully a release will appear before the next 5.3 alpha or beta. The consensus above was that it was a dune problem, however thinking about it again, i'm not sure why this option has to be added by dune instead of being present in the compiler's existing |
They are the C preprocessors flags, not C++ flags. The runtime is completely written in C and afaik never calls a C++ compiler. The #if defined(__cplusplus) && __cplusplus < 201103L ||
defined(__STDC_VERSION__) && __STDC_VERSION < 201103L
#error "A C11/C++11 compiler is required"
#endif |
🤯 TIL
If |
Trying to compile
mccs
with the5.3
branch (a4e7cbd) breaks with the following error message at least on macOS:After talking with @Octachron i'll try to go back through #11557 soon and polishing it in hope this would fix this kind of error forever
The text was updated successfully, but these errors were encountered: