-
Notifications
You must be signed in to change notification settings - Fork 222
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
Cmake and LLVM #116
Comments
It should be about as difficult as cross-compiling normally would be. I
expect CMake is easy, particularly because it doesn't have any difficult
dependencies, but LLVM could be tricky. Yes, you just edit Dockerfile. For
example, for CMake:
1. Add build dependencies to the apt-get line. You probably don't want to
bother bootstrapping CMake, and Debian's CMake will do fine, so install it
at this point.
2. Add a curl download URL, alongside the rest, to obtain the source.
3. (optional) Add the source checksum to SHA256SUMS to validate you got
the correct source. Note that the curl command uses --insecure, so HTTPS
won't cover transport. You can remove --insecure. It just makes the
download step more reliable because it works even it someone's certs are
broken (which they sometimes are), and SHA256SUMS makes TLS redundant.
4. Add a tar line to unpack it, alongside the rest. Sources are all
unpacked at once to minimize Docker layering.
5. Just before "Pack up a release" add a new "paragraph" to build CMake,
which starts with WORKDIR to the build directory. Add a RUN command that
configures it, probably something like this:
cmake /cmake-$CMAKE_VERSION \
-DCMAKE_INSTALL_PREFIX=/bootstrap \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER=$ARCH-gcc \
-DCMAKE_CXX_COMPILER=$ARCH-g++
Then "make -j$(nproc)" and "make install". Use the libiconv build as a
guide since it's similar. Advanced note: If I were doing this myself, I
might move the prefix deeper in /bootstrap, then place command aliases in
/bootstrap/bin/, just as I do with cppcheck. Don't worry about this right
now, though. (I presume the CMake installation is "portable" in that it
can find its data files relative to its binary.)
Docker caches each step, so if it doesn't work, make a change to address
it, and Docker will pick right back up at the failed command. It's a
benefit in addition to a hermetic cross-compile environment. If you're
really stuck, pay attention to the cache image ID (hint: disable BuildKit
because it makes debugging so much harder), and exec a container with bash
on that image to have a look around, and even try building manually. It's
a kind of interactive debug environment.
LLVM will be similar, but it's complicated, with unfriendly dependencies,
so there will surely be complications. For example, I know it requires
Python, but CPython doesn't support cross compilation to Windows. I don't
know how much that matters, but you may need to also download a MSVC-built
CPython from somewhere. Good luck!
|
You can look at #71 for a reference on how to add cmake. LLVM is surely harder, but if you don't want to build it, maybe just adding llvm-mingw to your PATH should be okay. Just be wary it has aliases for gcc and cc too, I think. |
thank you both for your answers! |
By the way anything involving Python has trouble on older Windows versions (<=win7) due to Python's discontinuation of support. |
https://releases.llvm.org/3.7.0/tools/clang/docs/ReleaseNotes.html#id13 This release is listed as the last release of clang that supported windows XP. |
So I wanted to ask, how difficult is it to add both cmake and LLVM to this, for personal use?
Like I don't need anything official, but I just want to know how I can add new things to this.
Do I just edit the docker file?
The text was updated successfully, but these errors were encountered: