-
Notifications
You must be signed in to change notification settings - Fork 49
Conversation
############################################################################### | ||
|
||
# Other windows toolchains have these by default | ||
build:mingw_gcc --cxxopt=-DHAVE_UNISTD_H=1 --host_cxxopt=-DHAVE_UNISTD_H=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could run builds (at least partially) using clang-cl and msvc without those on config.bzl
- it seems they're picked by default?
Since only mingw needed them, I put them here instead. Wdyt? Or do you mean setting a bazel constraint set for when mingw is used?
(my compiler-foo-ness is subpar so bear with me if I'm missing something obvious :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or do you mean setting a bazel constraint set for when mingw is used?
I meant this. This is ok though.
What we should really do is detect the machine capabilities and encode it that way. The current method is really just a shortcut because Bazel is not well-equipped for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing what you asked, but bazel is really challenging. Trying to set select conditions on anything that's not @bazel_tools//src/conditions:os
(eg @bazel_tools//tools/cpp:mingw
, //:my_platform
, //:my_constraint
) yielded either a "Your target can't be found" or "Your BUILD file can't be found" or "invalid constraint key" :/
llvm-bazel/.bazelrc
Outdated
build:mingw_gcc --linkopt=-lole32 --host_linkopt=-lole32 | ||
build:mingw_gcc --linkopt=-luuid --host_linkopt=-luuid | ||
build:mingw_gcc --linkopt=-lversion --host_linkopt=-lversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing these are deps of particular libraries? It would be nice to not have to add them globally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved them into the specific libraries. I also tried compiling them with msvc
, which would complain about LNK4044... I tried adding (host_)linkopt=/IGNORE:4044
but no luck, the warnings are still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as currently configured (with them on the specific targets), this adds LNK4044 warnings to MSVC? That's worse than having them in the bazelrc, I think. I can take a look next week about trying to detect mingw properly, but otherwise let's just leave things in the bazelrc as you had previously. @chandlerc thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to run with
bazelisk build --config=msvc --compiler=msvc @llvm-project//llvm:llvm-tblgen
...
LINK : warning LNK4044: unrecognized option '/lole32'; ignored
LINK : warning LNK4044: unrecognized option '/luuid'; ignored
...
I think these are safe, albeit annoyingly verbose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah warning spam is IMO indirectly unsafe though because it makes people ignore other warnings. I think it's not fair to degrade the MSVC build experience to add support for mingw_gcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Note that this is also blocked by #130. That error also affects @llvm-project/llvm:llvm-mca-headers. This doesn't build _everything_. Particularly, the last error I got through was on setenv not being declared in llvm/llvm/unittests/Support/ThreadPool.cpp. I imagine the issue might be related to some of the other headers that we're including for linux and posix only.
Also added |
Note that this is also blocked by #130.
That error also affects @llvm-project/llvm:llvm-mca-headers.
This doesn't build everything. Particularly, the last
error I got through was on setenv not being declared in
llvm/llvm/unittests/Support/ThreadPool.cpp. I imagine the issue might be
related to some of the other headers that we're including for linux and
posix only.
Note that I can't get mingw-gcc to work with RBE. GCC on windows
will try to canonize paths that look shorter than the original ones:
https://github.com/gcc-mirror/gcc/blob/16e2427f50c208dfe07d07f18009969502c25dc8/libcpp/files.c#L405.
That means that relative includes (eg "lib/Support/../../", eg [1]) are made
absolute, which end up showing an absolute path on the
.d
files.[1] https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/AArch64TargetParser.cpp#L58