[boost] Clang on Windows - No Autolink?
Hi, am I correct that autolinking is not supported by Boost when using Clang on Windows? To be clear, I'm talking about both clang++ and clang-cl drivers. The behavior I observe suggests that I am correct but looking at the autolink.hpp header I didn't understand how it decides if it should work or not. A. Joël Lamotte
On 7/21/2020 6:31 PM, Klaim - Joël Lamotte via Boost-users wrote:
Hi, am I correct that autolinking is not supported by Boost when using Clang on Windows? To be clear, I'm talking about both clang++ and clang-cl drivers.
The behavior I observe suggests that I am correct but looking at the autolink.hpp header I didn't understand how it decides if it should work or not.
Clang on Windows targeting vc++ supports autolink, clang on Windows targeting gcc doe3s not support autolink.
On Wed, 22 Jul 2020 at 00:50, Edward Diener via Boost-users < boost-users@lists.boost.org> wrote:
On 7/21/2020 6:31 PM, Klaim - Joël Lamotte via Boost-users wrote:
Hi, am I correct that autolinking is not supported by Boost when using Clang on Windows? To be clear, I'm talking about both clang++ and clang-cl drivers.
The behavior I observe suggests that I am correct but looking at the autolink.hpp header I didn't understand how it decides if it should work or not.
Clang on Windows targeting vc++ supports autolink, clang on Windows targeting gcc doe3s not support autolink.
Thanks, though I think I already understood this if you are talking about Clang in general (outside the specific context of compiling Boost). My issue is in the context of using Boost: it seems that the autolink code in Boost is not working even if I use clang++ or clang-cl targeting Windows (using msvc's runtime, linker etc.). I suspect that this case is not allowed by the option macros that activate autolink on windows when msvc/cl is used. My suspicion comes from the fact that indeed clang does have autolink support in that situation, but it still doesn't find the libraries. I didn't find documentation for that particular case, so I am looking for a confirmation that Boost does not support that case. Joël
On 7/22/2020 1:29 PM, Klaim - Joël Lamotte via Boost-users wrote:
On Wed, 22 Jul 2020 at 00:50, Edward Diener via Boost-users
mailto:boost-users@lists.boost.org> wrote: On 7/21/2020 6:31 PM, Klaim - Joël Lamotte via Boost-users wrote: > Hi, > am I correct that autolinking is not supported by Boost when using Clang > on Windows? > To be clear, I'm talking about both clang++ and clang-cl drivers. > > The behavior I observe suggests that I am correct but looking at the > autolink.hpp header I didn't understand how it decides if it should work > or not.
Clang on Windows targeting vc++ supports autolink, clang on Windows targeting gcc doe3s not support autolink.
Thanks, though I think I already understood this if you are talking about Clang in general (outside the specific context of compiling Boost).
No, I am talking about clang within Boost.
My issue is in the context of using Boost: it seems that the autolink code in Boost is not working even if I use clang++ or clang-cl targeting Windows (using msvc's runtime, linker etc.). I suspect that this case is not allowed by the option macros that activate autolink on windows when msvc/cl is used. My suspicion comes from the fact that indeed clang does have autolink support in that situation, but it still doesn't find the libraries.
I didn't find documentation for that particular case, so I am looking for a confirmation that Boost does not support that case.
It should be working. What does your 'using clang-win' look like and what does your b2 command to invoke clang-win look like. I think you also must have the bin directory of your appropriate LLVM release in your Windows PATH so that the clang binaries can be found.
On Wed, 22 Jul 2020 at 22:32, Edward Diener via Boost-users < boost-users@lists.boost.org> wrote:
Thanks, though I think I already understood this if you are talking about Clang in general (outside the specific context of compiling Boost).
No, I am talking about clang within Boost.
[...]
It should be working.
Thanks for clarifying. So I am probably doing something wrong.
What does your 'using clang-win' look like and what does your b2 command to invoke clang-win look like.
I'm not sure what you are asking here exactly but to clarify: - I'm not using b2 as the buildsystem of the project I'm working on, I'm using build2. Autolinking works with msvc but not with clang(over msvc) when compiling the same code, same boost headers/lib files but only the compiler changed from msvc to clang++. - I did use b2 for building Boost. The toolset was msvc though, does it have an impact on how the autolinking works in boost? This is the command you are asking about?
I think you also must have the bin directory of your appropriate LLVM release in your Windows PATH so that the clang binaries can be found.
Yes that's how I make clang (10) available to build2. I will attempt a smaller repro case and report here the compiler invocations, maybe there is a missing flag somewhere but from what I understand the only flags related to autolinking are to deactivate them. A. Joël Lamotte
On 24/07/2020 07:03, Klaim - Joël Lamotte wrote:
On Wed, 22 Jul 2020 at 22:32, Edward Diener wrote: What does your 'using clang-win' look like and what does your b2 command to invoke clang-win look like.
I'm not sure what you are asking here exactly
I suspect that may have been a misunderstanding. b2 is completely irrelevant to the question of auto-linking (unless you're using it to build your app as well, but nobody ever does that). The auto_link.hpp file is consumed by whatever build system and compiler you're using for your app, and it's up to that to decide whether to do auto-linking or not. Auto-linking support for clang on Windows was added in Boost 1.71, so if you're using something older than that: this is why it's not working. If you're using something newer than that and it's still not working, then something might be going wrong; you should probably inspect the preprocessed output to see what was generated for auto_link.hpp. Perhaps it's generating the wrong filename for some reason, or some other condition is blocking it.
On Fri, 24 Jul 2020 at 01:36, Gavin Lambert via Boost-users < boost-users@lists.boost.org> wrote:
Auto-linking support for clang on Windows was added in Boost 1.71, so if you're using something older than that: this is why it's not working.
Thank you very much, that explains it: I'm using boost 1.70 for this project on all platforms. Ok now I need to decide if it's worth upgrading or switch to explicit linking, but at least the situation is clearer. Thank you all for your time. A. Joël Lamotte
On 24/07/2020 11:36, I wrote:
b2 is completely irrelevant to the question of auto-linking (unless you're using it to build your app as well, but nobody ever does that).
Well, "completely irrelevant" might have been a step too far. You do of course have to run b2 with compatible settings to your eventual usage such that it builds the libraries with the right filenames.
On Fri, 24 Jul 2020 at 02:26, Gavin Lambert via Boost-users < boost-users@lists.boost.org> wrote:
On 24/07/2020 11:36, I wrote:
b2 is completely irrelevant to the question of auto-linking (unless you're using it to build your app as well, but nobody ever does that).
Well, "completely irrelevant" might have been a step too far.
You do of course have to run b2 with compatible settings to your eventual usage such that it builds the libraries with the right filenames.
Indeed. I can now confirm that at least with boost 1.73.0 autolinking works as expected and it was built with the same arguments that I passed to b2 when I compiled boost 1.70.0 (which does not support autolinking with clang). So as long as I use boost > 1.70.0 it seems to work as expected. A. Joël Lamotte
participants (3)
-
Edward Diener
-
Gavin Lambert
-
Klaim - Joël Lamotte