-
Notifications
You must be signed in to change notification settings - Fork 406
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
Test foreign library properly add stdc++ dependency #4846
Conversation
Hello, you seem to have messed up a bit your git history. Could you rebase on |
f55a0b9
to
d6f2d9b
Compare
Updated but it seems the |
d6f2d9b
to
dee8c64
Compare
Rebase the branch and simplify a little bit the example. @voodoos Actually, we do not understand yet why the cxx flags seem to never be used. dune/src/dune_rules/cxx_flags.ml Lines 10 to 11 in 4d0a47e
|
Some remarks:
Still I find the documentation about it very misleading because it says:
For me, to "deactivate it", it should be Yet, even if the compile command line contains |
|
Sorry I do not know what is the |
It allows to build native executables with an embedded interpreter: https://dune.readthedocs.io/en/stable/dune-files.html#linking-modes
|
The behaviour seems to be the same as |
The last commit is just an example of how it can be handled (not necessarily the best one). Another option would be to automatically add the flag in the ordered set |
@jeremiedimino do you have an opinion on what would be the best design here ? Is the |
What is the problem being fixed here? From the conversion, my understanding is that if a library has C++ stubs and the C compiler is gcc then we should pass
So I'm surprised this is not the case already. |
I think at the end there is two problems:
(note that I do not know what was its purpose here but I think that |
Yes, it is a better default but it is a breaking change so we can only change it in the next major version of the language. In the meantime we can only encourage users to use this option.
Right, so you are saying that the |
That sound right indeed. I am not an expert on that matter, but if I understand well these two flags being link flags should be passed to For libraries Dune has the field For executables it looks like the link flags for foreign stubs are specified in the common |
That makes sense to me. If these flags are link flags we should pass them at the link stage. |
@voodoos do you think you'll get a chance to work on this soon? Otherwise I can give this a try. |
We submitted our PR on the compiler but still have a lot of thing to do on Merlin's side. Maybe it's best if you could have a look. I started splitting flags between compile and link time in that commit: voodoos@465b111 There are two things left to solve:
|
What's the connection to the compiler and merlin? Perhaps I'm completely understanding what the issue is, but it seems like just in an issue with dune spitting out correct flags? |
Sorry, my answer was misleading. This has no relation with Dune or that precise PR. Just meant that I was quite busy with other projects. If you are too I will try to finish this next week. (but I am unsure yet of the best way to solve the issues I mentionned in my previous post) |
I thought this would be fixed with #5185 but another issue arised linked to compiler detection: I am having a look right now and adding the 3.0.0 milestone. |
Closing in favor of #5249 |
It is currently impossible to create a bytecode executable linked with a library depending on a c++ foreign_archive.
For instance:
Manually running the ocamlmklib command with "-lstdc++" solves the issue (modulo the RPATH issue because it is not installed).