Combined cc_wrapper for all OSes - #1002
Conversation
Always pass locale_archive to run_ghc if provided.
- Shortens library search paths to stay below maximum path length on Windows.
GHC generates library search paths that contain redundant up-level
references (..). This can exceed the maximum path length on Windows, which
will cause linking failures. This wrapper shortens library search paths to
avoid that issue.
- Shortens rpaths and load commands on macOS.
The rpaths and load commands generated by GHC and Bazel can quickly exceed
the MACH-O header size limit on macOS. This wrapper shortens and combines
rpaths and load commands to avoid exceeding that limit.
- Finds .so files if only .dylib are searched on macOS.
Bazel's cc_library will generate .so files for dynamic libraries even on
macOS. GHC strictly expects .dylib files on macOS. This wrapper hooks into
gcc's --print-file-name feature to work around this mismatch in file
extension.
Otherwise we would still require symbolic links for dynamic library dependencies on macOS for REPL targets.
|
The CI failure on Windows is due to timeout. Tracing the build of The first call to |
|
A quick test shows that a |
|
Do you plan on doing the rewrite and opening a new PR once that is done? Or do you want to push the rewrite to this PR? |
|
Happy to do it in a separate PR. I'll close this for now. I'll be gone the next two weeks, so I won't be able to resolve this before I'm back. |
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
The python cc_wrapper is too slow on Windows. See #1002 Rewriting it in C++ would be a lot of work as we cannot rely on C++17's std::filesystem, yet. Including a C++ filesystem library would impose a large dependency. Fortunately, the Windows cc_wrapper only needs to shorten library paths, not handle dynamic libraries. It is easier to use a dedicated bash cc_wrapper on Windows instead.
Replaces the macOS specific CC wrapper by one applicable to all OSes
GHC generates library search paths that contain redundant up-level references (
..). This can exceed the maximum path length on Windows, which will cause linking failures. This wrapper shortens library search paths to avoid that issue.The rpaths and load commands generated by GHC and Bazel can quickly exceed the MACH-O header size limit on macOS. This wrapper shortens and combines rpaths and load commands to avoid exceeding that limit.
Bazel's cc_library will generate .so files for dynamic libraries even on macOS. GHC strictly expects .dylib files on macOS. This wrapper hooks into gcc's --print-file-name feature to work around this mismatch in file extension.
The CC wrapper is also used for REPL and runghc targets so that these also don't require symlinks for dynamic libraries on macOS.
Closes #958