-
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
[ocaml-5.1.0]: Bytecode -custom exes fail to link with cc a C++ compiler #12790
Comments
Hello Shayne, nice to hear from you, and thanks for the report. The older I get, the less C and C++ make sense to me, but each in its own different way... Do you really need to use a C++ compiler with |
hello xavier! the context here is the buck2 hack, flow & pyre builds (among others) at meta.
it's a very complicated multi-language setup that we work with. swapping out
this could be a possibility but would require some effort in flow to adapt to i think. all things considered if we can get something like #12791 through that would be the ideal. an alternative is to revert 99a05d2 |
Fixes: #12790 Co-authored-by: Shayne Fletcher <shaynefletcher@meta.com>
Since ocaml-5.1.0, bytecode
-custom
executables fail to link if given-cc
a C++ compiler (e.g-cc "clang++"
will fail but-cc "clang"
works).This regression was introduce in this commit and the reason is as follows:
-custom
bytecode executables link with compiler generated C likeSince
caml_builtin_cprim
andcaml_names_of_builtin_cprim
areconst
qualified, when compiled with a C++ compiler (>= C++11), they are given internal linkage 1 (unlike C).The fix is to arrange for the generated code to mark
caml_builtin_cprim
andcaml_names_of_builtin_cprim
asextern
:Footnotes
C++11: C.1.2 https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf ↩
The text was updated successfully, but these errors were encountered: