fix: Add runtime_library_search_directories for QNX dynamic linking#14
Conversation
nradakovic
left a comment
There was a problem hiding this comment.
Is this only for QNX? If that's the case, we need to set some guard, or to move this as part of template enablement.
Also, I don't see set on toolchains_qnx. Is there a reason why this was not enabled there? |
Yes it's only with the qcc/q++ compiler. Works on gcc/linux without changes. And yes, we identified it first (last week) on toolchains_qnx. Because it was already being phased out we checked with bazel_cpp_toolchains. Luckily fixing it there was possible with limited impact. What kind of guard do you mean? The change is in template/qnx so it should be limited to QNX only. Please make a proposal - I may not get what you mean... |
|
FYI: The error sighting in building the examples with the |
|
...and one more comment for explanation: My guess for the main root cause is that bazel cc_rules don't really support qcc well. When trying to trace the In the rules_cc link above the So the main root cause could be that bazel cc_rules don't really support qcc and this PR is a workaround for that. |
It's actually a bit deeper than that. Most configurations (this one as well) relay on legacy features. These features are used as autocomplete compiler and linker configuration and if you do not override them, Bazel assumes you want to use default implementation. For that he uses Unix like build and Windows (I think) like build to configure "missing" features. In case of QNX they assume search paths are the same as on Linux. Solution is of course to disable this, and go full customized configuration, but I have no time to implement that. I have done it for internal toolchains this approach, it's for sure better and safer, but for S-CORE I don't have time. |
We have idea that same features exists on both configuration so that in the future we can merge templates. We tried already now but too many delta were in place so we went separate template. But with this said, I don't want to make different linker features between them. Can we set this in default linker options? |
Sure - if you have a better way to implement this, that's completely fine with me. We can discard this PR in that case. That was just how we thought a broken feature we require could be fixed. |
No, I don't want to take credit for your work. I just want that you extend the list of current default_linker_flags_feature instead of creating completely new feature. If this is something that is mandatory for QNX, then we put it in default link feature. That's all. Update PR and I will approve it. |
|
Crap. With my last change I made conflict. Sorry about that. |
|
I tried with extending File |
|
If I have: and and add them to the features the correct linker flags are produced. So somehow (maybe via here) the flags are added and we need to disable or overwrite it. @nradakovic What is your opinion? Overwrite or disable? |
Ah I was hoping that this is not one of legacy features but it is. So we have 2 options:
Either way we will need to remove this once we get rid of legacy features, so I would say, leave it as is, just fix merge conflicts and once we add |
QNX toolchain requires -Wl,-rpath instead of -rpath for runtime library paths. This enables cc_shared_library and dynamic linking support.
098f320 to
c00a3b1
Compare
|
@nradakovic Ok 👍 rebased to main. Ready to merge. Please approve. |
QNX toolchain requires -Wl,-rpath instead of -rpath for runtime library paths. This enables cc_shared_library and dynamic linking support.
Extend examples for dynamic linking case.